/**
* 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}
目前使用本地儲存
登入 Google 帳號以同步 API 設定和歷史報告