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

@@ -1,26 +1,13 @@
import * as React from "react";
import * as ReactDOM from "react-dom/client";
import Admin from "./Admin";
import "./main.css";
import Admin from "./Admin";
function ClientApp() {
return <Admin withProvider />;
}
// Render the app
const rootElement = document.getElementById("app")!;
const shouldRender =
!rootElement.innerHTML ||
(rootElement.childElementCount === 1 && rootElement.firstElementChild?.id === "loading");
if (shouldRender) {
const root = ReactDOM.createRoot(rootElement);
root.render(
<React.StrictMode>
<ClientApp />
</React.StrictMode>
);
}
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<Admin withProvider />
</React.StrictMode>
);
// REGISTER ERROR OVERLAY
if (process.env.NODE_ENV !== "production") {