git ssb

10+

Matt McKegg / patchwork



Tree: cb2fe7f291c2e306b048baa43701f98700236eca

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

1306 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 if (msg.value.content) {
36 // filter out likes
37 if (msg.value.content.type === 'vote') return false
38 return msg.value.content && typeof msg.value.content === 'object'
39 }
40 },
41 prepend
42 })
43
44 var result = h('div.SplitView', [
45 h('div.main', feedView)
46 ])
47
48 result.pendingUpdates = feedView.pendingUpdates
49 result.reload = feedView.reload
50
51 return result
52 }
53}
54

Built with git-ssb-web