"use client"; import { AccountMenu } from "@bitbaum/accountkit"; import { useTranslations } from "next-intl"; import { Link } from "@/i18n/navigation"; import { ROUTES } from "@/lib/routes"; /** * The fleet's one account menu (@bitbaum/accountkit), with Causius's places. * Sign-in is a link to OrangeCat's one screen; sign-out a server action passed * in, so this file holds no auth logic of its own. */ export function AccountControl({ user, signInHref, signOutAction, fleet, }: { user: { name?: string | null; image?: string | null } | null; /** //sign-in?from=… — a plain link, see lib/auth/entry.ts. */ signInHref: string; signOutAction: () => Promise; /** The other fleet products this one account opens, from the fleet map. */ fleet: { slug: string; name: string; url: string }[]; }) { const t = useTranslations("Account"); if (!user) { return ( {t("signIn")} ); } return ( ({ id: p.slug, label: t("openIn", { name: p.name }), href: p.url })) }] : []), ]} onSignOut={() => signOutAction()} renderLink={({ href, children, ...rest }) => href.startsWith("https://") ? ( {children} ) : ( {children} ) } labels={{ // A template: the menu fills {name} itself, so it is passed unformatted. trigger: t.raw("trigger") as string, menu: t("menu"), signOut: t("signOut"), signingOut: t("signingOut"), signOutFailed: t("signOutFailed"), }} /> ); }