git ssb

10+

Matt McKegg / patchwork



Tree: 7d39f00f5d8cc46d121b4197b45fa1dc145ec3da

Files: 7d39f00f5d8cc46d121b4197b45fa1dc145ec3da / modules / page / html / render / gatherings.js

935 bytesRaw
1var { h } = require('mutant')
2var nest = require('depnest')
3
4exports.needs = nest({
5 'feed.pull.type': 'first',
6 'feed.html.rollup': 'first',
7 'feed.pull.public': 'first',
8 'gathering.sheet.edit': 'first'
9})
10
11exports.gives = nest('page.html.render')
12
13exports.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