From d2cb17038b8537a609be06be2ed7013dbe27117e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 8 Mar 2021 22:11:55 +0100 Subject: beginning the BIG refactor. moving editor stuff into per-episode hierarchy --- .../frontend/app/views/editor/editor.gate.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 animism-align/frontend/app/views/editor/editor.gate.js (limited to 'animism-align/frontend/app/views/editor/editor.gate.js') diff --git a/animism-align/frontend/app/views/editor/editor.gate.js b/animism-align/frontend/app/views/editor/editor.gate.js new file mode 100644 index 0000000..968680f --- /dev/null +++ b/animism-align/frontend/app/views/editor/editor.gate.js @@ -0,0 +1,32 @@ +import React, { Component } from 'react' + +import { Loader } from 'app/common' + +import actions from 'app/actions' + +export default class EditorGate extends Component { + constructor(props) { + super(props) + this.load() + } + + componentDidUpdate(prevProps) { + if (this.props.episode_id !== prevProps.episode_id) { + this.load() + } + } + + load() { + this.props.episode_id && actions.site.loadEpisode() + } + + render() { + if (this.props.logged_in) { + return this.props.children + } + return ( + + ) + } +} + -- cgit v1.2.3-70-g09d2