git ssb

16+

Dominic / patchbay



Commit 2f61b5b3290364b166a9c8fe8deaa025e501e8b9

add follow rendering

mix irving committed on 4/2/2017, 11:18:30 AM
Parent: cfe9ce7cf96f4027441c0d3ce54ead220a5018b1

Files changed

main/sync/catch-keyboard-shortcut.jschanged
message/html/render/follow.jsadded
main/sync/catch-keyboard-shortcut.jsView
@@ -108,9 +108,9 @@
108108 if (msg === undefined) return setTimeout(locateKey, 100)
109109
110110 if (msg && msg.dataset && msg.dataset.key === key) return
111111
112- locateKey ()
112+ locateKey()
113113 }
114114 }
115115
116116 function toggleRawMessage (ev) {
message/html/render/follow.jsView
@@ -1,0 +1,37 @@
1+const nest = require('depnest')
2+const extend = require('xtend')
3+
4+exports.gives = nest('message.html.render')
5+
6+exports.needs = nest({
7+ 'about.html.link': 'first',
8+ 'message.html': {
9+ decorate: 'reduce',
10+ layout: 'first'
11+ }
12+})
13+
14+exports.create = function (api) {
15+ return nest('message.html.render', follow)
16+
17+ function follow (msg, opts) {
18+ if (msg.value.content.type !== 'contact') return
19+
20+ const element = api.message.html.layout(msg, extend({
21+ content: renderContent(msg),
22+ layout: 'mini'
23+ }, opts))
24+
25+ return api.message.html.decorate(element, { msg })
26+ }
27+
28+ function renderContent (msg) {
29+ const { contact, following } = msg.value.content
30+
31+ return [
32+ following ? 'followed ' : 'unfollowed ',
33+ api.about.html.link(contact)
34+ ]
35+ }
36+}
37+

Built with git-ssb-web