git ssb

16+

Dominic / patchbay



Tree: b755e93b29216ff4f3cc1b14472292cca8524023

Files: b755e93b29216ff4f3cc1b14472292cca8524023 / app / page / settings.js

1152 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 style: { order: 1 },
24 'ev-click': () => api.app.sync.goTo({ page: 'settings' })
25 }, '/settings')
26 }
27
28
29 function settingsPage (location) {
30 var page = h('SettingsPage', { title: '/settings' }, [
31 h('div.container', [
32 h('h1', 'Settings'),
33 api.app.html.settings().map(setting => {
34 if (!setting.title && !setting.body) throw new Error('app.html.settings requires settings in form { title, body }')
35
36 return h('section', [
37 h('h2', setting.title),
38 setting.body
39 ])
40 })
41 ])
42 ])
43
44 var { container, content } = api.app.html.scroller({ prepend: page })
45 container.title = 'Settings'
46 return container
47 }
48}
49

Built with git-ssb-web