diff options
Diffstat (limited to 'frontend/site')
| -rw-r--r-- | frontend/site/index.js | 2 | ||||
| -rw-r--r-- | frontend/site/viewer/viewer.container.js | 25 |
2 files changed, 18 insertions, 9 deletions
diff --git a/frontend/site/index.js b/frontend/site/index.js index 337d362..6d80528 100644 --- a/frontend/site/index.js +++ b/frontend/site/index.js @@ -4,7 +4,7 @@ import { Provider } from 'react-redux' import './site.css' -import App from 'site/app' +import App from './APP_TARGET' import { store, history } from 'site/store' diff --git a/frontend/site/viewer/viewer.container.js b/frontend/site/viewer/viewer.container.js index 52eb114..7d8a71b 100644 --- a/frontend/site/viewer/viewer.container.js +++ b/frontend/site/viewer/viewer.container.js @@ -15,6 +15,7 @@ class ViewerContainer extends Component { page: {}, bounds: { width: window.innerWidth, height: window.innerHeight }, roadblock: false, + unloaded: false, popups: {}, hidden: {}, time: 0, @@ -36,6 +37,11 @@ class ViewerContainer extends Component { if (this.props.graph !== prevProps.graph || this.props.location.pathname !== prevProps.location.pathname) { this.load() } + if (this.props.interactive && (this.props.interactive !== prevProps.interactive)) { + this.setState({ roadblock: false }) + this.props.audio.player.playPage(this.state.page) + this.resetTimer(this.state.page) + } } componentWillUnmount() { @@ -44,14 +50,18 @@ class ViewerContainer extends Component { } load() { - const { graph_name, page_name } = this.props.match.params + const { page_name } = this.props.match.params + const { pages, home_page, path: graph_name } = this.props.graph const page_path = ["", graph_name, page_name].join('/') - const { pages, home_page } = this.props.graph + // if ((!page_path in pages) || page_name === 'index.html') { + // this.setState({ unloaded: true }) + // return + // } const page = pages[page_path] || pages[home_page] if (!this.props.interactive && hasAutoplay(page)) { - this.setState({ page, popups: {}, hidden: {}, roadblock: true }) + this.setState({ page, popups: {}, hidden: {}, roadblock: true, unloaded: false }) } else { - this.setState({ page, popups: {}, hidden: {}, roadblock: false }) + this.setState({ page, popups: {}, hidden: {}, roadblock: false, unloaded: false }) actions.site.interact() this.props.audio.player.playPage(page) this.resetTimer(page) @@ -144,6 +154,9 @@ class ViewerContainer extends Component { render() { const { page, audio, popups, hidden, time } = this.state + if (this.state.unloaded) { + return null + } if (this.state.roadblock) { return this.renderRoadblock() } @@ -193,11 +206,7 @@ class ViewerContainer extends Component { } removeRoadblock() { - console.log("remove roadblock") actions.site.interact() - this.setState({ roadblock: false }) - this.props.audio.player.playPage(this.state.page) - this.resetTimer(this.state.page) } renderRoadblock() { |
