git ssb

16+

Dominic / patchbay



Tree: 0b83856cdd663c07cc28d7f3f0f3a883b41881da

Files: 0b83856cdd663c07cc28d7f3f0f3a883b41881da / app / html / page / channel.js

1052 bytesRaw
1const nest = require('depnest')
2const pull = require('pull-stream')
3const Scroller = require('pull-scroll')
4
5exports.gives = nest('app.html.page')
6
7exports.needs = nest({
8 'feed.pull.channel': 'first',
9 'app.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('app.html.page', channelView)
21
22 function channelView (path) {
23 if (path && !path.match(/#[^\s]+/)) 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.app.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