Show the loading view before the app starts (#134) #135
No files matched your search
+26
-1
@@ -24,9 +24,34 @@
|
||||
<link rel="apple-touch-icon" href="/img/apple-touch-icon.png?v=2026-09-27a" />
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<title>inbuxa</title>
|
||||
<!--
|
||||
#134: the loading view, drawn before any JavaScript runs. It sits inside
|
||||
#root, so React replaces it when it mounts, and AppLoading (ui/misc.tsx)
|
||||
draws the same thing while the session is checked, so the handover
|
||||
doesn't move anything. Its rules live here rather than in app.css because
|
||||
the stylesheet arrives with the bundle. Until a theme is applied it uses
|
||||
the default theme's colors (ihasmail, dark), written out, not the
|
||||
stylesheet's :root, whose light values would flash before applyTheme()
|
||||
runs; from then on, the theme's own. No text: nothing
|
||||
here can be translated yet. The mark is inbuxa's even on a renamed
|
||||
instance, whose name isn't known until the server answers.
|
||||
-->
|
||||
<style>
|
||||
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: #0d2430; }
|
||||
.boot-mark { width: 48px; height: auto; animation: boot-bounce 1.4s infinite; }
|
||||
.boot-ring { width: 20px; height: 20px; box-sizing: border-box; border: 2px solid #2e6a7a; border-top-color: #46cac3; border-radius: 50%; animation: boot-spin .7s linear infinite; }
|
||||
[data-theme] .boot { background: var(--bg); }
|
||||
[data-theme] .boot-ring { border-color: var(--border-strong); border-top-color: var(--accent); }
|
||||
@keyframes boot-bounce {
|
||||
0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); }
|
||||
50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); }
|
||||
}
|
||||
@keyframes boot-spin { to { transform: rotate(360deg); } }
|
||||
@media (prefers-reduced-motion: reduce) { .boot-mark, .boot-ring { animation: none; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<div id="root"><div class="boot" aria-hidden="true"><img class="boot-mark" src="/img/inbuxa-mark.png?v=2026-09-27a" alt="" /><span class="boot-ring"></span></div></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
+3
-15
@@ -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 (
|
||||
<div className="center" style={{ height: "100%" }}>
|
||||
<Spinner size="lg" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (status === "loading" || !languageReady) return <AppLoading />;
|
||||
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 (
|
||||
<div className="center" style={{ height: "100%" }}>
|
||||
<Spinner size="lg" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (!ready) return <AppLoading />;
|
||||
|
||||
return (
|
||||
<AppShell>
|
||||
|
||||
@@ -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 (
|
||||
<div className="boot" aria-busy="true">
|
||||
<img className="boot-mark" src={brandImage("/img/inbuxa-mark.png")} alt="" />
|
||||
<span className="boot-ring" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Empty({ icon, title, children }: { icon?: ReactNode; title: string; children?: ReactNode }) {
|
||||
return (
|
||||
<div className="empty">
|
||||
|
||||
Reference in new issue
Block a user