From 3a35d6f81f4c17310baa29b0d077e8a70bf2f5dd Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 6 Apr 2021 18:57:56 +0200 Subject: nora text placement --- frontend/site/projects/museum/views/text.overlay.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'frontend/site/projects/museum/views') diff --git a/frontend/site/projects/museum/views/text.overlay.js b/frontend/site/projects/museum/views/text.overlay.js index 9627901..cb141e7 100644 --- a/frontend/site/projects/museum/views/text.overlay.js +++ b/frontend/site/projects/museum/views/text.overlay.js @@ -25,10 +25,24 @@ class TextOverlay extends Component { if (this.props.location.pathname !== prevProps.location.pathname) { this.load() } + if ( + this.props.popups !== prevProps.popups + && this.state.content + && this.state.content.popup + && this.props.popups[this.state.content.popup] + && this.state.content.audio_url + ) { + this.props.audio.player.stop("text-overlay") + this.props.audio.player.playURL({ + id: "text-overlay", + url: this.state.content.audio_url, + }) + } } load() { const { page_name } = this.props.match.params + this.props.audio.player.stop("text-overlay") if (TEXT_OVERLAYS[page_name]) { this.setState({ content: TEXT_OVERLAYS[page_name], @@ -78,6 +92,7 @@ class TextOverlay extends Component { } const mapStateToProps = state => ({ + audio: state.audio, popups: state.site.popups, interactive: state.site.interactive, }) -- cgit v1.2.3-70-g09d2