git ssb

16+

Dominic / patchbay



Tree: 752e1d3cb8c1b68e0801e1e9b4d8d4715fcd8409

Files: 752e1d3cb8c1b68e0801e1e9b4d8d4715fcd8409 / app / page / settings.js

1116 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.html.scroller': 'first',
12 'app.sync.goTo': 'first'
13})
14
15exports.create = function (api) {
16 return nest({
17 'app.html.menuItem': menuItem,
18 'app.page.settings': settingsPage
19 })
20
21 function menuItem () {
22 return h('a', {
23 'ev-click': () => api.app.sync.goTo({ page: 'settings' })
24 }, '/settings')
25 }
26
27 function settingsPage (location) {
28 var page = 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 var { container } = api.app.html.scroller({ prepend: page })
43 container.title = '/settings'
44 return container
45 }
46}
47

Built with git-ssb-web