Header tweaks

This change does the following:

- Show the header on Linux/Windows when fullscreened, but not in the
player. Users might fullscreen the app when they’re not playing a video.
- Always show the header on OS X (even when fullscreened) since that’s
how the user will exit the video. We can work on adding auto-hiding to
it later.
This commit is contained in:
Feross Aboukhadijeh
2016-03-05 18:31:18 -08:00
parent 79c2295775
commit 69a078ad4c

View File

@@ -8,7 +8,23 @@ var Header = require('./header')
var Player = require('./player')
var TorrentList = require('./torrent-list')
var isOSX = process.platform === 'darwin'
function App (state, dispatch) {
return hx`
<div class='app'>
${getHeader()}
<div class='content'>${getView()}</div>
</div>
`
function getHeader () {
// Hide the header on Windows/Linux when in the player
if (isOSX || state.url !== '/player') {
return Header(state, dispatch)
}
}
function getView () {
if (state.url === '/') {
return TorrentList(state, dispatch)
@@ -16,18 +32,4 @@ function App (state, dispatch) {
return Player(state, dispatch)
}
}
// Show the header only when we're outside of fullscreen
// Also don't show it in the video player except in OSX
var isOSX = process.platform === 'darwin'
var isVideo = state.url === '/player'
var isFullScreen = state.isFullScreen
var header = !isFullScreen && (!isVideo || isOSX) ? Header(state, dispatch) : null
return hx`
<div class="app">
${header}
<div class="content">${getView()}</div>
</div>
`
}