git ssb

1+

Daan Patchwork / patchwork



Tree: 3451510316992d414ec76ba5b29681fe359b7428

Files: 3451510316992d414ec76ba5b29681fe359b7428 / lib / depject / page / html / render / gatherings.js

1104 bytesRaw
1const { h } = require('mutant')
2const nest = require('depnest')
3
4exports.needs = nest({
5 'feed.html.rollup': 'first',
6 'sbot.pull.resumeStream': 'first',
7 'sbot.pull.stream': 'first',
8 'gathering.sheet.edit': 'first',
9 'intl.sync.i18n': 'first'
10})
11
12exports.gives = nest('page.html.render')
13
14exports.create = function (api) {
15 const i18n = api.intl.sync.i18n
16 return nest('page.html.render', function channel (path) {
17 if (path !== '/gatherings') return
18
19 const prepend = [
20 h('PageHeading', [
21 h('h1', [h('strong', i18n('Gatherings'))]),
22 h('div.meta', [
23 h('button -add', {
24 'ev-click': createGathering
25 }, i18n('+ Add Gathering'))
26 ])
27 ])
28 ]
29
30 const getStream = api.sbot.pull.resumeStream((sbot, opts) => {
31 return sbot.patchwork.gatherings.roots(opts)
32 }, { limit: 40, reverse: true })
33
34 return api.feed.html.rollup(getStream, {
35 prepend,
36 updateStream: api.sbot.pull.stream(sbot => sbot.patchwork.gatherings.latest())
37 })
38 })
39
40 function createGathering () {
41 api.gathering.sheet.edit()
42 }
43}
44

Built with git-ssb-web