git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Tree: 7fcedd68ba11b29b833cf44059c4ed648f429b28

Files: 7fcedd68ba11b29b833cf44059c4ed648f429b28 / modules / feed / html / thread.js

662 bytesRaw
1var { h, computed, map } = require('mutant')
2var nest = require('depnest')
3
4exports.needs = nest({
5 'feed.obs.thread': 'first',
6 'message.html.render': 'first'
7})
8
9exports.gives = nest('feed.html.thread')
10
11exports.create = function (api) {
12 return nest('feed.html.thread', function (rootId) {
13 var thread = api.feed.obs.thread(rootId)
14
15 var container = h('div', {className: 'Thread'}, [
16 map(thread.messages, (msg) => {
17 return computed([msg, thread.previousKey(msg)], (msg, previousId) => {
18 return api.message.html.render(msg, {previousId})
19 })
20 })
21 ])
22
23 container.sync = thread.sync
24 return container
25 })
26}
27

Built with git-ssb-web