/** * Google Login Button Component */ "use client"; import React from "react"; import { useAuth } from "@/contexts/auth-context"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { LogOut, User, Cloud, CloudOff } from "lucide-react"; // Google Icon SVG function GoogleIcon({ className }: { className?: string }) { return ( ); } export function LoginButton() { const { user, isLoading, isAuthenticated, login, logout } = useAuth(); const [loggingOut, setLoggingOut] = React.useState(false); const handleLogout = async () => { setLoggingOut(true); try { await logout(); } finally { setLoggingOut(false); } }; if (isLoading || loggingOut) { return ( ); } if (isAuthenticated && user) { return (

{user.name}

{user.email}

雲端同步已啟用 登出
); } return ( ); } /** * Full-width login prompt for pages that benefit from login */ export function LoginPrompt() { const { login, isAuthenticated } = useAuth(); if (isAuthenticated) return null; return (

目前使用本地儲存

登入 Google 帳號以同步 API 設定和歷史報告

); }