git ssb

10+

Matt McKegg / patchwork



Tree: e5ad753b8414d998113f9305e0826f4cf1035fe4

Files: e5ad753b8414d998113f9305e0826f4cf1035fe4 / modules / page / html / render / all.js

1201 bytesRaw
1var nest = require('depnest')
2var { h } = require('mutant')
3var appRoot = require('app-root-path')
4var i18n = require(appRoot + '/lib/i18n').i18n
5
6exports.needs = nest({
7 'feed.pull.public': 'first',
8 'message.html.compose': 'first',
9 'message.async.publish': 'first',
10 'feed.html.rollup': 'first'
11})
12
13exports.gives = nest({
14 'page.html.render': true
15})
16
17exports.create = function (api) {
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