git ssb

16+

Dominic / patchbay



Commit e947432e1cdeccc80641fc333eed1e6190fb0238

change tabs initialisation to allow more customisation

mixmix committed on 11/6/2018, 9:02:34 PM
Parent: 9132118089771e8d960b2590aece46b1b7f121a7

Files changed

app/html/app.jschanged
app/html/tabs.jschanged
app/html/tabs.mcsschanged
app/html/app.jsView
@@ -16,15 +16,16 @@
1616
1717 exports.create = function (api) {
1818 return nest('app.html.app', app)
1919
20- function app () {
20 + function app (initialTabs) {
2121 console.log('STARTING app')
2222
2323 window = api.app.sync.window(window) // eslint-disable-line no-global-assign
2424
25- const initialTabs = api.settings.sync.get('patchbay.defaultTabs')
26- const App = h('App', api.app.html.tabs(initialTabs))
25 + const App = h('App', api.app.html.tabs({
26 + initial: initialTabs || api.settings.sync.get('patchbay.defaultTabs')
27 + }))
2728
2829 api.app.sync.initialise(App)
2930 // runs all the functions in app/sync/initialise
3031
app/html/tabs.jsView
@@ -21,9 +21,9 @@
2121 return nest({
2222 'app.html.tabs': tabs
2323 })
2424
25- function tabs (initialTabs = []) {
25 + function tabs ({ initial = [], prepend, append } = {}) {
2626 if (_tabs) return _tabs
2727
2828 const onSelect = (indexes) => {
2929 const { id } = _tabs.get(indexes[0]).content
@@ -46,14 +46,11 @@
4646 }
4747
4848 const search = api.app.html.searchBar()
4949 const menu = api.app.html.menu()
50 + if (append === undefined) append = h('div.navExtra', [ search, menu ])
5051
51- _tabs = Tabs({
52- onSelect,
53- onClose,
54- append: h('div.navExtra', [ search, menu ])
55- })
52 + _tabs = Tabs({ onSelect, onClose, prepend, append })
5653 _tabs.currentPage = () => {
5754 const currentPage = _tabs.get(_tabs.selected[0])
5855 return currentPage && currentPage.firstChild
5956 }
@@ -61,10 +58,10 @@
6158 _tabs.previousTab = () => _tabs.currentPage() && _tabs.selectRelative(-1)
6259 _tabs.closeCurrentTab = () => { _tabs.currentPage() && _tabs.remove(_tabs.selected[0]) }
6360
6461 // # TODO: review - this works but is strange
65- initialTabs.forEach(p => api.app.sync.goTo(p))
66- if (initialTabs[0]) api.app.sync.goTo(initialTabs[0])
62 + initial.forEach(p => api.app.sync.goTo(p))
63 + if (initial[0]) api.app.sync.goTo(initial[0])
6764 return _tabs
6865 }
6966 }
7067
app/html/tabs.mcssView
@@ -1,4 +1,7 @@
1 +/* TODO depricate this carefully (see styles/mcss/hypertabs.mcss) */
2 +/* NOTE there are some active styles in here still */
3 +
14 Hypertabs {
25 position: fixed
36 top: 0
47 right: 0
@@ -37,24 +40,15 @@
3740 margin-left: .6rem
3841 border: 1px gainsboro solid
3942 border-bottom: none
4043
41- :hover {
42- a.close {
43- visibility: visible
44- }
45- }
46-
4744 -selected {
4845 color: #222
4946 $backgroundPrimary
5047
5148 a.link {
5249 max-width: calc(100% - 2rem)
5350 }
54- a.close {
55- visibility: visible
56- }
5751 }
5852
5953 -notify {
6054 background-color: orange;
@@ -81,28 +75,8 @@
8175
8276 padding: .5rem 0 .5rem .6rem
8377 }
8478
85- a.close {
86- visibility: hidden
87- font-family: monospace
88- line-height: 1rem
89- width: .9rem
90- height: .9rem
91- /* border-radius: 1rem */
92-
93- margin-right: .3rem
94-
95- display: flex
96- justify-content: center
97-
98- :hover {
99- background: #aaaaaa
100- color: #fff
101- font-weight: 600
102- }
103- }
104-
10579 }
10680
10781 }
10882

Built with git-ssb-web