Commit 0ae3757980ed868524769abdc7b07da937191e78
fix peer connected state and progress, use gossip.changes
Matt McKegg committed on 6/30/2017, 10:24:58 AMParent: ae7ae9dc9178bc5dabc8ffa99f0d0caad2c5f8e5
Files changed
modules/page/html/render/public.js | changed |
modules/progress/html/peer.js | changed |
package.json | changed |
modules/page/html/render/public.js | ||
---|---|---|
@@ -156,10 +156,13 @@ | ||
156 | 156 | h('div', { |
157 | 157 | classList: 'ProfileList' |
158 | 158 | }, [ |
159 | 159 | map(ids, (id) => { |
160 | + var connected = computed([connectedPeers, id], (peers, id) => peers.includes(id)) | |
160 | 161 | return h('a.profile', { |
161 | - classList: [ '-connected' ], | |
162 | + classList: [ | |
163 | + when(connected, '-connected') | |
164 | + ], | |
162 | 165 | href: id |
163 | 166 | }, [ |
164 | 167 | h('div.avatar', [api.about.html.image(id)]), |
165 | 168 | h('div.main', [ |
modules/progress/html/peer.js | ||
---|---|---|
@@ -5,26 +5,15 @@ | ||
5 | 5 | |
6 | 6 | exports.needs = nest({ |
7 | 7 | 'progress.html.render': 'first', |
8 | 8 | 'progress.obs.peer': 'first', |
9 | - 'progress.obs.global': 'first' | |
9 | + 'progress.obs.replicate': 'first' | |
10 | 10 | }) |
11 | 11 | |
12 | 12 | exports.create = function (api) { |
13 | 13 | return nest('progress.html.peer', function (id) { |
14 | 14 | var progress = api.progress.obs.peer(id) |
15 | - | |
16 | - var max = 0 | |
17 | - var feeds = computed([api.progress.obs.global().feeds, progress], function (feeds, progress) { | |
18 | - // handle when feeds hasn't finished loading yet, take max from progress | |
19 | - if (progress) { | |
20 | - max = Math.max(max, feeds || 0, progress) | |
21 | - } else { | |
22 | - max = feeds | |
23 | - } | |
24 | - return max | |
25 | - }) | |
26 | - | |
15 | + var feeds = api.progress.obs.replicate().feeds | |
27 | 16 | var value = computed([progress, feeds], (pending, feeds) => { |
28 | 17 | return (feeds - pending) / feeds |
29 | 18 | }) |
30 | 19 |
package.json | ||
---|---|---|
@@ -35,9 +35,9 @@ | ||
35 | 35 | "mutant": "^3.21.2", |
36 | 36 | "mutant-pull-reduce": "^1.1.0", |
37 | 37 | "obv": "0.0.1", |
38 | 38 | "packet-stream": "github:ssbc/packet-stream#c358f319390f9deaf2a015ae276fbdcc965cb4a8", |
39 | - "patchcore": "~1.7.2", | |
39 | + "patchcore": "~1.8.0", | |
40 | 40 | "pull-abortable": "^4.1.0", |
41 | 41 | "pull-defer": "^0.2.2", |
42 | 42 | "pull-file": "~1.0.0", |
43 | 43 | "pull-identify-filetype": "^1.1.0", |
Built with git-ssb-web