git ssb

16+

Dominic / patchbay



Tree: f9ed3f55694d0c49e226ff35109f51551e11e45c

Files: f9ed3f55694d0c49e226ff35109f51551e11e45c / app / html / page / gatherings.js

1116 bytesRaw
1const nest = require('depnest')
2const pull = require('pull-stream')
3const { h, Array } = require('mutant')
4
5exports.gives = nest({
6 'app.html': {
7 page: true,
8 menuItem: true
9 }
10})
11
12exports.needs = nest({
13 'app.html.scroller': 'first',
14 'gathering.html': {
15 create: 'first',
16 render: 'first'
17 },
18 'gathering.pull.find': 'first'
19})
20
21exports.create = function (api) {
22 const route = '/gatherings'
23 return nest({
24 'app.html': {
25 menuItem: menuItem,
26 page: gatheringsPage
27 }
28 })
29
30 function menuItem (handleClick) {
31 return h('a', {
32 style: { order: 0 },
33 'ev-click': () => handleClick(route)
34 }, route)
35 }
36
37 function gatheringsPage (path) {
38 if (path !== route) return
39
40 const creator = api.gathering.html.create({})
41 const gatherings = Array([])
42 const content = h('section.content', {}, gatherings)
43 const { container } = api.app.html.scroller({content, prepend: [creator]})
44
45 pull(
46 api.gathering.pull.find(),
47 pull.drain(msg => {
48 gatherings.push(api.gathering.html.render(msg))
49 })
50 )
51
52 return container
53 }
54}
55
56
57

Built with git-ssb-web