Merge pull request #490 from feross/smaller-ui
UI tweaks: Reduce font size, list item height, single torrent status line
This commit is contained in:
@@ -80,7 +80,7 @@ function createWebTorrentHiddenWindow () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var HEADER_HEIGHT = 37
|
var HEADER_HEIGHT = 37
|
||||||
var TORRENT_HEIGHT = 120
|
var TORRENT_HEIGHT = 100
|
||||||
|
|
||||||
function createMainWindow () {
|
function createMainWindow () {
|
||||||
if (windows.main) {
|
if (windows.main) {
|
||||||
@@ -97,7 +97,7 @@ function createMainWindow () {
|
|||||||
titleBarStyle: 'hidden-inset', // Hide OS chrome, except traffic light buttons (OS X)
|
titleBarStyle: 'hidden-inset', // Hide OS chrome, except traffic light buttons (OS X)
|
||||||
useContentSize: true, // Specify web page size without OS chrome
|
useContentSize: true, // Specify web page size without OS chrome
|
||||||
width: 500,
|
width: 500,
|
||||||
height: HEADER_HEIGHT + (TORRENT_HEIGHT * 5) // header height + 4 torrents
|
height: HEADER_HEIGHT + (TORRENT_HEIGHT * 6) // header height + 5 torrents
|
||||||
})
|
})
|
||||||
win.loadURL(config.WINDOW_MAIN)
|
win.loadURL(config.WINDOW_MAIN)
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
|
|||||||
@@ -276,7 +276,6 @@ table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal label {
|
.modal label {
|
||||||
font-size: 16px;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,7 +433,7 @@ input {
|
|||||||
|
|
||||||
.torrent,
|
.torrent,
|
||||||
.torrent-placeholder {
|
.torrent-placeholder {
|
||||||
height: 120px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.torrent:not(:last-child) {
|
.torrent:not(:last-child) {
|
||||||
@@ -447,9 +446,9 @@ input {
|
|||||||
|
|
||||||
.torrent .metadata {
|
.torrent .metadata {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20px;
|
top: 25px;
|
||||||
left: 20px;
|
left: 15px;
|
||||||
right: 20px;
|
right: 15px;
|
||||||
width: calc(100% - 40px);
|
width: calc(100% - 40px);
|
||||||
text-shadow: rgba(0, 0, 0, 0.5) 0 0 4px;
|
text-shadow: rgba(0, 0, 0, 0.5) 0 0 4px;
|
||||||
}
|
}
|
||||||
@@ -459,12 +458,15 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.torrent .metadata span:not(:last-child)::after {
|
.torrent .metadata span:not(:last-child)::after {
|
||||||
content: ' — ';
|
content: ' • ';
|
||||||
|
opacity: 0.7;
|
||||||
|
padding-left: 4px;
|
||||||
|
padding-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.torrent .buttons {
|
.torrent .buttons {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 25px;
|
top: 29px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: none;
|
display: none;
|
||||||
@@ -547,17 +549,11 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.torrent .name {
|
.torrent .name {
|
||||||
font-size: 1.5em;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.torrent .status,
|
|
||||||
.torrent .status2 {
|
|
||||||
font-size: 1em;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TORRENT LIST: DRAG-DROP TARGET
|
* TORRENT LIST: DRAG-DROP TARGET
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -67,39 +67,49 @@ function TorrentList (state) {
|
|||||||
// If it's downloading/seeding then show progress info
|
// If it's downloading/seeding then show progress info
|
||||||
var prog = torrentSummary.progress
|
var prog = torrentSummary.progress
|
||||||
if (torrentSummary.status !== 'paused' && prog) {
|
if (torrentSummary.status !== 'paused' && prog) {
|
||||||
var progress = Math.floor(100 * prog.progress)
|
|
||||||
var downloaded = prettyBytes(prog.downloaded)
|
|
||||||
var total = prettyBytes(prog.length || 0)
|
|
||||||
if (downloaded !== total) downloaded += ` / ${total}`
|
|
||||||
|
|
||||||
elements.push(hx`
|
elements.push(hx`
|
||||||
<div class='status ellipsis'>
|
<div class='ellipsis'>
|
||||||
${getFilesLength()}
|
${renderPercentProgress()}
|
||||||
<span>${getPeers()}</span>
|
${renderTotalProgress()}
|
||||||
<span>↓ ${prettyBytes(prog.downloadSpeed || 0)}/s</span>
|
${renderPeers()}
|
||||||
<span>↑ ${prettyBytes(prog.uploadSpeed || 0)}/s</span>
|
${renderDownloadSpeed()}
|
||||||
</div>
|
${renderUploadSpeed()}
|
||||||
`)
|
|
||||||
elements.push(hx`
|
|
||||||
<div class='status2 ellipsis'>
|
|
||||||
<span class='progress'>${progress}%</span>
|
|
||||||
<span>${downloaded}</span>
|
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return hx`<div class='metadata'>${elements}</div>`
|
return hx`<div class='metadata'>${elements}</div>`
|
||||||
|
|
||||||
function getPeers () {
|
function renderPercentProgress () {
|
||||||
var count = prog.numPeers === 1 ? 'peer' : 'peers'
|
var progress = Math.floor(100 * prog.progress)
|
||||||
return `${prog.numPeers} ${count}`
|
return hx`<span>${progress}%</span>`
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFilesLength () {
|
function renderTotalProgress () {
|
||||||
if (torrentSummary.files && torrentSummary.files.length > 1) {
|
var downloaded = prettyBytes(prog.downloaded)
|
||||||
return hx`<span class='files'>${torrentSummary.files.length} files</span>`
|
var total = prettyBytes(prog.length || 0)
|
||||||
|
if (downloaded === total) {
|
||||||
|
return hx`<span>${downloaded}</span>`
|
||||||
|
} else {
|
||||||
|
return hx`<span>${downloaded} / ${total}</span>`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderPeers () {
|
||||||
|
if (prog.numPeers === 0) return
|
||||||
|
var count = prog.numPeers === 1 ? 'peer' : 'peers'
|
||||||
|
return hx`<span>${prog.numPeers} ${count}</span>`
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderDownloadSpeed () {
|
||||||
|
if (prog.downloadSpeed === 0) return
|
||||||
|
return hx`<span>↓ ${prettyBytes(prog.downloadSpeed)}/s</span>`
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderUploadSpeed () {
|
||||||
|
if (prog.uploadSpeed === 0) return
|
||||||
|
return hx`<span>↑ ${prettyBytes(prog.uploadSpeed)}/s</span>`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download button toggles between torrenting (DL/seed) and paused
|
// Download button toggles between torrenting (DL/seed) and paused
|
||||||
|
|||||||
Reference in New Issue
Block a user