git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Tree: 9cb6a53289e695dec730708c30a8a917e6269c7d

Files: 9cb6a53289e695dec730708c30a8a917e6269c7d / modules / page / html / render / all.js

1170 bytesRaw
1var nest = require('depnest')
2var { h } = require('mutant')
3
4exports.needs = nest({
5 'feed.pull.public': 'first',
6 'message.html.compose': 'first',
7 'message.async.publish': 'first',
8 'feed.html.rollup': 'first',
9 'intl.sync.i18n': 'first',
10})
11
12exports.gives = nest({
13 'page.html.render': true
14})
15
16exports.create = function (api) {
17 const i18n = api.intl.sync.i18n
18 return nest('page.html.render', page)
19
20 function page (path) {
21 if (path !== '/all') return // "/" is a sigil for "page"
22
23 var prepend = [
24 h('PageHeading', [
25 h('h1', [
26 i18n('All Posts from Your '),
27 h('strong', i18n('Extended Network'))
28 ])
29 ]),
30 api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') })
31 ]
32
33 var feedView = api.feed.html.rollup(api.feed.pull.public, {
34 bumpFilter: (msg) => {
35 return msg.value.content && typeof msg.value.content === 'object'
36 },
37 prepend
38 })
39
40 var result = h('div.SplitView', [
41 h('div.main', feedView)
42 ])
43
44 result.pendingUpdates = feedView.pendingUpdates
45 result.reload = feedView.reload
46
47 return result
48 }
49}
50

Built with git-ssb-web