public commit

This commit is contained in:
dswbx
2024-11-16 12:01:47 +01:00
commit 90f80c4280
582 changed files with 49291 additions and 0 deletions

38
app/src/ui/main.tsx Normal file
View File

@@ -0,0 +1,38 @@
import React, { StrictMode } from "react";
import ReactDOM from "react-dom/client";
import "./styles.css";
import Admin from "./Admin";
function ClientApp() {
return <Admin withProvider />;
}
// Render the app
const rootElement = document.getElementById("app")!;
if (!rootElement.innerHTML) {
const root = ReactDOM.createRoot(rootElement);
root.render(
<StrictMode>
<ClientApp />
</StrictMode>
);
}
// REGISTER ERROR OVERLAY
if (process.env.NODE_ENV !== "production") {
const showErrorOverlay = (err) => {
// must be within function call because that's when the element is defined for sure.
const ErrorOverlay = customElements.get("vite-error-overlay");
// don't open outside vite environment
if (!ErrorOverlay) {
return;
}
//console.log("error", err);
const overlay = new ErrorOverlay(err);
document.body.appendChild(overlay);
};
window.addEventListener("error", ({ error }) => showErrorOverlay(error));
window.addEventListener("unhandledrejection", ({ reason }) => showErrorOverlay(reason));
}