From aff645bc5db6a0a116c97ebbdb5202b9c0843a12 Mon Sep 17 00:00:00 2001 From: Yaosanqi137 Date: Sun, 5 Apr 2026 17:09:17 +0800 Subject: [PATCH] feat(web): render auth pages without app shell --- apps/web/src/App.tsx | 91 +++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 2fc19b0..c77f482 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import type { LucideIcon } from "lucide-react"; import { Bell, @@ -14,7 +14,7 @@ import { Sun, X } from "lucide-react"; -import { Navigate, Route, Routes, useNavigate } from "react-router-dom"; +import { Navigate, Route, Routes, useLocation, useNavigate } from "react-router-dom"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { EmailLoginPage } from "@/pages/email-login-page"; @@ -66,6 +66,10 @@ function App() { const [sidebarCollapsed, setSidebarCollapsed] = useState(false); const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false); const navigate = useNavigate(); + const location = useLocation(); + + const isAuthPage = + location.pathname === "/login/email" || location.pathname.startsWith("/auth/callback/"); useEffect(() => { applyThemeMode(themeMode); @@ -95,6 +99,19 @@ function App() { setThemeMode((currentTheme) => (currentTheme === "dark" ? "light" : "dark")); } + function handleLoginSuccess(payload: EmailLoginResult): void { + const nextSession = toWebSession(payload); + saveSession(nextSession); + setSession(nextSession); + setMobileSidebarOpen(false); + navigate("/", { replace: true }); + } + + function handleBootstrapSession(nextSession: WebSession): void { + setSession(nextSession); + setMobileSidebarOpen(false); + } + function renderSidebarContent(options: { collapsed: boolean; mobile: boolean }) { const { collapsed, mobile } = options; @@ -124,9 +141,8 @@ function App() { key={item.key} type="button" className={cn( - "group flex w-full items-center rounded-xl border border-transparent text-left transition-colors", - "hover:border-primary/25 hover:bg-primary/10", - "gap-3 px-3 py-2.5" + "group flex w-full items-center rounded-xl border border-transparent px-3 py-2.5 text-left transition-colors", + "gap-3 hover:border-primary/25 hover:bg-primary/10" )} > @@ -150,10 +166,7 @@ function App() {