"use client"; import * as React from "react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { Card, HideAmountsToggle, Icon, IconChip, MercuryButton, ThemeToggle } from "@/ds"; import type { IconName } from "@/ds"; import { useMe, useSettings } from "@/api/hooks/reads"; import { profileStrings } from "./strings"; import { SettingsForm } from "./SettingsForm"; import { ConnectedBanks } from "./ConnectedBanks"; /** The Миний (profile) tab hub: account summary, hide-amounts toggle, * entries into Categories/Subscriptions (their own routes) and Settings * (rendered inline, no dedicated route), the read-only connected-banks list, * and logout. Ports `ProfileView.swift`'s layout minus bank connect/disconnect * (mobile-only per the Task 13 brief) and the not-yet-wired static rows * (Шинэ мэдээ / Түгээмэл асуултууд / Санал хүсэлт / Үйлчилгээний нөхцөл). */ export function ProfileView() { const router = useRouter(); const { data: me } = useMe(); const { data: settings } = useSettings(); const [showSettings, setShowSettings] = React.useState(false); const [loggingOut, setLoggingOut] = React.useState(false); const emailLocal = me?.email ? me.email.split("@")[0] : ""; const displayName = settings?.holderName || emailLocal || me?.email || ""; const initial = (displayName || me?.email || "?").trim().charAt(0).toUpperCase() || "?"; async function handleLogout() { setLoggingOut(true); try { await fetch("/api/auth/logout", { method: "POST", credentials: "same-origin" }); } finally { router.push("/login"); } } if (showSettings) { return setShowSettings(false)} />; } return (

{profileStrings.header.title}

{initial}
{displayName} {me?.email && ( {me.email} )}
{profileStrings.display.themeMode} {profileStrings.logout}
); } const menuRowStyle: React.CSSProperties = { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12, width: "100%", padding: "10px 0", background: "none", border: "none", cursor: "pointer", font: "inherit", color: "inherit", textAlign: "left", textDecoration: "none", }; function MenuRowContent({ icon, label }: { icon: IconName; label: string }) { return ( <>
{label}
); } function MenuRow({ icon, label, onClick }: { icon: IconName; label: string; onClick: () => void }) { return ( ); } function MenuLink({ icon, label, href }: { icon: IconName; label: string; href: string }) { return ( ); }