Refactor admin theme handling and optimize initialization.

Simplified theme detection logic and improved the loading screen for better performance on slower networks. Adjusted styles, reorganized imports, and removed unnecessary rendering logic in `main.tsx`.
This commit is contained in:
dswbx
2025-01-10 18:33:12 +01:00
parent c7d983942f
commit 87e07570d4
4 changed files with 174 additions and 163 deletions

View File

@@ -54,16 +54,19 @@ function AdminInternal() {
);
}
const Skeleton = ({ theme = "light" }: { theme?: string }) => {
const Skeleton = ({ theme }: { theme?: string }) => {
const actualTheme =
(theme ?? document.querySelector("html")?.classList.contains("light")) ? "light" : "dark";
return (
<div id="bknd-admin" className={(theme ?? "light") + " antialiased"}>
<div id="bknd-admin" className={actualTheme + " antialiased"}>
<AppShell.Root>
<header
data-shell="header"
className="flex flex-row w-full h-16 gap-2.5 border-muted border-b justify-start bg-muted/10"
>
<div className="max-h-full flex hover:bg-primary/5 link p-2.5 w-[134px] outline-none">
<Logo theme={theme} />
<Logo theme={actualTheme} />
</div>
<nav className="hidden md:flex flex-row gap-2.5 pl-0 p-2.5 items-center">
{[...new Array(5)].map((item, key) => (