import { useCallback, useEffect, type FC } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { ArrowLeftRight, ChevronDown, LayoutDashboard } from "lucide-react"; import { Button } from "@/components/ui/button"; import Avatar from "@/feature/Avatar"; import { useAuth } from "@/store/auth"; import { useOAuth } from "@/store/oauth"; const AuthorizePage: FC = () => { const promptAccountSelection = useAuth((state) => state.deleteActiveAccount); const activeAccount = useAuth((state) => state.activeAccount); const profile = useAuth((state) => state.profile); const fetchService = useOAuth((s) => s.fetchApiService); const fetching = useOAuth((s) => s.fetching); const clientId = useOAuth((s) => s.clientID); const apiService = useOAuth((s) => s.apiService); const selectSession = useOAuth((state) => state.selectSession); const handleAgree = useCallback(() => { if (!activeAccount) return; selectSession(activeAccount.access); }, [activeAccount, selectSession]); useEffect(() => { if (clientId) { fetchService(); } }, [clientId, fetchService]); return (
{fetching && (
Loading...
)}
{/* icon */}
{/*
*/} {/* */} {apiService?.icon_url ? ( service_icon ) : ( )} {/*
*/}

{apiService?.name ?? "Service"} {" "} wants to access your Home Account

{profile?.email}

This will allow{" "} {apiService?.name ?? "service"} {" "} to:

{/* */}
{(apiService?.scopes?.length ?? 0) > 0 && apiService!.scopes.map((scope) => (

{scope === "openid" && "Access your account id and use it"} {scope === "email" && "View your email address"} {scope === "profile" && "View your profile image"}

))}

Are you sure you want to trust {apiService?.name ?? "service"} ?

Please do not share any sensitive, personal, or unnecessary information unless you trust this service. Protect your privacy and only provide information that is required for the intended purpose.

); }; export default AuthorizePage;