use profiles for everything

This commit is contained in:
Eugene Pankov
2019-05-11 21:28:04 +02:00
parent bc71547d92
commit 48ff7d7d5a
26 changed files with 159 additions and 101 deletions

View File

@@ -23,7 +23,12 @@ export interface IToolbarButton {
weight?: number
click: () => void
click?: () => void
submenu?: () => Promise<IToolbarButton[]>
/** @hidden */
submenuItems?: IToolbarButton[]
}
/**

View File

@@ -32,22 +32,44 @@ title-bar(
)
.btn-group.background
button.btn.btn-secondary.btn-tab-bar(
*ngFor='let button of leftToolbarButtons',
[title]='button.title',
(click)='button.click()',
[innerHTML]='button.icon',
.d-flex(
*ngFor='let button of leftToolbarButtons',
ngbDropdown,
(openChange)='generateButtonSubmenu(button)',
)
button.btn.btn-secondary.btn-tab-bar(
[title]='button.title',
(click)='button.click && button.click()',
[innerHTML]='button.icon',
ngbDropdownToggle,
)
div(*ngIf='button.submenu', ngbDropdownMenu)
button.dropdown-item(
*ngFor='let item of button.submenuItems',
(click)='item.click()',
ngbDropdownItem,
) {{item.title}}
.drag-space.background([class.persistent]='config.store.appearance.frame == "thin" && hostApp.platform != Platform.macOS')
.btn-group.background
button.btn.btn-secondary.btn-tab-bar(
*ngFor='let button of rightToolbarButtons',
[title]='button.title',
(click)='button.click()',
[innerHTML]='button.icon',
.d-flex(
*ngFor='let button of rightToolbarButtons',
ngbDropdown,
(openChange)='generateButtonSubmenu(button)',
)
button.btn.btn-secondary.btn-tab-bar(
[title]='button.title',
(click)='button.click && button.click()',
[innerHTML]='button.icon',
ngbDropdownToggle,
)
div(*ngIf='button.submenu', ngbDropdownMenu)
button.dropdown-item(
*ngFor='let item of button.submenuItems',
(click)='item.click()',
ngbDropdownItem,
) {{item.title}}
button.btn.btn-secondary.btn-tab-bar.btn-update(
*ngIf='updatesAvailable',

View File

@@ -233,6 +233,12 @@ export class AppRootComponent {
})
}
async generateButtonSubmenu (button: IToolbarButton) {
if (button.submenu) {
button.submenuItems = await button.submenu()
}
}
private getToolbarButtons (aboveZero: boolean): IToolbarButton[] {
let buttons: IToolbarButton[] = []
this.config.enabledServices(this.toolbarButtonProviders).forEach(provider => {

View File

@@ -23,6 +23,7 @@ export class StartPageComponent {
return this.config.enabledServices(this.toolbarButtonProviders)
.map(provider => provider.provide())
.reduce((a, b) => a.concat(b))
.filter(x => !!x.click)
.sort((a: IToolbarButton, b: IToolbarButton) => (a.weight || 0) - (b.weight || 0))
}
}

View File

@@ -65,6 +65,7 @@ export class TouchbarService {
this.config.enabledServices(this.toolbarButtonProviders).forEach(provider => {
buttons = buttons.concat(provider.provide())
})
buttons = buttons.filter(x => !!x.touchBarNSImage)
buttons.sort((a, b) => (a.weight || 0) - (b.weight || 0))
this.tabSegments = this.app.tabs.map(tab => ({
label: this.shortenTitle(tab.title),

View File

@@ -136,6 +136,10 @@ app-root {
background: transparent;
&:hover { background: rgba(0, 0, 0, .25) !important; }
&:active { background: rgba(0, 0, 0, .5) !important; }
&::after {
display: none;
}
}
&>.tabs {