From ab0f81824d040f4848d5bb17fd1b46f8ecd2f425 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 24 Oct 2024 09:35:55 +0100 Subject: [PATCH] Update to use new shared-core location for theme utils --- .../commandPalette/CommandPalette.svelte | 7 ++++--- .../components/integration/QueryEditor.svelte | 3 ++- .../src/components/settings/ThemeModal.svelte | 4 ++-- .../_components/Screen/AppThemeSelect.svelte | 12 ++++++------ .../builder/portal/apps/[appId]/index.svelte | 7 ++----- packages/builder/src/stores/builder/theme.js | 11 +++-------- packages/builder/src/stores/portal/theme.js | 19 ++++++++++--------- .../client/src/components/ClientApp.svelte | 7 ++----- packages/client/src/stores/theme.js | 5 ++--- packages/frontend-core/src/utils/index.js | 1 - packages/shared-core/src/constants/index.ts | 1 + packages/shared-core/src/constants/themes.ts | 7 +++++-- 12 files changed, 39 insertions(+), 45 deletions(-) diff --git a/packages/builder/src/components/commandPalette/CommandPalette.svelte b/packages/builder/src/components/commandPalette/CommandPalette.svelte index a8b4dedbdb..1e9acbb7e2 100644 --- a/packages/builder/src/components/commandPalette/CommandPalette.svelte +++ b/packages/builder/src/components/commandPalette/CommandPalette.svelte @@ -23,6 +23,7 @@ import { themeStore } from "stores/portal" import { getContext } from "svelte" import { Constants } from "@budibase/frontend-core" + import { ThemeOptions } from "@budibase/shared-core" const modalContext = getContext(Context.Modal) const commands = [ @@ -141,13 +142,13 @@ icon: "ShareAndroid", action: () => $goto(`./automation/${automation._id}`), })) ?? []), - ...Constants.ThemeOptions.map(theme => ({ + ...ThemeOptions.map(themeMeta => ({ type: "Change Builder Theme", - name: theme.name, + name: themeMeta.name, icon: "ColorPalette", action: () => themeStore.update(state => { - state.theme = theme.id + state.theme = themeMeta.id return state }), })), diff --git a/packages/builder/src/components/integration/QueryEditor.svelte b/packages/builder/src/components/integration/QueryEditor.svelte index 97998c3d22..995451b7e3 100644 --- a/packages/builder/src/components/integration/QueryEditor.svelte +++ b/packages/builder/src/components/integration/QueryEditor.svelte @@ -3,6 +3,7 @@ import { Label } from "@budibase/bbui" import { onMount, createEventDispatcher } from "svelte" import { themeStore } from "stores/portal" + import { Theme } from "@budibase/types" const dispatch = createEventDispatcher() @@ -116,7 +117,7 @@ readOnly, autoCloseBrackets: true, autoCloseTags: true, - theme: $themeStore.theme.includes("light") ? THEMES.LIGHT : THEMES.DARK, + theme: $themeStore.theme === Theme.LIGHT ? THEMES.LIGHT : THEMES.DARK, } if (!tab) diff --git a/packages/builder/src/components/settings/ThemeModal.svelte b/packages/builder/src/components/settings/ThemeModal.svelte index eb63a49b02..7bc3c1efa3 100644 --- a/packages/builder/src/components/settings/ThemeModal.svelte +++ b/packages/builder/src/components/settings/ThemeModal.svelte @@ -1,12 +1,12 @@