diff options
Diffstat (limited to 'frontend/app/views/tile')
| -rw-r--r-- | frontend/app/views/tile/components/tile.form.js | 15 | ||||
| -rw-r--r-- | frontend/app/views/tile/handles/tile.video.js | 23 |
2 files changed, 27 insertions, 11 deletions
diff --git a/frontend/app/views/tile/components/tile.form.js b/frontend/app/views/tile/components/tile.form.js index 7d0780d..728bc05 100644 --- a/frontend/app/views/tile/components/tile.form.js +++ b/frontend/app/views/tile/components/tile.form.js @@ -13,7 +13,8 @@ import { import AudioSelect from 'app/views/audio/components/audio.select' import { preloadImage, preloadVideo } from 'app/utils' -import * as tileActions from '../../tile/tile.actions' +import * as pageActions from 'app/views/page/page.actions' +import * as tileActions from 'app/views/tile/tile.actions' const SELECT_TYPES = [ "image", "text", "video", "link", "script", @@ -66,13 +67,13 @@ const CURSORS = [ const NO_LINK = 0 const EXTERNAL_LINK = -1 const OPEN_POPUP_LINK = -2 -const CLOSE_POPUP_LINK = -2 +const CLOSE_POPUP_LINK = -3 const PAGE_LIST_TOP_OPTIONS = [ { name: NO_LINK, label: 'No link' }, { name: EXTERNAL_LINK, label: 'External link' }, { name: OPEN_POPUP_LINK, label: 'Open popup' }, { name: CLOSE_POPUP_LINK, label: 'Close popup' }, - { name: -3, label: '──────────', disabled: true }, + { name: -99, label: '──────────', disabled: true }, ] // target_page_id = Column(Integer, ForeignKey('page.id'), nullable=True) @@ -410,6 +411,9 @@ class TileForm extends Component { return ( <div className='box'> <h1>{title}</h1> + <button className='box_corner' onClick={this.props.pageActions.toggleSidebarSide}> + {'◁'} + </button> <form onSubmit={this.handleSubmit}> <div className="row selects"> <Select @@ -802,7 +806,7 @@ class TileForm extends Component { return ( <div> <Checkbox - label="Add audio events" + label="Sound effects" name="has_audio" checked={temporaryTile.settings.has_audio} onChange={this.handleSettingsSelect} @@ -880,7 +884,6 @@ class TileForm extends Component { title="Popup group" name="popup_group" data={temporaryTile.settings} - error={errorFields.has('popup_group')} onChange={this.handleSettingsChange} autoComplete="off" /> @@ -897,7 +900,6 @@ class TileForm extends Component { title="Appear after" name="appear_after" data={temporaryTile.settings} - error={errorFields.has('appear_after')} onChange={this.handleSettingsChange} autoComplete="off" /> @@ -915,6 +917,7 @@ const mapStateToProps = state => ({ }) const mapDispatchToProps = dispatch => ({ + pageActions: bindActionCreators({ ...pageActions }, dispatch), tileActions: bindActionCreators({ ...tileActions }, dispatch), }) diff --git a/frontend/app/views/tile/handles/tile.video.js b/frontend/app/views/tile/handles/tile.video.js index 001cce2..a9f0d09 100644 --- a/frontend/app/views/tile/handles/tile.video.js +++ b/frontend/app/views/tile/handles/tile.video.js @@ -11,12 +11,25 @@ export default class TileVideo extends Component { this.handleEnded = this.handleEnded.bind(this) } componentDidMount() { - this.videoRef.current.addEventListener('ended', this.handleEnded) - this.videoRef.current.addEventListener('timeupdate', this.handleTimeUpdate) + this.bind() + } + componentDidUpdate() { + this.unbind() + this.bind() } componentWillUnmount() { - this.videoRef.current.removeEventListener('timeupdate', this.handleTimeUpdate) - this.videoRef.current.removeEventListener('ended', this.handleEnded) + this.unbind() + } + bind() { + if (!this.videoRef.current) return + this.el = this.videoRef.current + this.el.addEventListener('ended', this.handleEnded) + this.el.addEventListener('timeupdate', this.handleTimeUpdate) + } + unbind() { + if (!this.el) return + this.el.removeEventListener('timeupdate', this.handleTimeUpdate) + this.el.removeEventListener('ended', this.handleEnded) } handleTimeUpdate() { if (this.props.tile.settings.loop && this.props.tile.settings.loop_section) { @@ -63,7 +76,7 @@ export default class TileVideo extends Component { autoPlay={true} controls={false} loop={tile.settings.loop} - muted={tile.settings.muted} + muted={viewing ? tile.settings.muted : true} style={generateVideoStyle(tile, bounds)} /> </div> |
