From 6c9127427c6c915044352bef10f158727c412fcd Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 26 Mar 2024 10:43:56 +0000 Subject: [PATCH 01/37] Fix issues with colours in app skeletons --- .../[screenId]/_components/AppPreview.svelte | 4 ++-- packages/builder/src/stores/builder/theme.js | 15 ++++++++++----- packages/client/src/stores/theme.js | 11 ++--------- packages/frontend-core/src/utils/index.js | 1 + packages/frontend-core/src/utils/theme.js | 12 ++++++++++++ 5 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 packages/frontend-core/src/utils/theme.js diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte index 12d572ecc4..44394fa7ee 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte @@ -247,9 +247,9 @@
- {#if loading} + {#if loading || true}
diff --git a/packages/builder/src/stores/builder/theme.js b/packages/builder/src/stores/builder/theme.js index afdf3e9805..efa2609b97 100644 --- a/packages/builder/src/stores/builder/theme.js +++ b/packages/builder/src/stores/builder/theme.js @@ -1,5 +1,6 @@ import { writable, get } from "svelte/store" import { API } from "api" +import { getBaseTheme } from "@budibase/frontend-core" const INITIAL_THEMES_STATE = { theme: "", @@ -12,11 +13,15 @@ export const themes = () => { }) const syncAppTheme = app => { - store.update(state => ({ - ...state, - theme: app.theme || "spectrum--light", - customTheme: app.customTheme, - })) + store.update(state => { + const theme = app.theme || "spectrum--light" + return { + ...state, + theme, + baseTheme: getBaseTheme(theme), + customTheme: app.customTheme, + } + }) } const save = async (theme, appId) => { diff --git a/packages/client/src/stores/theme.js b/packages/client/src/stores/theme.js index 8877556f0c..50dad12fa4 100644 --- a/packages/client/src/stores/theme.js +++ b/packages/client/src/stores/theme.js @@ -1,7 +1,7 @@ import { derived } from "svelte/store" import { appStore } from "./app" import { builderStore } from "./builder" -import { Constants } from "@budibase/frontend-core" +import { getBaseTheme } from "@budibase/frontend-core" // This is the good old acorn bug where having the word "g l o b a l" makes it // think that this is not ES6 compatible and starts throwing errors when using @@ -29,13 +29,6 @@ const createThemeStore = () => { // Ensure theme is set theme = theme || defaultTheme - // Get base theme - let base = - Constants.Themes.find(x => `spectrum--${x.class}` === theme)?.base || "" - if (base) { - base = `spectrum--${base}` - } - // Delete and nullish keys from the custom theme if (customTheme) { Object.entries(customTheme).forEach(([key, value]) => { @@ -59,7 +52,7 @@ const createThemeStore = () => { return { theme, - baseTheme: base, + baseTheme: getBaseTheme(theme), customTheme, customThemeCss, } diff --git a/packages/frontend-core/src/utils/index.js b/packages/frontend-core/src/utils/index.js index 98998b7f0e..6b79e1d040 100644 --- a/packages/frontend-core/src/utils/index.js +++ b/packages/frontend-core/src/utils/index.js @@ -7,3 +7,4 @@ export * as RowUtils from "./rows" export { memo, derivedMemo } from "./memo" export { createWebsocket } from "./websocket" export * from "./download" +export * from "./theme" diff --git a/packages/frontend-core/src/utils/theme.js b/packages/frontend-core/src/utils/theme.js new file mode 100644 index 0000000000..165f7c9782 --- /dev/null +++ b/packages/frontend-core/src/utils/theme.js @@ -0,0 +1,12 @@ +import { Themes } from "../constants.js" + +export const getBaseTheme = theme => { + if (!theme) { + return "" + } + let base = Themes.find(x => `spectrum--${x.class}` === theme)?.base || "" + if (base) { + base = `spectrum--${base}` + } + return base +} From 884d9ecf6c9e6e6c98380140a55fbaa7a4e83245 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 26 Mar 2024 10:45:23 +0000 Subject: [PATCH 02/37] Remove testing code --- .../design/[screenId]/_components/AppPreview.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte index 44394fa7ee..298f044086 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte @@ -247,7 +247,7 @@
- {#if loading || true} + {#if loading}
Date: Tue, 26 Mar 2024 10:46:58 +0000 Subject: [PATCH 03/37] Remove redundant classes --- .../design/[screenId]/_components/AppPreview.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte index 298f044086..0ce9e096f2 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte @@ -249,7 +249,7 @@
{#if loading}
From 66009305598b142833a78cee77699cffba18f446 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 26 Mar 2024 10:51:53 +0000 Subject: [PATCH 04/37] Fix annoying account-portal submodule check --- packages/account-portal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account-portal b/packages/account-portal index f5b467b6b1..13b3bc93e1 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit f5b467b6b1c55c48847545db41be7b1c035e167a +Subproject commit 13b3bc93e115a2ec6c2cde5cfa199773e31a308d From 00d57c7f0fc6e28ed0000321c954112fa0711f0d Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Tue, 26 Mar 2024 11:06:09 +0000 Subject: [PATCH 05/37] add base theme to portal app preview --- .../src/pages/builder/portal/apps/[appId]/index.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/apps/[appId]/index.svelte b/packages/builder/src/pages/builder/portal/apps/[appId]/index.svelte index a08189a400..d7e0e35289 100644 --- a/packages/builder/src/pages/builder/portal/apps/[appId]/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/[appId]/index.svelte @@ -20,7 +20,7 @@ import { sdk } from "@budibase/shared-core" import { API } from "api" import ErrorSVG from "./ErrorSVG.svelte" - import { ClientAppSkeleton } from "@budibase/frontend-core" + import { getBaseTheme, ClientAppSkeleton } from "@budibase/frontend-core" $: app = $enrichedApps.find(app => app.appId === $params.appId) $: iframeUrl = getIframeURL(app) @@ -137,7 +137,9 @@ class:hide={!loading || !app?.features?.skeletonLoader} class="loading" > -
+
Date: Tue, 26 Mar 2024 14:47:14 +0000 Subject: [PATCH 06/37] Fix additional scrollbar appearing when hiding binding panels --- .../builder/src/components/common/bindings/BindingPanel.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 21d389357f..10d95a3e7e 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -371,6 +371,7 @@