import { createRoot } from "react-dom/client";
import DefaultFrontendApp from "./default-theme/FrontendApp";
import LightFrontendApp from "./light-theme/FrontendApp";

const rootElement = document.getElementById("bookify-frontend");
const theme = (rootElement.getAttribute("data-theme") || "default").toLowerCase();

const themes = {
    default: { App: DefaultFrontendApp },
    light:   { App: LightFrontendApp },
};

const AppComponent = (themes[theme] && themes[theme].App) ? themes[theme].App : themes.default.App;
const root = createRoot(rootElement);

root.render(
    <React.StrictMode>
        <AppComponent />
    </React.StrictMode>
);
