Files: 99c86638a3a20ff67360d97a50140dc59796f610 / app / html / settings / default-tabs.js
1063 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, computed } = require('mutant') |
3 | |
4 | exports.gives = nest({ |
5 | 'app.html.settings': true |
6 | }) |
7 | |
8 | exports.needs = nest({ |
9 | 'app.html.settings': 'map', |
10 | 'settings.obs.get': 'first', |
11 | 'settings.sync.set': 'first' |
12 | }) |
13 | |
14 | exports.create = function (api) { |
15 | return nest({ |
16 | 'app.html.settings': defaultTabs |
17 | }) |
18 | |
19 | function defaultTabs () { |
20 | const defaultTabs = api.settings.obs.get('patchbay.defaultTabs', '') |
21 | const setDefaultTabs = (ev) => { |
22 | const tabs = ev.target.value.split(',').map(s => s.trim()).filter(Boolean) |
23 | api.settings.sync.set({patchbay: {defaultTabs: tabs}}) |
24 | } |
25 | |
26 | return { |
27 | title: 'Default Tabs', |
28 | body: h('DefaultTabs', [ |
29 | h('p', 'Comma-seperated list of tabs which will open on startup.'), |
30 | h('p', [ |
31 | h('i', 'e.g. /public, #new-people, %9psz2xPwGhGG7mIkTIgCEy/xX7r6uQDNQyjl0Nopiw4=.sha256') |
32 | ]), |
33 | h('input', { |
34 | value: computed(defaultTabs, tabs => tabs.join(', ')), |
35 | 'ev-input': setDefaultTabs |
36 | }) |
37 | ]) |
38 | } |
39 | } |
40 | } |
41 | |
42 |
Built with git-ssb-web