Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(desktop): add tab system with document.title sync + upgrade shared LoginPage
Naiyuan Qinga012d912fe4e
diff --git a/apps/desktop/src/renderer/src/components/tab-bar.tsx b/apps/desktop/src/renderer/src/components/tab-bar.tsxnew file mode 100644index 0000000000..4f994d191c--- /dev/null+++ b/apps/desktop/src/renderer/src/components/tab-bar.tsx@@ -0,0 +1,114 @@+import { useNavigate } from "react-router-dom";+import {+ Inbox,+ CircleUser,+ ListTodo,+ Bot,+ Monitor,+ BookOpenText,+ Settings,+ X,+ Plus,+ type LucideIcon,+} from "lucide-react";+import { cn } from "@multica/ui/lib/utils";+import { useTabStore, resolveRouteIcon, type Tab } from "@/stores/tab-store";++const TAB_ICONS: Record<string, LucideIcon> = {+ Inbox,+ CircleUser,+ ListTodo,+ Bot,+ Monitor,+ BookOpenText,+ Settings,+};++function TabItem({ tab, isActive }: { tab: Tab; isActive: boolean }) {+ const navigate = useNavigate();+ const setActiveTab = useTabStore((s) => s.setActiveTab);+ const closeTab = useTabStore((s) => s.closeTab);++ const Icon = TAB_ICONS[tab.icon];++ const handleClick = () => {+ if (isActive) return;+ setActiveTab(tab.id);+ navigate(tab.path);+ };++ const handleClose = (e: React.MouseEvent) => {+ e.stopPropagation();+ const newPath = closeTab(tab.id);+ if (newPath) navigate(newPath);+ };++ return (+ <button+ onClick={handleClick}+ className={cn(+ "group flex h-7 w-40 items-center gap-1.5 rounded-md px-2 text-xs transition-colors",+ "select-none cursor-default",+ isActive+ ? "bg-sidebar-accent text-sidebar-accent-foreground"+ : "bg-sidebar-accent/60 text-muted-foreground hover:bg-sidebar-accent/80",+ )}+ >+ {Icon && <Icon className="size-3.5 shrink-0" />}+ <span+ className="min-w-0 flex-1 overflow-hidden whitespace-nowrap text-left"+ style={{+ maskImage: "linear-gradient(to right, black calc(100% - 12px), transparent)",+ WebkitMaskImage: "linear-gradient(to right, black calc(100% - 12px), transparent)",+ }}+ >+ {tab.title}+ </span>+ <span+ onClick={handleClose}+ className="hidden size-3.5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors group-hover:flex hover:bg-muted-foreground/20 hover:text-foreground"+ >+ <X className="size-2.5" />+ </span>+ </button>+ );+}++function NewTabButton() {+ const navigate = useNavigate();+ const addTab = useTabStore((s) => s.addTab);+ const setActiveTab = useTabStore((s) => s.setActiveTab);++ const handleClick = () => {+ const path = "/issues";+ const tabId = addTab(path, "Issues", resolveRouteIcon(path));+ setActiveTab(tabId);+ navigate(path);+ };++ return (+ <button+ onClick={handleClick}+ className="flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-muted/50 hover:text-muted-foreground"+ >+ <Plus className="size-3.5" />+ </button>+ );+}++export function TabBar() {+ const tabs = useTabStore((s) => s.tabs);+ const activeTabId = useTabStore((s) => s.activeTabId);++ return (+ <div+ className="flex h-full items-center gap-0.5 px-2 justify-start"+ style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}+ >+ {tabs.map((tab) => (+ <TabItem key={tab.id} tab={tab} isActive={tab.id === activeTabId} />+ ))}+ <NewTabButton />+ </div>+ );+}diff --git a/apps/desktop/src/renderer/src/hooks/use-document-title.ts b/apps/desktop/src/renderer/src/hooks/use-document-title.tsnew file mode 100644index 0000000000..28429568be--- /dev/null+++ b/apps/desktop/src/renderer/src/hooks/use-document-title.ts@@ -0,0 +1,8 @@+import { useEffect } from "react";++/** Sets document.title. The tab system observes this automatically. */+export function useDocumentTitle(title: string) {+ useEffect(() => {+ if (title) document.title = title;+ }, [title]);+}diff --git a/apps/desktop/src/renderer/src/hooks/use-history-stack.ts b/apps/desktop/src/renderer/src/hooks/use-history-stack.tsnew file mode 100644index 0000000000..386b6032d7--- /dev/null+++ b/apps/desktop/src/renderer/src/hooks/use-history-stack.ts@@ -0,0 +1,57 @@+import { useState, useEffect, useRef, useCallback } from "react";+import { useLocation } from "react-router-dom";++export function useNavigationHistory() {+ const [canGoBack, setCanGoBack] = useState(false);+ const [canGoForward, setCanGoForward] = useState(false);+ const location = useLocation();++ const seqRef = useRef(1);+ const maxSeqRef = useRef(1);+ const isNavRef = useRef(false);++ // Seed initial entry + listen for popstate (browser back/forward)+ useEffect(() => {+ window.history.replaceState({ seq: 1 }, "");++ const handlePopState = (event: PopStateEvent) => {+ const seq = (event.state?.seq as number) ?? 0;+ seqRef.current = seq;+ setCanGoBack(seq > 1);+ setCanGoForward(seq < maxSeqRef.current);+ };++ window.addEventListener("popstate", handlePopState);+ return () => window.removeEventListener("popstate", handlePopState);+ }, []);++ // Stamp seq on each new navigation+ useEffect(() => {+ // Skip if this was our own goBack/goForward call+ if (isNavRef.current) {+ isNavRef.current = false;+ return;+ }++ const nextSeq = seqRef.current + 1;+ seqRef.current = nextSeq;+ maxSeqRef.current = nextSeq;+ window.history.replaceState({ seq: nextSeq }, "");+ setCanGoBack(nextSeq > 1);+ setCanGoForward(false);+ }, [location]);++ const goBack = useCallback(() => {+ if (!canGoBack) return;+ isNavRef.current = true;+ window.history.back();+ }, [canGoBack]);++ const goForward = useCallback(() => {+ if (!canGoForward) return;+ isNavRef.current = true;+ window.history.forward();+ }, [canGoForward]);++ return { canGoBack, canGoForward, goBack, goForward };+}diff --git a/apps/desktop/src/renderer/src/hooks/use-tab-sync.ts b/apps/desktop/src/renderer/src/hooks/use-tab-sync.tsnew file mode 100644index 0000000000..182b1ab09f--- /dev/null+++ b/apps/desktop/src/renderer/src/hooks/use-tab-sync.ts@@ -0,0 +1,61 @@+import { useEffect, useRef } from "react";+import { useLocation } from "react-router-dom";+import { useTabStore, resolveRouteIcon } from "@/stores/tab-store";++/**+ * Keeps the active tab in sync with the current URL and document.title.+ *+ * Two sync directions:+ * 1. URL change → update active tab's path (and set a default title from the route)+ * 2. document.title change → update active tab's title (pages set this naturally)+ *+ * Tab switches (clicking another tab) are ignored — the tab already has its metadata.+ */+export function useTabSync() {+ const location = useLocation();+ const isTabSwitch = useRef(false);++ // Detect tab switches so we don't overwrite metadata+ useEffect(() => {+ return useTabStore.subscribe((state, prev) => {+ if (state.activeTabId !== prev.activeTabId) {+ isTabSwitch.current = true;+ }+ });+ }, []);++ // Sync URL → tab path+ useEffect(() => {+ if (isTabSwitch.current) {+ isTabSwitch.current = false;+ return;+ }++ const { tabs, activeTabId } = useTabStore.getState();+ const activeTab = tabs.find((t) => t.id === activeTabId);+ if (activeTab && activeTab.path !== location.pathname) {+ const icon = resolveRouteIcon(location.pathname);+ useTabStore.getState().updateActiveTab(location.pathname, document.title, icon);+ }+ }, [location.pathname]);++ // Sync document.title → tab title+ useEffect(() => {+ const observer = new MutationObserver(() => {+ const title = document.title;+ if (!title) return;+ const { tabs, activeTabId } = useTabStore.getState();+ const activeTab = tabs.find((t) => t.id === activeTabId);+ if (activeTab && activeTab.title !== title) {+ useTabStore.getState().updateActiveTab(activeTab.path, title, activeTab.icon);+ }+ });++ const titleEl = document.querySelector("title");+ if (titleEl) {+ observer.observe(titleEl, { childList: true, characterData: true, subtree: true });+ }++ return () => observer.disconnect();+ }, []);+}diff --git a/apps/desktop/src/renderer/src/pages/issue-detail-page.tsx b/apps/desktop/src/renderer/src/pages/issue-detail-page.tsxindex 0c2e822191..b0403d981b 100644--- a/apps/desktop/src/renderer/src/pages/issue-detail-page.tsx+++ b/apps/desktop/src/renderer/src/pages/issue-detail-page.tsx@@ -1,8 +1,17 @@import { useParams } from "react-router-dom";+import { useQuery } from "@tanstack/react-query";import { IssueDetail } from "@multica/views/issues/components";+import { useWorkspaceId } from "@multica/core/hooks";+import { issueDetailOptions } from "@multica/core/issues/queries";+import { useDocumentTitle } from "@/hooks/use-document-title";export function IssueDetailPage() {const { id } = useParams<{ id: string }>();+ const wsId = useWorkspaceId();+ const { data: issue } = useQuery(issueDetailOptions(wsId, id!));++ useDocumentTitle(issue ? `${issue.identifier}: ${issue.title}` : "Issue");+if (!id) return null;return <IssueDetail issueId={id} />;}diff --git a/apps/desktop/src/renderer/src/router.tsx b/apps/desktop/src/renderer/src/router.tsxindex 21698a2098..e5ae084eaf 100644--- a/apps/desktop/src/renderer/src/router.tsx+++ b/apps/desktop/src/renderer/src/router.tsx@@ -1,5 +1,6 @@-import { createHashRouter, Navigate } from "react-router-dom";-import { DashboardShell } from "./components/dashboard-shell";+import { createHashRouter, Navigate, Outlet, useMatches } from "react-router-dom";+import { useEffect } from "react";+import { DesktopLayout } from "./components/desktop-layout";import { DesktopLoginPage } from "./pages/login";import { IssueDetailPage } from "./pages/issue-detail-page";// Extracted pages from @multica/views@@ -11,20 +12,55 @@ import { AgentsPage } from "@multica/views/agents";import { InboxPage } from "@multica/views/inbox";import { SettingsPage } from "@multica/views/settings";+/**+ * Sets document.title from the deepest matched route's handle.title.+ * The tab system observes document.title via MutationObserver.+ * Pages with dynamic titles (e.g. issue detail) override by setting+ * document.title directly via useDocumentTitle().+ */+function TitleSync() {+ const matches = useMatches();+ const title = [...matches]+ .reverse()+ .find((m) => (m.handle as { title?: string })?.title)+ ?.handle as { title?: string } | undefined;++ useEffect(() => {+ if (title?.title) document.title = title.title;+ }, [title?.title]);++ return null;+}++/** Wrapper that renders route children + TitleSync */+function PageShell() {+ return (+ <>+ <TitleSync />+ <Outlet />+ </>+ );+}+export const router = createHashRouter([{path: "/",- element: <DashboardShell />,+ element: <DesktopLayout />,children: [- { index: true, element: <Navigate to="/issues" replace /> },- { path: "issues", element: <IssuesPage /> },- { path: "issues/:id", element: <IssueDetailPage /> },- { path: "my-issues", element: <MyIssuesPage /> },- { path: "runtimes", element: <RuntimesPage /> },- { path: "skills", element: <SkillsPage /> },- { path: "agents", element: <AgentsPage /> },- { path: "inbox", element: <InboxPage /> },- { path: "settings", element: <SettingsPage /> },+ {+ element: <PageShell />,+ children: [+ { index: true, element: <Navigate to="/issues" replace /> },+ { path: "issues", element: <IssuesPage />, handle: { title: "Issues" } },+ { path: "issues/:id", element: <IssueDetailPage />, handle: { title: "Issue" } },+ { path: "my-issues", element: <MyIssuesPage />, handle: { title: "My Issues" } },+ { path: "runtimes", element: <RuntimesPage />, handle: { title: "Runtimes" } },+ { path: "skills", element: <SkillsPage />, handle: { title: "Skills" } },+ { path: "agents", element: <AgentsPage />, handle: { title: "Agents" } },+ { path: "inbox", element: <InboxPage />, handle: { title: "Inbox" } },+ { path: "settings", element: <SettingsPage />, handle: { title: "Settings" } },+ ],+ },],},{ path: "/login", element: <DesktopLoginPage /> },diff --git a/apps/desktop/src/renderer/src/stores/tab-store.ts b/apps/desktop/src/renderer/src/stores/tab-store.tsnew file mode 100644index 0000000000..eeb69bd502--- /dev/null+++ b/apps/desktop/src/renderer/src/stores/tab-store.ts@@ -0,0 +1,123 @@+import { create } from "zustand";++// ---------------------------------------------------------------------------+// Types+// ---------------------------------------------------------------------------++export interface Tab {+ id: string;+ path: string;+ title: string;+ icon: string;+}++interface TabStore {+ tabs: Tab[];+ activeTabId: string;++ /** Open a background tab. Deduplicates by path. Returns the tab id. */+ openTab: (path: string, title: string, icon: string) => string;+ /** Always create a new tab (no dedup). Returns the tab id. */+ addTab: (path: string, title: string, icon: string) => string;+ /** Close a tab. Returns the path to navigate to if active tab changed, or null. */+ closeTab: (tabId: string) => string | null;+ /** Switch to a tab by id. */+ setActiveTab: (tabId: string) => void;+ /** Update the active tab's metadata. */+ updateActiveTab: (path: string, title: string, icon: string) => void;+}++// ---------------------------------------------------------------------------+// Route → icon mapping (title comes from document.title, not from here)+// ---------------------------------------------------------------------------++const ROUTE_ICONS: Record<string, string> = {+ "/inbox": "Inbox",+ "/my-issues": "CircleUser",+ "/issues": "ListTodo",+ "/agents": "Bot",+ "/runtimes": "Monitor",+ "/skills": "BookOpenText",+ "/settings": "Settings",+};++/** Resolve a route icon. Title is NOT determined here — it comes from document.title. */+export function resolveRouteIcon(pathname: string): string {+ return ROUTE_ICONS[pathname] ?? (pathname.startsWith("/issues/") ? "ListTodo" : "ListTodo");+}++// ---------------------------------------------------------------------------+// Store+// ---------------------------------------------------------------------------++const DEFAULT_PATH = "/issues";++function createId(): string {+ return crypto.randomUUID();+}++const initialTab: Tab = {+ id: createId(),+ path: DEFAULT_PATH,+ title: "Issues",+ icon: resolveRouteIcon(DEFAULT_PATH),+};++export const useTabStore = create<TabStore>((set, get) => ({+ tabs: [initialTab],+ activeTabId: initialTab.id,++ openTab(path, title, icon) {+ const { tabs } = get();+ const existing = tabs.find((t) => t.path === path);+ if (existing) return existing.id;++ const tab: Tab = { id: createId(), path, title, icon };+ set({ tabs: [...tabs, tab] });+ return tab.id;+ },++ addTab(path, title, icon) {+ const tab: Tab = { id: createId(), path, title, icon };+ set((s) => ({ tabs: [...s.tabs, tab] }));+ return tab.id;+ },++ closeTab(tabId) {+ const { tabs, activeTabId } = get();++ // Never close the last tab — replace with default+ if (tabs.length === 1) {+ const fresh: Tab = { id: createId(), path: DEFAULT_PATH, title: "Issues", icon: resolveRouteIcon(DEFAULT_PATH) };+ set({ tabs: [fresh], activeTabId: fresh.id });+ return fresh.path;+ }++ const idx = tabs.findIndex((t) => t.id === tabId);+ if (idx === -1) return null;++ const next = tabs.filter((t) => t.id !== tabId);++ if (tabId === activeTabId) {+ const newActive = next[Math.min(idx, next.length - 1)];+ set({ tabs: next, activeTabId: newActive.id });+ return newActive.path;+ }++ set({ tabs: next });+ return null;+ },++ setActiveTab(tabId) {+ set({ activeTabId: tabId });+ },++ updateActiveTab(path, title, icon) {+ const { tabs, activeTabId } = get();+ set({+ tabs: tabs.map((t) =>+ t.id === activeTabId ? { ...t, path, title, icon } : t,+ ),+ });+ },+}));diff --git a/packages/views/auth/login-page.tsx b/packages/views/auth/login-page.tsxindex 3a167c8be4..73ba9d2201 100644--- a/packages/views/auth/login-page.tsx+++ b/packages/views/auth/login-page.tsx@@ -1,150 +1,289 @@"use client";-import { useState, useCallback, type ReactNode } from "react";+import { useState, useEffect, useCallback, type ReactNode } from "react";import {Card,CardHeader,CardTitle,CardDescription,CardContent,+ CardFooter,} from "@multica/ui/components/ui/card";import { Input } from "@multica/ui/components/ui/input";import { Button } from "@multica/ui/components/ui/button";import { Label } from "@multica/ui/components/ui/label";+import {+ InputOTP,+ InputOTPGroup,+ InputOTPSlot,+} from "@multica/ui/components/ui/input-otp";import { useAuthStore } from "@multica/core/auth";import { useWorkspaceStore } from "@multica/core/workspace";import { api } from "@multica/core/api";+// ---------------------------------------------------------------------------+// Types+// ---------------------------------------------------------------------------++interface GoogleAuthConfig {+ clientId: string;+ redirectUri: string;+}+interface LoginPageProps {/** Logo element rendered above the title */logo?: ReactNode;/** Called after successful login + workspace hydration */onSuccess: () => void;+ /** Google OAuth config. Omit to disable Google login. */+ google?: GoogleAuthConfig;}-export function LoginPage({ logo, onSuccess }: LoginPageProps) {+// ---------------------------------------------------------------------------+// Component+// ---------------------------------------------------------------------------++export function LoginPage({ logo, onSuccess, google }: LoginPageProps) {const [step, setStep] = useState<"email" | "code">("email");const [email, setEmail] = useState("");const [code, setCode] = useState("");const [error, setError] = useState("");const [loading, setLoading] = useState(false);+ const [cooldown, setCooldown] = useState(0);- const handleSendCode = useCallback(async () => {- setLoading(true);+ // Cooldown timer for resend+ useEffect(() => {+ if (cooldown <= 0) return;+ const timer = setTimeout(() => setCooldown((c) => c - 1), 1000);+ return () => clearTimeout(timer);+ }, [cooldown]);++ const handleSendCode = useCallback(+ async (e?: React.FormEvent) => {+ e?.preventDefault();+ if (!email) {+ setError("Email is required");+ return;+ }+ setLoading(true);+ setError("");+ try {+ await useAuthStore.getState().sendCode(email);+ setStep("code");+ setCode("");+ setCooldown(10);+ } catch (err) {+ setError(+ err instanceof Error+ ? err.message+ : "Failed to send code. Make sure the server is running.",+ );+ } finally {+ setLoading(false);+ }+ },+ [email],+ );++ const handleVerify = useCallback(+ async (value: string) => {+ if (value.length !== 6) return;+ setLoading(true);+ setError("");+ try {+ await useAuthStore.getState().verifyCode(email, value);+ const wsList = await api.listWorkspaces();+ useWorkspaceStore.getState().hydrateWorkspace(wsList);+ onSuccess();+ } catch (err) {+ setError(+ err instanceof Error ? err.message : "Invalid or expired code",+ );+ setCode("");+ setLoading(false);+ }+ },+ [email, onSuccess],+ );++ const handleResend = async () => {+ if (cooldown > 0) return;setError("");try {await useAuthStore.getState().sendCode(email);- setStep("code");- } catch {- setError("Failed to send code");- } finally {- setLoading(false);+ setCooldown(10);+ } catch (err) {+ setError(+ err instanceof Error ? err.message : "Failed to resend code",+ );}- }, [email]);+ };- const handleVerify = useCallback(async () => {- setLoading(true);- setError("");- try {- await useAuthStore.getState().verifyCode(email, code);- const wsList = await api.listWorkspaces();- useWorkspaceStore.getState().hydrateWorkspace(wsList);- onSuccess();- } catch {- setError("Invalid code");- } finally {- setLoading(false);- }- }, [email, code, onSuccess]);+ const handleGoogleLogin = () => {+ if (!google) return;+ const params = new URLSearchParams({+ client_id: google.clientId,+ redirect_uri: google.redirectUri,+ response_type: "code",+ scope: "openid email profile",+ access_type: "offline",+ prompt: "select_account",+ });+ window.location.href = `https://accounts.google.com/o/oauth2/v2/auth?${params}`;+ };++ // -------------------------------------------------------------------------+ // Code verification step+ // -------------------------------------------------------------------------++ if (step === "code") {+ return (+ <div className="flex flex-1 items-center justify-center">+ <Card className="w-full max-w-sm">+ <CardHeader className="text-center">+ {logo && <div className="mx-auto mb-4">{logo}</div>}+ <CardTitle className="text-2xl">Check your email</CardTitle>+ <CardDescription>+ We sent a verification code to{" "}+ <span className="font-medium text-foreground">{email}</span>+ </CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col items-center gap-4">+ <InputOTP+ maxLength={6}+ value={code}+ onChange={(value) => {+ setCode(value);+ if (value.length === 6) handleVerify(value);+ }}+ disabled={loading}+ >+ <InputOTPGroup>+ <InputOTPSlot index={0} />+ <InputOTPSlot index={1} />+ <InputOTPSlot index={2} />+ <InputOTPSlot index={3} />+ <InputOTPSlot index={4} />+ <InputOTPSlot index={5} />+ </InputOTPGroup>+ </InputOTP>+ {error && (+ <p className="text-sm text-destructive">{error}</p>+ )}+ <div className="flex items-center gap-2 text-sm text-muted-foreground">+ <button+ type="button"+ onClick={handleResend}+ disabled={cooldown > 0}+ className="text-primary underline-offset-4 hover:underline disabled:text-muted-foreground disabled:no-underline disabled:cursor-not-allowed"+ >+ {cooldown > 0 ? `Resend in ${cooldown}s` : "Resend code"}+ </button>+ </div>+ </CardContent>+ <CardFooter>+ <Button+ type="button"+ variant="ghost"+ className="w-full"+ onClick={() => {+ setStep("email");+ setCode("");+ setError("");+ }}+ >+ Back+ </Button>+ </CardFooter>+ </Card>+ </div>+ );+ }++ // -------------------------------------------------------------------------+ // Email step+ // -------------------------------------------------------------------------return (<div className="flex flex-1 items-center justify-center">- <Card className="w-[380px]">+ <Card className="w-full max-w-sm"><CardHeader className="text-center">{logo && <div className="mx-auto mb-4">{logo}</div>}- <CardTitle>Sign in to Multica</CardTitle>+ <CardTitle className="text-2xl">Sign in to Multica</CardTitle><CardDescription>- {step === "email"- ? "Enter your email to get a login code"- : `We sent a code to ${email}`}+ Enter your email to get a login code</CardDescription></CardHeader><CardContent>- {step === "email" ? (- <form- onSubmit={(e) => {- e.preventDefault();- handleSendCode();- }}- >- <div className="space-y-4">- <div className="space-y-2">- <Label htmlFor="login-email">Email</Label>- <Input- id="login-email"- type="email"- placeholder="[email protected]"- value={email}- onChange={(e) => setEmail(e.target.value)}- autoFocus- />+ <form id="login-form" onSubmit={handleSendCode} className="space-y-4">+ <div className="space-y-2">+ <Label htmlFor="login-email">Email</Label>+ <Input+ id="login-email"+ type="email"+ placeholder="[email protected]"+ value={email}+ onChange={(e) => setEmail(e.target.value)}+ autoFocus+ required+ />+ </div>+ {error && (+ <p className="text-sm text-destructive">{error}</p>+ )}+ </form>+ </CardContent>+ <CardFooter className="flex flex-col gap-3">+ <Button+ type="submit"+ form="login-form"+ className="w-full"+ size="lg"+ disabled={!email || loading}+ >+ {loading ? "Sending code..." : "Continue"}+ </Button>+ {google && (+ <>+ <div className="relative w-full">+ <div className="absolute inset-0 flex items-center">+ <span className="w-full border-t" /></div>- {error && (- <p className="text-sm text-destructive">{error}</p>- )}- <Button- type="submit"- className="w-full"- disabled={!email || loading}- >- {loading ? "Sending..." : "Send Code"}- </Button>- </div>- </form>- ) : (- <form- onSubmit={(e) => {- e.preventDefault();- handleVerify();- }}- >- <div className="space-y-4">- <div className="space-y-2">- <Label htmlFor="login-code">Verification Code</Label>- <Input- id="login-code"- placeholder="Enter 6-digit code"- value={code}- onChange={(e) => setCode(e.target.value)}- autoFocus- />+ <div className="relative flex justify-center text-xs uppercase">+ <span className="bg-card px-2 text-muted-foreground">or</span></div>- {error && (- <p className="text-sm text-destructive">{error}</p>- )}- <Button- type="submit"- className="w-full"- disabled={!code || loading}- >- {loading ? "Verifying..." : "Verify"}- </Button>- <Button- type="button"- variant="ghost"- className="w-full"- onClick={() => {- setStep("email");- setCode("");- setError("");- }}- >- Back- </Button></div>- </form>+ <Button+ type="button"+ variant="outline"+ className="w-full"+ size="lg"+ onClick={handleGoogleLogin}+ disabled={loading}+ >+ <svg className="mr-2 h-4 w-4" viewBox="0 0 24 24">+ <path+ d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"+ fill="#4285F4"+ />+ <path+ d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"+ fill="#34A853"+ />+ <path+ d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"+ fill="#FBBC05"+ />+ <path+ d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"+ fill="#EA4335"+ />+ </svg>+ Continue with Google+ </Button>+ </>)}- </CardContent>+ </CardFooter></Card></div>);