summaryrefslogtreecommitdiff
path: root/frontend/site
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/site')
-rw-r--r--frontend/site/site/site.reducer.js13
-rw-r--r--frontend/site/viewer/viewer.container.js4
2 files changed, 15 insertions, 2 deletions
diff --git a/frontend/site/site/site.reducer.js b/frontend/site/site/site.reducer.js
index 9763e48..8b31786 100644
--- a/frontend/site/site/site.reducer.js
+++ b/frontend/site/site/site.reducer.js
@@ -5,7 +5,8 @@ const initialState = {
interactive: false,
graph: {
loading: true,
- }
+ },
+ cursors: {},
}
export default function siteReducer(state = initialState, action) {
@@ -21,6 +22,7 @@ export default function siteReducer(state = initialState, action) {
return {
...state,
graph: action.data.graph,
+ cursors: buildCursors(action.data.graph),
}
case types.site.interact:
@@ -41,3 +43,12 @@ export default function siteReducer(state = initialState, action) {
return state
}
}
+
+function buildCursors(graph) {
+ return graph.uploads
+ .filter(upload => upload.tag === 'cursor')
+ .reduce((accumulator, item) => {
+ accumulator[item.id] = item
+ return accumulator
+ }, {})
+} \ No newline at end of file
diff --git a/frontend/site/viewer/viewer.container.js b/frontend/site/viewer/viewer.container.js
index 24534f6..09f04c3 100644
--- a/frontend/site/viewer/viewer.container.js
+++ b/frontend/site/viewer/viewer.container.js
@@ -34,10 +34,10 @@ class ViewerContainer extends Component {
componentDidUpdate(prevProps) {
// console.log('didUpdate', this.props.graph !== prevProps.graph, this.props.location.pathname !== prevProps.location.pathname)
+ // console.log(this.props.location.pathname, prevProps.location.pathname, this.props.interactive)
if (this.props.graph !== prevProps.graph || this.props.location.pathname !== prevProps.location.pathname) {
this.load()
}
- console.log(this.props.location.pathname, prevProps.location.pathname, this.props.interactive)
if (this.props.interactive && (this.props.interactive !== prevProps.interactive)) {
this.setState({ roadblock: false })
this.props.audio.player.playPage(this.state.page)
@@ -195,6 +195,7 @@ class ViewerContainer extends Component {
tile={tile}
audio={audio}
bounds={this.state.bounds}
+ cursors={this.props.cursors}
videoBounds={videoBounds}
onMouseDown={e => this.handleMouseDown(e, tile)}
onPlaybackEnded={e => this.handlePlaybackEnded(e, tile)}
@@ -237,6 +238,7 @@ const mapStateToProps = state => ({
site: state.site,
audio: state.audio,
graph: state.site.graph,
+ cursors: state.site.cursors,
interactive: state.site.interactive,
})