"use client"; // Top navigation bar for the /trade-in/v2 "МЕРА Оценка" design port. // Faithful markup port of the design header (МЕРА Оценка.dc.html, lines 42-90): // inline SVG logo + version + 5 nav tabs (active underline/triangle) + user menu. // Tabs change only local UI state via onNavigate; the user dropdown owns its // own useState. No data fetching — labels/version come from fixtures, the user // identity is fed in from the page (real useMe), colours from tokens. import { useState } from "react"; import type { CSSProperties } from "react"; import { tokens } from "./tokens"; import { navLabels, version } from "./fixtures"; // Real logged-in user identity, derived by the page from useMe() // ({username, role, brand}). Deliberately excludes `reports` — the «Мои // отчёты» badge count is a separate prop fed from useQuota().used. interface TopNavUser { name: string; org: string; email: string; initials: string; } interface TopNavProps { active: number; onNavigate: (i: number) => void; // «Мои отчёты» badge count — page feeds it from useQuota().used (per-user // estimate count). Defaults to 0 for unwired usage. reports?: number; // Real logged-in user. undefined → neutral «Гость» placeholder, NEVER the // old design fixture ("Андрей Петров / Брусника"). user?: TopNavUser; // Sign out — page wires this to logout(); closes the menu first. onLogout?: () => void; } // Neutral fallback when the user prop is absent (loading / unauthenticated). const GUEST_USER: TopNavUser = { name: "Гость", org: "—", email: "—", initials: "—", }; const menuItemStyle: CSSProperties = { display: "flex", alignItems: "center", gap: "10px", padding: "9px 10px", borderRadius: "6px", cursor: "pointer", fontSize: "12.5px", color: tokens.body, transition: "background .12s", }; // Профиль / Настройки / Помощь have no pages yet — render them dimmed and // non-interactive (no hover class, default cursor) so they read as disabled. const menuItemDisabledStyle: CSSProperties = { ...menuItemStyle, cursor: "default", color: tokens.muted2, }; export default function TopNav({ active, onNavigate, reports = 0, user, onLogout, }: TopNavProps) { const [userOpen, setUserOpen] = useState(false); const u = user ?? GUEST_USER; return ( <>