summaryrefslogtreecommitdiff
path: root/frontend/site/viewer/viewer.container.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/site/viewer/viewer.container.js')
-rw-r--r--frontend/site/viewer/viewer.container.js25
1 files changed, 17 insertions, 8 deletions
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() {