"use client"; import { useTranslations } from "next-intl"; import { signOut, useSession } from "next-auth/react"; import { usePathname } from "@/i18n/navigation"; import { Link } from "@/i18n/navigation"; import { SessionProvider } from "next-auth/react"; import { LanguageSwitcher } from "@/components/ui/language-switcher"; function NavBar() { const t = useTranslations("common"); const { data: session } = useSession(); const pathname = usePathname(); const user = (session as any)?.platformUser; const isLogin = pathname === "/login"; if (isLogin) return null; return (
{/* Logo / brand */}
{/* Geometric mark */}
{t("appName")} {t("tagline")} {/* Nav links */}
{/* Right side */}
{user && ( // For personal accounts the orgName is opaque // ("personal-3f2a8b1c") or a synthetic legacy // "Name (Personal)" — neither is what we want in the nav. // Show the user's display name instead. The detection logic // and fallback chain live in `lib/personal-org.ts`; keeping // a thin inline branch here avoids importing a server-only // helper into a client component. {user.isPersonal ? user.name || (user.email ? user.email.split("@")[0] : user.orgName) : user.orgName} )}
); } function NavLink({ href, active, children, }: { href: string; active: boolean; children: React.ReactNode; }) { return ( {children} ); } export function NavShell({ children }: { children: React.ReactNode }) { return (
{children}
); }