import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";

const adminOnly = import.meta.env.VITE_ADMIN_ONLY === "true";

void (async () => {
  const root = document.getElementById("root")!;

  if (adminOnly) {
    const { default: AppAdminOnly } = await import("./AppAdminOnly");
    ReactDOM.createRoot(root).render(
      <React.StrictMode>
        <AppAdminOnly />
      </React.StrictMode>,
    );
    return;
  }

  const { default: App } = await import("./App");
  ReactDOM.createRoot(root).render(
    <React.StrictMode>
      <App />
    </React.StrictMode>,
  );
})();
