Files: 6791a012f6f25d8aeb64cae36c5f8ff3b21e9132 / app / html / settings / default-tabs.js
1090 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 | group: 'general', |
28 | title: 'Default Tabs', |
29 | body: h('DefaultTabs', [ |
30 | h('p', 'Comma-seperated list of tabs which will open on startup.'), |
31 | h('p', [ |
32 | h('i', 'e.g. /public, #new-people, %9psz2xPwGhGG7mIkTIgCEy/xX7r6uQDNQyjl0Nopiw4=.sha256') |
33 | ]), |
34 | h('input', { |
35 | value: computed(defaultTabs, tabs => tabs.join(', ')), |
36 | 'ev-input': setDefaultTabs |
37 | }) |
38 | ]) |
39 | } |
40 | } |
41 | } |
42 |
Built with git-ssb-web