UI progress

This commit is contained in:
Feross Aboukhadijeh
2016-03-01 23:38:38 -08:00
parent 6b74c8eb68
commit 1350e3c5b5
3 changed files with 90 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ function App (state, handler) {
autoplay: true,
controls: true
}),
h('button.close', {
h('a.close', {
onclick: closePlayer
}, 'Close')
])
@@ -18,17 +18,22 @@ function App (state, handler) {
var list = state.torrents.map(function (torrent) {
var style = {}
if (torrent.posterURL) {
style['background-image'] = 'url("' + torrent.posterURL + '")'
style['background-image'] = 'linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)), url("' + torrent.posterURL + '")'
}
return h('.torrent', {
style: style
}, [
h('.name', torrent.name),
h('.progress', String(torrent.progress * 100) + '%'),
h('button.play', {
disabled: !torrent.ready,
h('.metadata', [
h('.name.ellipsis', torrent.name || 'Loading torrent...'),
h('.status', [
h('span.progress', Math.floor(100 * torrent.progress) + '%'),
(torrent.ready && torrent.files.length > 1) ? h('span.files', torrent.files.length + ' files') : ''
])
]),
h('a.play', {
className: !torrent.ready ? 'disabled' : '',
onclick: openPlayer
}, 'Play')
}, '')
])
function openPlayer () {