summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/editor/editor.gate.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2021-03-09 18:10:35 +0100
committerJules Laplace <julescarbon@gmail.com>2021-03-09 18:10:35 +0100
commiteeffc71a1eec3e80f1a1e1147ef1e5581c721c3e (patch)
tree19c048c62ddf9f2e3da6f8a4e3619e9b5330512b /animism-align/frontend/app/views/editor/editor.gate.js
parent786404a8a692448b04fd8df5dbca8013631a0abd (diff)
editor overview / gate
Diffstat (limited to 'animism-align/frontend/app/views/editor/editor.gate.js')
-rw-r--r--animism-align/frontend/app/views/editor/editor.gate.js27
1 files changed, 22 insertions, 5 deletions
diff --git a/animism-align/frontend/app/views/editor/editor.gate.js b/animism-align/frontend/app/views/editor/editor.gate.js
index 968680f..b835a69 100644
--- a/animism-align/frontend/app/views/editor/editor.gate.js
+++ b/animism-align/frontend/app/views/editor/editor.gate.js
@@ -1,32 +1,49 @@
import React, { Component } from 'react'
+import { connect } from 'react-redux'
import { Loader } from 'app/common'
import actions from 'app/actions'
-export default class EditorGate extends Component {
+class EditorGate extends Component {
constructor(props) {
super(props)
this.load()
}
+ componentDidMount() {
+ this.load()
+ }
+
componentDidUpdate(prevProps) {
- if (this.props.episode_id !== prevProps.episode_id) {
+ if (
+ this.props.episode_id !== prevProps.episode_id ||
+ this.props.episode.lookup !== prevProps.episode.lookup
+ ) {
this.load()
}
}
load() {
- this.props.episode_id && actions.site.loadEpisode()
+ if (!this.props.episode.lookup) return
+ if (!this.props.episode_id) return
+ const episode = this.props.episode.lookup[this.props.episode_id]
+ actions.site.loadEpisode(episode)
}
render() {
- if (this.props.logged_in) {
+ if (parseInt(this.props.episode_id) === parseInt(this.props.currentEpisodeId)) {
return this.props.children
}
return (
- <Loader />
+ <div className="dashboard"><Loader /></div>
)
}
}
+const mapStateToProps = state => ({
+ episode: state.episode.index,
+ currentEpisodeId: state.align.currentEpisodeId,
+})
+
+export default connect(mapStateToProps)(EditorGate) \ No newline at end of file