modules/page/html/render/settings.jsView |
---|
17 | 17 | return nest('page.html.render', function channel (path) { |
18 | 18 | if (path !== '/settings') return |
19 | 19 | const i18n = api.intl.sync.i18n |
20 | 20 | |
21 | | - const currentTheme = api.settings.obs.get('patchwork.theme') |
22 | | - const currentLang = api.settings.obs.get('patchwork.lang') |
23 | 21 | const locales = api.intl.sync.locales() |
24 | 22 | const localeNameLookup = api.intl.sync.localeNames() |
25 | | - const currentFontSize = api.settings.obs.get('patchwork.fontSize') |
26 | 23 | const fontSizes = ['8px', '10px', '12px', '14px', '16px', '18px', '20px'] |
| 24 | + |
| 25 | + const theme = api.settings.obs.get('patchwork.theme', 'light') |
| 26 | + const lang = api.settings.obs.get('patchwork.lang', '') |
| 27 | + const fontSize = api.settings.obs.get('patchwork.fontSize', '') |
27 | 28 | const filterFollowing = api.settings.obs.get('filters.following') |
| 29 | + const onlySubscribed = api.settings.obs.get('filters.onlySubscribed') |
28 | 30 | |
29 | 31 | var prepend = [ |
30 | 32 | h('PageHeading', [ |
31 | 33 | h('h1', [ |
41 | 43 | |
42 | 44 | h('section', [ |
43 | 45 | h('h2', i18n('Theme')), |
44 | 46 | h('select', { |
45 | | - style: { |
46 | | - 'font-size': '120%' |
47 | | - }, |
48 | | - value: when(currentTheme, currentTheme, 'light'), |
49 | | - 'ev-change': (ev) => api.settings.sync.set({ |
50 | | - patchwork: {theme: ev.target.value} |
51 | | - }) |
| 47 | + style: { 'font-size': '120%' }, |
| 48 | + value: theme, |
| 49 | + 'ev-change': (ev) => theme.set(ev.target.value) |
52 | 50 | }, [ |
53 | 51 | themeNames.map(name => h('option', {value: name}, [name])) |
54 | 52 | ]) |
55 | 53 | ]), |
56 | 54 | |
57 | 55 | h('section', [ |
58 | 56 | h('h2', i18n('Language')), |
59 | 57 | h('select', { |
60 | | - style: { |
61 | | - 'font-size': '120%' |
62 | | - }, |
63 | | - value: when(currentLang, currentLang, 'en'), |
64 | | - 'ev-change': (ev) => api.settings.sync.set({ |
65 | | - patchwork: {lang: ev.target.value} |
66 | | - }) |
| 58 | + style: { 'font-size': '120%' }, |
| 59 | + value: lang, |
| 60 | + 'ev-change': (ev) => lang.set(ev.target.value) |
67 | 61 | }, [ |
| 62 | + h('option', {value: ''}, i18n('Default')), |
68 | 63 | locales.map(code => h('option', {value: code}, [ |
69 | 64 | '[', code, '] ', getLocaleName(code) |
70 | 65 | ])) |
71 | 66 | ]) |
73 | 68 | |
74 | 69 | h('section', [ |
75 | 70 | h('h2', i18n('Font Size')), |
76 | 71 | h('select', { |
77 | | - style: { |
78 | | - 'font-size': '120%' |
79 | | - }, |
80 | | - value: when(currentFontSize, currentFontSize, ''), |
81 | | - 'ev-change': (ev) => api.settings.sync.set({ |
82 | | - patchwork: {fontSize: ev.target.value} |
83 | | - }) |
| 72 | + style: { 'font-size': '120%' }, |
| 73 | + value: fontSize, |
| 74 | + 'ev-change': (ev) => fontSize.set(ev.target.value) |
84 | 75 | }, [ |
85 | | - h('option', {value: ''}, 'Default'), |
| 76 | + h('option', {value: ''}, i18n('Default')), |
86 | 77 | fontSizes.map(size => h('option', {value: size}, size)) |
87 | 78 | ]) |
88 | 79 | ]), |
89 | 80 | |
90 | 81 | h('section', [ |
91 | | - h('h2', i18n('Filters')), |
92 | | - h('label', [ |
93 | | - h('input', { |
94 | | - type: 'checkbox', |
95 | | - checked: filterFollowing, |
96 | | - 'ev-change': (ev) => api.settings.sync.set({ |
97 | | - filters: {following: ev.target.checked} |
98 | | - }) |
99 | | - }), i18n(' Hide following messages') |
| 82 | + h('h2', i18n('Public Feed Options')), |
| 83 | + h('div', [ |
| 84 | + h('label', [ |
| 85 | + h('input', { |
| 86 | + type: 'checkbox', |
| 87 | + checked: filterFollowing, |
| 88 | + 'ev-change': (ev) => filterFollowing.set(ev.target.checked) |
| 89 | + }), i18n(' Hide following messages') |
| 90 | + ]) |
100 | 91 | ]) |
101 | 92 | ]) |
102 | 93 | ]) |
103 | 94 | ]) |