Files: 0e7c0899affc876a69d822ae746c7c358f8c2906 / modules / page / html / render / all.js
1088 bytesRaw
1 | var nest = require('depnest') |
2 | var { h } = require('mutant') |
3 | |
4 | exports.needs = nest({ |
5 | 'feed.pull.public': 'first', |
6 | 'message.html.compose': 'first', |
7 | 'message.async.publish': 'first', |
8 | 'feed.html.rollup': 'first' |
9 | }) |
10 | |
11 | exports.gives = nest({ |
12 | 'page.html.render': true |
13 | }) |
14 | |
15 | exports.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