git ssb

16+

Dominic / patchbay



Tree: 0a1c7842563bee8ca52221c858cfe7309da160da

Files: 0a1c7842563bee8ca52221c858cfe7309da160da / router / html / page / public.js

1083 bytesRaw
1const { h } = require('mutant')
2const nest = require('depnest')
3const pull = require('pull-stream')
4const Scroller = require('pull-scroll')
5const next = require('../../../junk/next-stepper')
6
7exports.gives = nest('router.html.page')
8
9exports.needs = nest({
10 'feed.pull.public': 'first',
11 'message.html': {
12 compose: 'first',
13 render: 'first',
14 },
15 'main.html.scroller': 'first'
16})
17
18exports.create = function (api) {
19 return nest('router.html.page', publicPage)
20
21 function publicPage (path) {
22 if (path !== '/public') return
23
24 const composer = api.message.html.compose({ meta: { type: 'post' }, placeholder: 'Write a public message'})
25 const { container, content } = api.main.html.scroller({ prepend: composer })
26
27 pull(
28 next(api.feed.pull.public, {old: false, limit: 100}),
29 Scroller(container, content, api.message.html.render, true, false)
30 )
31
32 pull(
33 next(api.feed.pull.public, {reverse: true, limit: 100, live: false}),
34 Scroller(container, content, api.message.html.render, false, false)
35 )
36
37 return container
38 }
39}
40
41

Built with git-ssb-web