From c632c3db0d0b8f956aad8f3f6b8e3a433272ce3b Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 25 Jun 2021 09:31:09 -0400 Subject: [PATCH] Use the default hotbar as the hotbar for the default workspace Signed-off-by: Sebastian Malton --- src/migrations/hotbar-store/5.0.0-beta.10.ts | 12 ++++++++++++ src/renderer/theme.store.ts | 18 ++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/migrations/hotbar-store/5.0.0-beta.10.ts b/src/migrations/hotbar-store/5.0.0-beta.10.ts index dd94db34a5..1586f5c700 100644 --- a/src/migrations/hotbar-store/5.0.0-beta.10.ts +++ b/src/migrations/hotbar-store/5.0.0-beta.10.ts @@ -56,6 +56,18 @@ export default { }); } + { + // grab the default named hotbar or the first. + const defaultHotbarIndex = Math.max(0, hotbars.findIndex(hotbar => hotbar.name === "default")); + const [{ name, id, items }] = hotbars.splice(defaultHotbarIndex, 1); + + workspaceHotbars.set("default", { + name, + id, + items: items.filter(Boolean), + }); + } + for (const cluster of clusters) { const workspaceHotbar = workspaceHotbars.get(cluster.workspace); diff --git a/src/renderer/theme.store.ts b/src/renderer/theme.store.ts index 8d8e7cba28..6caf9cf78a 100644 --- a/src/renderer/theme.store.ts +++ b/src/renderer/theme.store.ts @@ -23,8 +23,8 @@ import { computed, observable, reaction, makeObservable } from "mobx"; import { autoBind, iter, Singleton } from "./utils"; import { UserStore } from "../common/user-store"; import logger from "../main/logger"; -import darkThemeBase from "./themes/lens-dark.json"; -import lightThemeBase from "./themes/lens-light.json"; +import darkTheme from "./themes/lens-dark.json"; +import lightTheme from "./themes/lens-light.json"; export type ThemeId = string; @@ -41,16 +41,6 @@ export interface Theme { author: string; } -const darkTheme: Theme = { - ...darkThemeBase, - type: darkThemeBase.type as ThemeType, -}; - -const lightTheme: Theme = { - ...lightThemeBase, - type: lightThemeBase.type as ThemeType, -}; - export interface ThemeItems extends Theme { id: string; } @@ -60,8 +50,8 @@ export class ThemeStore extends Singleton { // bundled themes from `themes/${themeId}.json` private allThemes = observable.map([ - ["lens-dark", darkTheme], - ["lens-light", lightTheme], + ["lens-dark", { ...darkTheme, type: ThemeType.DARK }], + ["lens-light", { ...lightTheme, type: ThemeType.LIGHT }], ]); @computed get themes(): ThemeItems[] {