From 769992687b014cb778b79ab8f20df716e171cd1f Mon Sep 17 00:00:00 2001 From: John Coffey Date: Fri, 20 Nov 2026 15:08:49 -0700 Subject: [PATCH] Show the loading view before the app starts (#134) Opening the app drew nothing until the bundle had downloaded and React mounted: #root was empty. index.html now holds the loading view inside #root, so it shows before any JavaScript runs and React replaces it when it mounts. It's the admin console's: the inbuxa mark bouncing, with the spinner under it, and no text, since nothing can be translated yet. The app shows the same view, AppLoading, while the session is checked and the account's settings load, in place of the bare spinner, so the handover doesn't move anything. Its rules sit in index.html because the stylesheet arrives with the bundle. Until a theme is applied they use the default theme's colors written out; the stylesheet's :root holds the light values, which would flash before applyTheme() runs. After that they follow the theme. The bounce and the spin stop for reduced motion. The mark is inbuxa's on a renamed instance too: its name isn't known until the server answers. Fixes #134 --- web/index.html | 27 ++++++++++++++++++++++++++- web/src/App.tsx | 18 +++--------------- web/src/ui/misc.tsx | 17 +++++++++++++++++ 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/web/index.html b/web/index.html index 6c89972..bbe7827 100644 --- a/web/index.html +++ b/web/index.html @@ -24,9 +24,34 @@ inbuxa + + -
+
diff --git a/web/src/App.tsx b/web/src/App.tsx index b301169..7e35dbb 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -11,7 +11,7 @@ import { push } from "@/jmap/push"; import { client } from "@/jmap/client"; import { ToastHost, toast } from "@/ui/toast"; import { ConfirmHost } from "@/ui/dialog"; -import { Spinner } from "@/ui/misc"; +import { AppLoading, Spinner } from "@/ui/misc"; import { LoginPage } from "@/views/Login"; import { AppShell } from "@/views/AppShell"; import { MailView } from "@/views/mail/MailView"; @@ -69,13 +69,7 @@ export function App() { return () => { live = false; }; }, []); - if (status === "loading" || !languageReady) { - return ( -
- -
- ); - } + if (status === "loading" || !languageReady) return ; return ( /* * Every in-app navigation runs through `aroundNav` -- links, redirects and @@ -346,13 +340,7 @@ function AuthedApp() { // Nothing worth painting until the account's settings are in force; see the // comment on `ready` above. With a cache this was true from the first frame. - if (!ready) { - return ( -
- -
- ); - } + if (!ready) return ; return ( diff --git a/web/src/ui/misc.tsx b/web/src/ui/misc.tsx index 813bca8..3e10f25 100644 --- a/web/src/ui/misc.tsx +++ b/web/src/ui/misc.tsx @@ -4,6 +4,7 @@ import { avatarColor, initials } from "@/lib/address"; import { useContacts } from "@/store/contacts"; import { contactPhoto } from "@/lib/contacts"; import { t } from "@/lib/i18n"; +import { brandImage } from "@/lib/brand"; export function Avatar({ who, size, className }: { who: EmailAddress | { name?: string | null; email?: string } | string | null | undefined; size?: "sm" | "lg" | "xl"; className?: string }) { const email = typeof who === "string" ? who : (who?.email ?? ""); @@ -52,6 +53,22 @@ export function Spinner({ size = "md", label }: { size?: "md" | "lg"; label?: st ); } +/** + * The app's loading view while the session is checked and the account's + * settings arrive (#134): the same markup as the placeholder in index.html, + * which draws it before any JavaScript runs, and styled by the rules there, so + * nothing moves when React takes over. The mark is inbuxa's on every instance, + * as it has to be in index.html. + */ +export function AppLoading() { + return ( +
+ + +
+ ); +} + export function Empty({ icon, title, children }: { icon?: ReactNode; title: string; children?: ReactNode }) { return (
-- 2.54.0