git ssb

2+

mixmix / ticktack



Tree: 3f20b6a02893dcb23a3239a1e9623b8234222ba7

Files: 3f20b6a02893dcb23a3239a1e9623b8234222ba7 / app / html / app.js

1405 bytesRaw
1const nest = require('depnest')
2const values = require('lodash/values')
3const insertCss = require('insert-css')
4const openExternal = require('open-external')
5
6const HyperNav = require('hyper-nav')
7const computed = require('mutant/computed')
8const h = require('mutant/h')
9
10exports.gives = nest({
11 'app.html.app': true,
12 'history.obs.location': true,
13 'history.sync.push': true,
14 'history.sync.back': true,
15})
16
17exports.needs = nest({
18 'app.html.header': 'first',
19 'app.async.catchLinkClick': 'first',
20 'router.sync.router': 'first',
21 'styles.css': 'reduce',
22 'about.async.suggest': 'first',
23 'channel.async.suggest': 'first',
24})
25
26exports.create = (api) => {
27 var nav = null
28
29 return nest({
30 'app.html.app': function app () {
31
32 // DIRTY HACK - initializes the suggestion indexes
33 api.about.async.suggest()
34 api.channel.async.suggest()
35
36 const css = values(api.styles.css()).join('\n')
37 insertCss(css)
38
39 api.app.async.catchLinkClick(document.body, (link, { isExternal }) => {
40 if (isExternal) return openExternal(link)
41 nav.push(link)
42 })
43
44 nav = HyperNav(
45 api.router.sync.router,
46 api.app.html.header
47 )
48
49 nav.push({page: 'home'})
50 return nav
51 },
52 'history.sync.push': (location) => nav.push(location),
53 'history.sync.back': () => nav.back(),
54 'history.obs.location': () => nav.history,
55 })
56}
57
58
59
60

Built with git-ssb-web