From ef78bc6a084f92b4794e987b5832240d85b6479e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 22 Jul 2020 14:05:15 +0200 Subject: refactor app using babel module-resolver --- .../frontend/app/views/site/component.template.js | 28 ++++++++++++++++++++++ .../frontend/app/views/site/site.actions.js | 14 +++++++++++ .../frontend/app/views/site/site.reducer.js | 24 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 animism-align/frontend/app/views/site/component.template.js create mode 100644 animism-align/frontend/app/views/site/site.actions.js create mode 100644 animism-align/frontend/app/views/site/site.reducer.js (limited to 'animism-align/frontend/app/views/site') diff --git a/animism-align/frontend/app/views/site/component.template.js b/animism-align/frontend/app/views/site/component.template.js new file mode 100644 index 0000000..5b22206 --- /dev/null +++ b/animism-align/frontend/app/views/site/component.template.js @@ -0,0 +1,28 @@ +import React, { Component } from 'react' +// import { Link } from 'react-router-dom' +// import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import actions from 'app/actions' +// import * as uploadActions from './upload.actions' + +class ComponentTemplate extends Component { + componentDidMount() { + } + render() { + const { } = this.props + return ( +
+
+ ) + } +} + +const mapStateToProps = state => ({ +}) + +const mapDispatchToProps = dispatch => ({ + // uploadActions: bindActionCreators({ ...uploadActions }, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(ComponentTemplate) diff --git a/animism-align/frontend/app/views/site/site.actions.js b/animism-align/frontend/app/views/site/site.actions.js new file mode 100644 index 0000000..b894c64 --- /dev/null +++ b/animism-align/frontend/app/views/site/site.actions.js @@ -0,0 +1,14 @@ +import * as types from 'app/types' +import { api, post, pad, preloadImage } from 'app/utils' + +export const loadPeaks = (asdf) => dispatch => { + api(dispatch, types.peaks, 'peaks', '/static/data_store/peaks/peaks.json') +} + +export const loadText = (asdf) => dispatch => { + api(dispatch, types.text, 'text', '/static/data_store/peaks/text.txt') +} + +export const updateText = text => dispatch => { + dispatch({ type: types.text.loaded, data: text }) +} \ No newline at end of file diff --git a/animism-align/frontend/app/views/site/site.reducer.js b/animism-align/frontend/app/views/site/site.reducer.js new file mode 100644 index 0000000..fbb53fc --- /dev/null +++ b/animism-align/frontend/app/views/site/site.reducer.js @@ -0,0 +1,24 @@ +import * as types from 'app/types' + +const initialState = { + peaks: { loading: true }, + text: { loading: true }, +} + +export default function siteReducer(state = initialState, action) { + // console.log(action.type, action) + switch (action.type) { + case types.peaks.loaded: + return { + ...state, + peaks: action.data, + } + case types.text.loaded: + return { + ...state, + text: action.data, + } + default: + return state + } +} -- cgit v1.2.3-70-g09d2