Files: 7d39f00f5d8cc46d121b4197b45fa1dc145ec3da / modules / page / html / render / gatherings.js
935 bytesRaw
1 | var { h } = require('mutant') |
2 | var nest = require('depnest') |
3 | |
4 | exports.needs = nest({ |
5 | 'feed.pull.type': 'first', |
6 | 'feed.html.rollup': 'first', |
7 | 'feed.pull.public': 'first', |
8 | 'gathering.sheet.edit': 'first' |
9 | }) |
10 | |
11 | exports.gives = nest('page.html.render') |
12 | |
13 | exports.create = function (api) { |
14 | return nest('page.html.render', function channel (path) { |
15 | if (path !== '/gatherings') return |
16 | |
17 | var prepend = [ |
18 | h('PageHeading', [ |
19 | h('h1', [h('strong', 'Gatherings'), ' from your extended network']), |
20 | h('div.meta', [ |
21 | h('button -add', { |
22 | 'ev-click': createGathering |
23 | }, '+ Add Gathering') |
24 | ]) |
25 | ]) |
26 | ] |
27 | |
28 | return api.feed.html.rollup(api.feed.pull.type('gathering'), { |
29 | prepend, |
30 | rootFilter: (msg) => msg.value.content.type === 'gathering', |
31 | updateStream: api.feed.pull.public |
32 | }) |
33 | }) |
34 | |
35 | function createGathering () { |
36 | api.gathering.sheet.edit() |
37 | } |
38 | } |
39 |
Built with git-ssb-web