import React, { Component } from 'react' import { connect } from 'react-redux' import { EfluxLogo, EfluxClose, TranscriptIcon } from './eflux.icons' import { PlayButton } from './viewer.icons' import actions from 'app/actions' import { URLS } from 'app/constants' const PLAY_MESSAGES = { not_started: 'Start the Exhibition', playing: 'Pause', paused: 'Resume', } class EfluxChrome extends Component { state = { eflux: false, play: false, transcript: false, started: false, playMessage: PLAY_MESSAGES.not_started, } handleMouseEnter(category) { this.setState({ [category]: true }) } handleMouseLeave(category) { this.setState({ [category]: false }) } componentDidUpdate(prevProps) { if (this.props.playing !== prevProps.playing) { if (!this.state.started) { this.setState({ started: true, play: false, }) setTimeout(() => { this.setState({ playMessage: this.props.playing ? PLAY_MESSAGES.playing : PLAY_MESSAGES.paused, }) }, 150) } else { this.setState({ playMessage: this.props.playing ? PLAY_MESSAGES.playing : PLAY_MESSAGES.paused, }) } } } render() { const { navStyle, playing, transcriptOpen, growlOpen, growlMessage, atEndOfSection, currentSection } = this.props const showingTranscriptTooltip = ((atEndOfSection && currentSection.index === 0) || this.state.transcript) return (