git ssb

16+

Dominic / patchbay



Tree: 70fb8c8a016f2f59cb6933d6505c3d65dd426581

Files: 70fb8c8a016f2f59cb6933d6505c3d65dd426581 / router / html / page / channel.js

1045 bytesRaw
1const nest = require('depnest')
2const pull = require('pull-stream')
3const Scroller = require('pull-scroll')
4
5exports.gives = nest('router.html.page')
6
7exports.needs = nest({
8 'feed.pull.channel': 'first',
9 'main.html.scroller': 'first',
10 message: {
11 html: {
12 compose: 'first',
13 render: 'first'
14 }
15 // 'sync.unbox': 'first'
16 }
17})
18
19exports.create = function (api) {
20 return nest('router.html.page', channelView)
21
22 function channelView (path) {
23 if (path[0] !== '#') return
24
25 var channel = path.substr(1)
26
27 var composer = api.message.html.compose({ meta: { type: 'post', channel } })
28 var { container, content } = api.main.html.scroller({ prepend: composer })
29
30 var openChannelSource = api.feed.pull.channel(channel)
31
32 pull(
33 openChannelSource({old: false}),
34 Scroller(container, content, api.message.html.render, true, false)
35 )
36
37 pull(
38 openChannelSource({reverse: true}),
39 Scroller(container, content, api.message.html.render, false, false)
40 )
41
42 return container
43 }
44}
45
46

Built with git-ssb-web