module.exports = App var hx = require('../lib/hx') var Header = require('./header') var Views = { 'home': require('./home'), 'player': require('./player'), 'create-torrent': require('./create-torrent'), 'preferences': require('./preferences') } var Modals = { 'open-torrent-address-modal': require('./open-torrent-address-modal'), 'update-available-modal': require('./update-available-modal'), 'unsupported-media-modal': require('./unsupported-media-modal') } function App (state) { // Hide player controls while playing video, if the mouse stays still for a while // Never hide the controls when: // * The mouse is over the controls or we're scrubbing (see CSS) // * The video is paused // * The video is playing remotely on Chromecast or Airplay var hideControls = state.location.url() === 'player' && state.playing.mouseStationarySince !== 0 && new Date().getTime() - state.playing.mouseStationarySince > 2000 && !state.playing.isPaused && state.playing.location === 'local' && state.playing.playbackRate === 1 var cls = [ 'view-' + state.location.url(), /* e.g. view-home, view-player */ 'is-' + process.platform /* e.g. is-darwin, is-win32, is-linux */ ] if (state.window.isFullScreen) cls.push('is-fullscreen') if (state.window.isFocused) cls.push('is-focused') if (hideControls) cls.push('hide-video-controls') return hx`