git ssb


1+

mix / picknmix



Commit 70fb8c8a016f2f59cb6933d6505c3d65dd426581

add channel view

mix irving committed on 3/19/2017, 11:02:41 PM
Parent: 879b5816387bec7a20dde4e29e4a3955f212af41

Files changed

router/html/page/thread.jschanged
router/html/page/channel.jsadded
router/html/page/thread.jsView
@@ -5,8 +5,9 @@
55 const ref = require('ssb-ref')
66
77 exports.gives = nest('router.html.page')
88
9+// TODO - seperate out public and private thread rendering
910 exports.needs = nest({
1011 // 'feed.pull.public': 'first',
1112 'keys.sync.id': 'first',
1213 'main.html.scroller': 'first',
router/html/page/channel.jsView
@@ -1,0 +1,45 @@
1+const nest = require('depnest')
2+const pull = require('pull-stream')
3+const Scroller = require('pull-scroll')
4+
5+exports.gives = nest('router.html.page')
6+
7+exports.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+
19+exports.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+

Built with git-ssb-web