diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-07-22 17:09:28 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-07-22 17:09:28 +0200 |
| commit | 390fdf840b6bda1c830af18c912db1234baa3ebb (patch) | |
| tree | 34c8775566e69bab7e449df131bd65cc454f2c65 /animism-align/frontend | |
| parent | 74888b0fea12020da23ad0825d5d3e55aa6155c4 (diff) | |
route to component for testing purposes
Diffstat (limited to 'animism-align/frontend')
5 files changed, 28 insertions, 6 deletions
diff --git a/animism-align/frontend/app/types.js b/animism-align/frontend/app/types.js index 7fb368c..7e4b9f1 100644 --- a/animism-align/frontend/app/types.js +++ b/animism-align/frontend/app/types.js @@ -22,6 +22,10 @@ export const audio = with_type('audio', [ 'play', 'pause', 'update_time', ]) +export const viewer = with_type('viewer', [ + 'toggle_section' +]) + export const site = with_type('site', [ ]) diff --git a/animism-align/frontend/app/views/viewer/containers/checklist.container.js b/animism-align/frontend/app/views/viewer/containers/checklist.container.js index abe0ed1..5d35e7c 100644 --- a/animism-align/frontend/app/views/viewer/containers/checklist.container.js +++ b/animism-align/frontend/app/views/viewer/containers/checklist.container.js @@ -6,13 +6,13 @@ import { connect } from 'react-redux' import actions from 'app/actions' // import * as uploadActions from './upload.actions' -class Transcript extends Component { +class Checklist extends Component { componentDidMount() { } render() { const { } = this.props return ( - <div className="transcript"> + <div className="checklist"> </div> ) } @@ -25,4 +25,4 @@ const mapDispatchToProps = dispatch => ({ // uploadActions: bindActionCreators({ ...uploadActions }, dispatch), }) -export default connect(mapStateToProps, mapDispatchToProps)(Transcript) +export default connect(mapStateToProps, mapDispatchToProps)(Checklist) diff --git a/animism-align/frontend/app/views/viewer/containers/viewer.router.js b/animism-align/frontend/app/views/viewer/containers/viewer.router.js index e84600f..b432302 100644 --- a/animism-align/frontend/app/views/viewer/containers/viewer.router.js +++ b/animism-align/frontend/app/views/viewer/containers/viewer.router.js @@ -8,17 +8,17 @@ class ViewerRouter extends Component { componentDidMount() { this.route() } - componentDidUpdate() { - this.route() - } route() { console.log(this.props.match.params.component) switch (this.props.match.params.component) { case 'transcript': + actions.viewer.showSection('transcript') break case 'nav': + actions.viewer.showSection('nav') break case 'checklist': + actions.viewer.showSection('checklist') break case 'fullscreenImage': break diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index ed59793..7f8e1c8 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -2,3 +2,13 @@ import * as types from 'app/types' import { store, history, dispatch } from 'app/store' // import { } from 'app/utils' // import actions from 'app/actions' + +export const showSection = section => dispatch => { + dispatch({ type: types.viewer.toggle_section, key: section, value: true }) +} +export const hideSection = section => dispatch => { + dispatch({ type: types.viewer.toggle_section, key: section, value: false }) +} +export const toggleSection = section => dispatch => { + dispatch({ type: types.viewer.toggle_section, key: section, value: !store.getState().viewer[section] }) +} diff --git a/animism-align/frontend/app/views/viewer/viewer.reducer.js b/animism-align/frontend/app/views/viewer/viewer.reducer.js index 039d16f..2668ca1 100644 --- a/animism-align/frontend/app/views/viewer/viewer.reducer.js +++ b/animism-align/frontend/app/views/viewer/viewer.reducer.js @@ -1,6 +1,9 @@ import * as types from 'app/types' const initialState = { + transcript: false, + checklist: false, + nav: false, options: { } } @@ -8,6 +11,11 @@ const initialState = { export default function viewerReducer(state = initialState, action) { // console.log(action.type, action) switch (action.type) { + case types.viewer.toggle_section: + return { + ...state, + [action.key]: action.value, + } default: return state } |
