mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 00:21:31 +00:00
Hide tabs list when there's only a single tab
This commit is contained in:
parent
54cfb28bd6
commit
34487cb3da
4 changed files with 13 additions and 3 deletions
|
@ -100,12 +100,16 @@ export default defineComponent({
|
|||
},
|
||||
subtabs(): Record<string, Subtab> | null {
|
||||
if (layers[this.layer].subtabs) {
|
||||
return Object.entries(layers[this.layer].subtabs!)
|
||||
const subtabs = Object.entries(layers[this.layer].subtabs!)
|
||||
.filter(subtab => subtab[1].unlocked !== false)
|
||||
.reduce((acc: Record<string, Subtab>, curr: [string, Subtab]) => {
|
||||
acc[curr[0]] = curr[1];
|
||||
return acc;
|
||||
}, {});
|
||||
if (Object.keys(subtabs).length === 1 && !themes[settings.theme].showSingleTab) {
|
||||
return null;
|
||||
}
|
||||
return subtabs;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
|
|
@ -47,7 +47,7 @@ export default defineComponent({
|
|||
return layers[this.layer].microtabs![this.family];
|
||||
},
|
||||
microtabs() {
|
||||
return Object.keys(this.tabFamily.data)
|
||||
const microtabs = Object.keys(this.tabFamily.data)
|
||||
.filter(
|
||||
microtab =>
|
||||
microtab !== "activeMicrotab" &&
|
||||
|
@ -58,6 +58,10 @@ export default defineComponent({
|
|||
acc[curr] = this.tabFamily.data[curr];
|
||||
return acc;
|
||||
}, {});
|
||||
if (Object.keys(microtabs).length === 1 && !themes[settings.theme].showSingleTab) {
|
||||
return null;
|
||||
}
|
||||
return microtabs;
|
||||
},
|
||||
activeMicrotab() {
|
||||
return this.id != undefined
|
||||
|
|
|
@ -23,7 +23,8 @@ const defaultTheme: Theme = {
|
|||
"--feature-margin": "0px"
|
||||
},
|
||||
stackedInfoboxes: false,
|
||||
floatingTabs: true
|
||||
floatingTabs: true,
|
||||
showSingleTab: false
|
||||
};
|
||||
|
||||
export enum Themes {
|
||||
|
|
1
src/typings/theme.d.ts
vendored
1
src/typings/theme.d.ts
vendored
|
@ -21,4 +21,5 @@ export interface Theme {
|
|||
};
|
||||
stackedInfoboxes: boolean;
|
||||
floatingTabs: boolean;
|
||||
showSingleTab: boolean;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue