siftlode/frontend/src/main.tsx
npeter83 48cb11434d feat(ui): reusable app-styled confirm dialog, replacing window.confirm
Add a promise-based ConfirmProvider + useConfirm() hook (built on the Modal shell,
liquid-glass styling, danger variant, Esc/backdrop = cancel, Enter = confirm) so
confirmations match the app instead of the native browser dialog. Wire it in at the
app root and replace both window.confirm call sites (playlist delete, channel
unsubscribe). Trilingual common.confirm/confirmTitle strings.
2026-06-15 15:06:47 +02:00

34 lines
1.3 KiB
TypeScript

import React from "react";
import { createRoot } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import App from "./App";
import ErrorBoundary from "./components/ErrorBoundary";
import { ConfirmProvider } from "./components/ConfirmProvider";
import PrivacyPolicy from "./components/legal/PrivacyPolicy";
import Terms from "./components/legal/Terms";
import "./i18n";
import "./index.css";
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false, staleTime: 30_000, refetchOnWindowFocus: false } },
});
// Public, login-free legal pages. They live outside the authenticated App tree (no /api/me)
// so Google's consent screen and reviewers can fetch them directly. Reached by full-page
// navigation (plain <a href>), so a simple pathname switch is enough — no router needed.
const path = window.location.pathname;
const root =
path === "/privacy" ? <PrivacyPolicy /> :
path === "/terms" ? <Terms /> : (
<QueryClientProvider client={queryClient}>
<ErrorBoundary>
<ConfirmProvider>
<App />
</ConfirmProvider>
</ErrorBoundary>
</QueryClientProvider>
);
createRoot(document.getElementById("root")!).render(
<React.StrictMode>{root}</React.StrictMode>
);