Commit d15b96a003ad7cda460400ff89c7f363316dd3b5
fix profile ranking, add follow button on profiles sheet
Matt McKegg committed on 2/13/2018, 3:52:29 AMParent: ad6ad7c587fb440270e66c1679db0abc3908635a
Files changed
modules/page/html/render/profile.js | changed |
modules/sheet/profiles.js | changed |
styles/dark/profile-list.mcss | changed |
styles/light/profile-list.mcss | changed |
modules/page/html/render/profile.js | ||
---|---|---|
@@ -20,9 +20,8 @@ | ||
20 | 20 | 'feed.pull.profile': 'first', |
21 | 21 | 'sbot.async.publish': 'first', |
22 | 22 | 'keys.sync.id': 'first', |
23 | 23 | 'sheet.display': 'first', |
24 | - 'profile.obs.rank': 'first', | |
25 | 24 | 'profile.sheet.edit': 'first', |
26 | 25 | 'app.navigate': 'first', |
27 | 26 | 'profile.obs.contact': 'first', |
28 | 27 | 'profile.obs.recentlyUpdated': 'first', |
@@ -233,13 +232,13 @@ | ||
233 | 232 | |
234 | 233 | // scoped |
235 | 234 | |
236 | 235 | function onlyFollowing (ids, max) { |
237 | - return computed([ids, contact.yourFollowing, recent], (a, b, c) => { | |
236 | + return computed([recent, ids, contact.yourFollowing], (a, b, c) => { | |
238 | 237 | var result = a.filter(x => b.includes(x) && c.includes(x)) |
239 | 238 | if (result.length === 0 && a.length) { |
240 | 239 | // fallback to just recent |
241 | - result = a.filter(x => c.includes(x)) | |
240 | + result = a.filter(x => b.includes(x)) | |
242 | 241 | } |
243 | 242 | if (max) { |
244 | 243 | return result.slice(0, max) |
245 | 244 | } else { |
@@ -248,9 +247,9 @@ | ||
248 | 247 | }) |
249 | 248 | } |
250 | 249 | |
251 | 250 | function onlyRecent (ids, max) { |
252 | - return computed([ids, recent], (a, b) => { | |
251 | + return computed([recent, ids], (a, b) => { | |
253 | 252 | var result = a.filter(x => b.includes(x)) |
254 | 253 | if (max) { |
255 | 254 | return result.slice(0, max) |
256 | 255 | } else { |
modules/sheet/profiles.js | ||
---|---|---|
@@ -5,8 +5,9 @@ | ||
5 | 5 | exports.needs = nest({ |
6 | 6 | 'sheet.display': 'first', |
7 | 7 | 'keys.sync.id': 'first', |
8 | 8 | 'contact.obs.following': 'first', |
9 | + 'contact.html.followToggle': 'first', | |
9 | 10 | 'profile.obs.rank': 'first', |
10 | 11 | 'about.html.image': 'first', |
11 | 12 | 'about.obs.name': 'first', |
12 | 13 | 'app.navigate': 'first', |
@@ -78,25 +79,24 @@ | ||
78 | 79 | }) |
79 | 80 | |
80 | 81 | function renderContactBlock (profiles) { |
81 | 82 | var yourId = api.keys.sync.id() |
82 | - var yourFollows = api.contact.obs.following(yourId) | |
83 | 83 | profiles = api.profile.obs.rank(profiles) |
84 | 84 | return [ |
85 | 85 | h('div', { |
86 | 86 | classList: 'ProfileList' |
87 | 87 | }, [ |
88 | 88 | map(profiles, (id) => { |
89 | - var following = computed(yourFollows, f => f.includes(id)) | |
90 | 89 | return h('a.profile', { |
91 | 90 | href: id, |
92 | - classList: [ | |
93 | - when(following, '-following') | |
94 | - ] | |
91 | + title: id | |
95 | 92 | }, [ |
96 | 93 | h('div.avatar', [api.about.html.image(id)]), |
97 | 94 | h('div.main', [ |
98 | 95 | h('div.name', [ api.about.obs.name(id) ]) |
96 | + ]), | |
97 | + h('div.buttons', [ | |
98 | + api.contact.html.followToggle(id, {block: false}) | |
99 | 99 | ]) |
100 | 100 | ]) |
101 | 101 | }, { idle: true, maxTime: 2 }) |
102 | 102 | ]) |
Built with git-ssb-web