diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 0a5afa1..66a22b4 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -12,7 +12,6 @@ import { SettingsPage } from "./pages/Settings.js"; import { BookingConfirmedPage } from "./pages/BookingConfirmed.js"; import { BookingCancelledPage } from "./pages/BookingCancelled.js"; import { BookingErrorPage } from "./pages/BookingError.js"; -import { SetupWizard } from "./pages/SetupWizard.jsx"; import { CustomerPortal } from "./portal/CustomerPortal.js"; import { DevLoginSelector, getDevUser } from "./pages/DevLoginSelector.js"; import { DevSessionIndicator } from "./components/DevSessionIndicator.js"; @@ -20,61 +19,6 @@ import { BrandingProvider, useBranding } from "./BrandingContext.js"; import { GlobalSearch } from "./components/GlobalSearch.js"; import { useSession, signIn } from "./lib/auth-client.js"; -function LoginPage() { - const [isLoading, setIsLoading] = useState(false); - - const handleLogin = async () => { - setIsLoading(true); - await signIn.social({ provider: "authentik", callbackURL: window.location.origin }); - }; - - return ( -
-
-

GroomBook

-

- Sign in to continue -

- -
-
- ); -} - const NAV_LINKS = [ { to: "/admin", label: "Appointments" }, { to: "/admin/clients", label: "Clients" }, @@ -190,7 +134,6 @@ function AdminLayout() { export function App() { const location = useLocation(); const [authDisabled, setAuthDisabled] = useState(null); - const [needsSetup, setNeedsSetup] = useState(null); const { data: rawSession, isPending: rawSessionLoading } = useSession(); // In dev mode (authDisabled=true), session state is irrelevant - skip useSession result const session = authDisabled ? null : rawSession; @@ -203,19 +146,6 @@ export function App() { .catch(() => setAuthDisabled(false)); }, []); - // After session is confirmed, check if setup is needed - useEffect(() => { - if (authDisabled === null || sessionLoading) return; - // Skip if no authenticated session (will redirect to login or dev selector) - if (!authDisabled && !session) return; - if (authDisabled && !getDevUser()) return; - - fetch("/api/setup/status") - .then((r) => r.json()) - .then((data) => setNeedsSetup(data.needsSetup === true)) - .catch(() => setNeedsSetup(false)); - }, [authDisabled, session, sessionLoading]); - // Public booking redirect pages — no auth or portal chrome needed if (location.pathname === "/booking/confirmed") { return ; @@ -227,39 +157,24 @@ export function App() { return ; } - // Setup wizard — standalone, no admin chrome - if (location.pathname === "/setup") { - return ( - - - - ); - } - - // Still loading auth state or setup check (skip setup check in dev mode) + // Still loading auth state if (authDisabled === null || sessionLoading) return null; - // Dev mode: show login selector (no setup check needed in dev mode) + // Dev mode: show login selector if (authDisabled && location.pathname === "/login") { return ; } - // Dev mode: use dev login selector (no setup check needed in dev mode) - if (authDisabled && !getDevUser()) { + // Dev mode: use dev login selector for non-admin routes + // Allow /admin/* access in dev mode even without stored dev user (skipLogin flow) + if (authDisabled && !getDevUser() && !location.pathname.startsWith("/admin")) { return ; } - // Production: need setup check - if (needsSetup === null) return null; - // Production mode: if no session, redirect to Authentik sign-in if (!authDisabled && !session) { - return ; - } - - // Redirect to setup wizard if needed - if (needsSetup) { - return ; + signIn.social({ provider: "authentik" }); + return null; } return (