From ae80922d0381a0761a1634738f62c09c5e3c26f7 Mon Sep 17 00:00:00 2001 From: Xavier Karma Date: Mon, 5 Oct 2026 05:14:48 +0530 Subject: [PATCH] Fix dark theme fill, theme toggle visibility and bank account creation - The Carbon theme class is now also set on html, with a themed background and a full-height root, so the dark theme fills the whole window instead of stopping at the content height. An inline script in index.html applies the saved theme before first paint. - The header theme button gets a tooltip, inline padding and a max width so it is no longer clipped at the window edge. New Invoice also gets a labelled Dark mode toggle wired to the same handler. - A shared BankAccountModal replaces the inline editor in Settings and adds a Create bank account button under the bank selector on New Invoice, which selects the new account on save. Settings keeps one Add bank account button under the table. Bank name and account number are now required. --- index.html | 11 +++ src/App.tsx | 21 ++-- src/components/AppShell.tsx | 6 +- src/components/BankAccountModal.tsx | 148 ++++++++++++++++++++++++++++ src/lib/theme.ts | 31 ++++++ src/styles/carbon.scss | 39 +++++++- src/views/AppSettings.tsx | 144 +++++++-------------------- src/views/NewInvoice.tsx | 44 ++++++++- 8 files changed, 320 insertions(+), 124 deletions(-) create mode 100644 src/components/BankAccountModal.tsx create mode 100644 src/lib/theme.ts diff --git a/index.html b/index.html index d3e0e66..1341657 100644 --- a/index.html +++ b/index.html @@ -6,6 +6,17 @@ Voiced +
diff --git a/src/App.tsx b/src/App.tsx index 6519700..4b158b0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,6 +11,7 @@ import Clients from "./views/Clients"; import { ToastProvider, useToast } from "./components/ToastProvider"; import AppSettings from "./views/AppSettings"; import { requestSettingsTab } from "./lib/settingsTab"; +import { applyDocumentTheme, cachedTheme, normalizeTheme } from "./lib/theme"; export default function App() { return ( @@ -46,9 +47,15 @@ function AppInner() { void refreshSettings(); }, [refreshSettings]); + // Before settings load (and on the error screen) use the cached theme so the window never flashes white. + const theme = settings ? normalizeTheme(settings.theme) : cachedTheme(); + useEffect(() => { + applyDocumentTheme(theme); + }, [theme]); + if (loading) { return ( - +
@@ -58,7 +65,7 @@ function AppInner() { if (error) { return ( - +
+ { @@ -106,8 +111,8 @@ function AppInner() { }; return ( - - + + {/* Main views stay mounted so a half-typed invoice survives switching tabs. */} setView("new")} openDraftId={openDraftId} onDraftOpened={() => setOpenDraftId(null)} + theme={theme} + onToggleTheme={toggleTheme} />