git ssb

2+

mixmix / ticktack



Tree: 0e65bf76f75d4874321e893134b730597473287e

Files: 0e65bf76f75d4874321e893134b730597473287e / app / html / context.js

1221 bytesRaw
1const nest = require('depnest')
2const { h, computed, map, when } = require('mutant')
3
4exports.gives = nest('app.html.context')
5
6exports.needs = nest({
7 'app.html.link': 'first',
8 'translations.sync.strings': 'first',
9})
10
11
12exports.create = (api) => {
13 return nest('app.html.context', (location) => {
14
15 const strings = api.translations.sync.strings()
16
17 const discover = {
18 notification: 1,
19 imageEl: h('i.fa.fa-binoculars'),
20 name: strings.blogIndex.title,
21 location: { page: 'blogIndex' },
22 selected: location.page === 'blogIndex' // TODO could be a whole host of pages
23 }
24
25 const nearby = []
26 const friendsWithThreads = []
27
28 return h('Context -feed', [
29 h('div.level.-one', [
30 Option(discover),
31 map(nearby, Option), // TODO
32 map(friendsWithThreads, Option) // TODO
33 ]),
34 // h('div.level.-two'),
35 ])
36
37
38 function Option ({ notification = 0, imageEl, name, location, selected }) {
39 return h('Option', { className: selected ? '-selected' : '' }, [
40 h('div.circle', [
41 when(notification, h('div.alert', notification)),
42 imageEl
43 ]),
44 api.app.html.link(location, name),
45 ])
46 }
47 })
48}
49
50

Built with git-ssb-web