Files: a14de0c42524ef13660881841a76089bd36e3acf / modules / page / html / render / all.js
1170 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 | 'intl.sync.i18n': 'first', |
10 | }) |
11 | |
12 | exports.gives = nest({ |
13 | 'page.html.render': true |
14 | }) |
15 | |
16 | exports.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