git ssb

10+

Matt McKegg / patchwork



Tree: 105aa7594db658635444cb37cc121c3952b8216b

Files: 105aa7594db658635444cb37cc121c3952b8216b / modules / page / html / render / settings.js

1680 bytesRaw
1var { h, computed } = require('mutant')
2var nest = require('depnest')
3
4var themeNames = Object.keys(require('../../../../styles'))
5
6exports.needs = nest({
7 'settings.obs.get': 'first',
8 'settings.sync.set': 'first',
9})
10
11exports.gives = nest('page.html.render')
12
13exports.create = function (api) {
14 return nest('page.html.render', function channel (path) {
15 if (path !== '/settings') return
16
17 const currentTheme = api.settings.obs.get('patchwork.theme')
18 const filterFollowing = api.settings.obs.get('filters.following')
19
20 var prepend = [
21 h('PageHeading', [
22 h('h1', [
23 h('strong', 'Settings')
24 ])
25 ])
26 ]
27
28 return h('Scroller', { style: { overflow: 'auto' } }, [
29 h('div.wrapper', [
30 h('section.prepend', prepend),
31 h('section.content', [
32 h('section', [
33 h('h2', 'Theme'),
34 h('select', {
35 style: {
36 'font-size': '120%'
37 },
38 value: currentTheme,
39 'ev-change': (ev) => api.settings.sync.set({
40 patchwork: {theme: ev.target.value}
41 })
42 }, [
43 themeNames.map(name => h('option', {value: name}, [name]))
44 ])
45 ]),
46 h('section', [
47 h('h2', 'Filters'),
48 h('label', [
49 h('input', {
50 type: 'checkbox',
51 checked: filterFollowing,
52 'ev-change': (ev) => api.settings.sync.set({
53 filters: {following: ev.target.checked}
54 })
55 }), ' Hide following messages'
56 ])
57 ])
58 ])
59 ])
60 ])
61 })
62}
63

Built with git-ssb-web