git ssb

10+

Matt McKegg / patchwork



Tree: 1a1dfa987b784a002e626f97e18aeaf2164d1299

Files: 1a1dfa987b784a002e626f97e18aeaf2164d1299 / modules / page / html / render / all.js

1088 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})
10
11exports.gives = nest({
12 'page.html.render': true
13})
14
15exports.create = function (api) {
16 return nest('page.html.render', page)
17
18 function page (path) {
19 if (path !== '/all') return // "/" is a sigil for "page"
20
21 var prepend = [
22 h('PageHeading', [
23 h('h1', [
24 'All Posts from Your ',
25 h('strong', 'Extended Network')
26 ])
27 ]),
28 api.message.html.compose({ meta: { type: 'post' }, placeholder: 'Write a public message' })
29 ]
30
31 var feedView = api.feed.html.rollup(api.feed.pull.public, {
32 bumpFilter: (msg) => {
33 return msg.value.content && typeof msg.value.content === 'object'
34 },
35 prepend
36 })
37
38 var result = h('div.SplitView', [
39 h('div.main', feedView)
40 ])
41
42 result.pendingUpdates = feedView.pendingUpdates
43 result.reload = feedView.reload
44
45 return result
46 }
47}
48

Built with git-ssb-web