Files: d6637ae89d381d174f5c5aac3dafebebe079c33a / router / html / page / public.js
1039 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.compose': 'first', |
13 | 'message.html.render': 'first', |
14 | 'main.html.scroller': 'first' |
15 | }) |
16 | |
17 | exports.create = function (api) { |
18 | return nest('router.html.page', (path) => { |
19 | if (path !== '/public') return |
20 | |
21 | const composer = api.message.html.compose({ meta: { type: 'post' }, placeholder: 'Write a public message'}) |
22 | var { container, content } = api.main.html.scroller({ prepend: composer }) |
23 | |
24 | pull( |
25 | next(api.sbot.pull.log, {old: false, limit: 100}), |
26 | Scroller(container, content, api.message.html.render, true, false) |
27 | ) |
28 | |
29 | pull( |
30 | next(api.sbot.pull.log, {reverse: true, limit: 100, live: false}), |
31 | Scroller(container, content, api.message.html.render, false, false) |
32 | ) |
33 | |
34 | return container |
35 | }) |
36 | } |
37 | |
38 |
Built with git-ssb-web