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