Files: f01fdc011b9037c0f0d87cd475be572525c78658 / modules / page / html / render / all.js
1306 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 | 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