git ssb

16+

Dominic / patchbay



Tree: 99c86638a3a20ff67360d97a50140dc59796f610

Files: 99c86638a3a20ff67360d97a50140dc59796f610 / app / page / settings.js

982 bytesRaw
1const nest = require('depnest')
2const { h } = require('mutant')
3
4exports.gives = nest({
5 'app.html.menuItem': true,
6 'app.page.settings': true
7})
8
9exports.needs = nest({
10 'app.html.settings': 'map',
11 'app.sync.goTo': 'first'
12})
13
14exports.create = function (api) {
15 return nest({
16 'app.html.menuItem': menuItem,
17 'app.page.settings': publicPage
18 })
19
20 function menuItem () {
21 return h('a', {
22 style: { order: 1 },
23 'ev-click': () => api.app.sync.goTo({ page: 'settings' })
24 }, '/settings')
25 }
26
27 function publicPage (location) {
28 return h('SettingsPage', { title: '/settings' }, [
29 h('div.container', [
30 h('h1', 'Settings'),
31 api.app.html.settings().map(setting => {
32 if (!setting.title && !setting.body) throw new Error('app.html.settings requires settings in form { title, body }')
33
34 return h('section', [
35 h('h2', setting.title),
36 setting.body
37 ])
38 })
39 ])
40 ])
41 }
42}
43

Built with git-ssb-web