From d8bb176ef1918b2158f808b557cb1147e616511b Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Thu, 23 Feb 2017 11:11:42 +0100 Subject: [PATCH 1/4] add WIP progress text --- elements/status.js | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/elements/status.js b/elements/status.js index 9c3a18c6..89dee091 100644 --- a/elements/status.js +++ b/elements/status.js @@ -81,11 +81,20 @@ module.exports = function (dat, stats, send) { : (stats.state === 'paused') ? 'line-paused' : 'line-complete' + var netStats = dat.stats.network + var progressText = (stats.progress === 100) + ? `Download Complete. ↑ ${speed(dat.network.uploadSpeed)}` + : (dat.network.connected) ? `↓ ${speed(netStats.downloadSpeed)} ↑ ${speed(netStats.uploadSpeed)}` + : 'waiting for peers...' + function speed (n) { + return (n || 0) + 'kB/s' + } return html`
${stats.progress}% + ${progressText}
diff --git a/package.json b/package.json index 3a46d4af..e65b9f2e 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "dat-doctor": "^1.2.2", "dat-encoding": "^4.0.1", "dat-icons": "^1.3.0", - "dat-worker": "^5.9.1", + "dat-worker": "^5.10.0", "electron-auto-updater": "^0.9.2", "electron-default-menu": "^1.0.0", "electron-window": "^0.8.1", From d492186bc01cdc38b2c3dbefe38841efd2474e86 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Thu, 23 Feb 2017 12:09:28 +0100 Subject: [PATCH 2/4] refactor --- elements/status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elements/status.js b/elements/status.js index 89dee091..3eb12f9d 100644 --- a/elements/status.js +++ b/elements/status.js @@ -87,7 +87,7 @@ module.exports = function (dat, stats, send) { : (dat.network.connected) ? `↓ ${speed(netStats.downloadSpeed)} ↑ ${speed(netStats.uploadSpeed)}` : 'waiting for peers...' function speed (n) { - return (n || 0) + 'kB/s' + return `${n || 0}kB/s` } return html` From 6e8c8908b764c9f3f79cee0831d0cefbc9754a31 Mon Sep 17 00:00:00 2001 From: Kristina Schneider Date: Thu, 23 Feb 2017 12:14:12 +0100 Subject: [PATCH 3/4] replace ... with ellipsis character --- elements/status.js | 4 ++-- lib/auto-updater.js | 5 ++--- lib/browserify.js | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/elements/status.js b/elements/status.js index 89dee091..7e3bf2e8 100644 --- a/elements/status.js +++ b/elements/status.js @@ -74,7 +74,7 @@ const progressbar = css` ` module.exports = function (dat, stats, send) { if (dat.owner && dat.importer) { - return html`
Watching for updates...
` + return html`
Watching for updates…
` } var progressbarLine = (stats.state === 'loading') ? 'line-loading' @@ -85,7 +85,7 @@ module.exports = function (dat, stats, send) { var progressText = (stats.progress === 100) ? `Download Complete. ↑ ${speed(dat.network.uploadSpeed)}` : (dat.network.connected) ? `↓ ${speed(netStats.downloadSpeed)} ↑ ${speed(netStats.uploadSpeed)}` - : 'waiting for peers...' + : 'waiting for peers…' function speed (n) { return (n || 0) + 'kB/s' } diff --git a/lib/auto-updater.js b/lib/auto-updater.js index 22f0971e..b127bd8e 100644 --- a/lib/auto-updater.js +++ b/lib/auto-updater.js @@ -12,7 +12,7 @@ module.exports = ({ log }) => { autoUpdater.setFeedURL(`http://dat.land:6000/update/${platform}/${version}`) autoUpdater.on('error', onerror) autoUpdater.on('checking-for-update', () => log('checking for update')) - autoUpdater.on('update-available', () => log('update available, downloading...')) + autoUpdater.on('update-available', () => log('update available, downloading…')) autoUpdater.on('update-not-available', () => log('update not available')) autoUpdater.on('download-progress', p => log('download progress ' + p.percent)) autoUpdater.on('update-downloaded', (ev, notes, version) => { @@ -27,7 +27,7 @@ module.exports = ({ log }) => { }, res => { const update = res === 0 if (!update) return log('dismiss') - log('updating...') + log('updating…') autoUpdater.quitAndInstall() }) }) @@ -35,4 +35,3 @@ module.exports = ({ log }) => { setTimeout(() => autoUpdater.checkForUpdates(), ms('10s')) setInterval(() => autoUpdater.checkForUpdates(), ms('30m')) } - diff --git a/lib/browserify.js b/lib/browserify.js index f8d42f83..5b9dae4b 100644 --- a/lib/browserify.js +++ b/lib/browserify.js @@ -47,7 +47,7 @@ module.exports = opts => { b.transform('sheetify/transform', { use: ['sheetify-nested'] }) const bundle = () => { - process.stderr.write(`${new Date()} bundling...`) + process.stderr.write(`${new Date()} bundling…`) b.bundle().pipe(concat(js => { fs.writeFile(`${__dirname}/../bundle.js`, js, err => { From de7fef8501735851e6dc603f7feb60cfa964fd31 Mon Sep 17 00:00:00 2001 From: Kristina Schneider Date: Thu, 23 Feb 2017 14:08:38 +0100 Subject: [PATCH 4/4] style download speed stats --- elements/status.js | 36 +++++++++++++++++++++++++----------- elements/table.js | 13 ++++++++----- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/elements/status.js b/elements/status.js index 0f645276..e2e0cba0 100644 --- a/elements/status.js +++ b/elements/status.js @@ -9,8 +9,7 @@ const progressbar = css` min-width: 8rem; overflow: hidden; - padding-top: .85rem; - padding-bottom: .5rem; + padding-top: .4rem; .bar { height: var(--progress-height); width: calc(100% - var(--counter-width)); @@ -72,6 +71,15 @@ const progressbar = css` } } ` + +const progressSubline = css` + :host { + .arrow { + vertical-align: top; + } + } +` + module.exports = function (dat, stats, send) { if (dat.owner && dat.importer) { return html`
Watching for updates…
` @@ -83,23 +91,29 @@ module.exports = function (dat, stats, send) { : 'line-complete' var netStats = dat.stats.network var progressText = (stats.progress === 100) - ? `Download Complete. ↑ ${speed(dat.network.uploadSpeed)}` - : (dat.network.connected) ? `↓ ${speed(netStats.downloadSpeed)} ↑ ${speed(netStats.uploadSpeed)}` + ? `Complete. ↑ ${speed(dat.network.uploadSpeed)}` + : (dat.network.connected) ? html` ${speed(netStats.downloadSpeed)} ${speed(netStats.uploadSpeed)}` : 'waiting for peers…' function speed (n) { return `${n || 0}kB/s` } return html` -
-
- ${stats.progress}% - ${progressText} -
-
-
+
+
+
+ ${stats.progress}% +
+
+
+
+

+ + ${progressText} + +

` } diff --git a/elements/table.js b/elements/table.js index a5692cc1..da010810 100644 --- a/elements/table.js +++ b/elements/table.js @@ -11,6 +11,9 @@ const icon = require('./icon') const table = css` :host { width: 100%; + tr:odd:hover td { + background: red; + } th, td { padding-right: .75rem; @@ -34,7 +37,7 @@ const table = css` } td { height: 4rem; - vertical-align: middle; + vertical-align: top; padding-top: 1rem; } tr:hover td { @@ -63,7 +66,7 @@ const table = css` width: 26vw; } .row-action { - height: 2rem; + height: 1.5rem; display: inline-block; border: 0; background: transparent; @@ -115,8 +118,8 @@ function tableElement (dats, send) { Link Status - Size - Network + Size + Peers @@ -214,7 +217,7 @@ function row (dat, send) {
-

+

${title}