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