"use client"; import { CountBadge } from "@suphark/ui/components/shared/count-badge"; import { useUiText } from "@suphark/ui/components/shared/ui-text"; import { cn } from "@suphark/ui/lib/utils"; import Link from "next/link"; import { usePathname } from "next/navigation"; import type { ReactNode } from "react"; import { isNavActive } from "./types"; export interface MobileTabItem { /** ปลายทาง — ไม่ต้องใส่เมื่อเป็นแท็บคำสั่ง (`action` / `onClick`) */ href?: string; label: string; /** element เช่น `` (ไม่ใช่ component) — ส่งจาก server layout ได้เหมือน AppNav */ icon: ReactNode; /** ตัวเลขบนไอคอน (เช่นแจ้งเตือนค้าง) — 0/undefined ไม่แสดง */ badge?: number; /** สีของ badge (ค่าเริ่มต้น `destructive` แดง) — `muted` สำหรับจำนวนที่ไม่เร่งด่วน (เช่นงานที่ยังไม่จัด) */ badgeTone?: "destructive" | "primary" | "muted"; /** ไฮไลต์เฉพาะ path ตรงตัว (ค่าเริ่มต้น: href "/" ตรงตัว, อื่น ๆ prefix) */ exact?: boolean; /** กดแล้วทำ action แทนการไปหน้า (เช่นเปิด sheet แจ้งเตือน) */ onClick?: () => void; /** * `"sidebar"` = แท็บ "เมนู" ที่เปิด sidebar (แผ่นเลื่อนของ `AppShell layout="sidebar"`) — ส่งจาก server layout ได้ * (ฟังก์ชันส่งข้าม boundary ไม่ได้ และ `useSidebar()` เรียกนอก AppShell ไม่ได้) · ใช้ได้เฉพาะใน `AppShell` แบบ sidebar * (layout top / วาง `MobileTabBar` เอง = ไม่แสดงแท็บนี้) */ action?: "sidebar"; } /** * แถบเมนูล่างสำหรับมือถือ (ยกจาก DueBell `MobileNav`) — ซ่อนตั้งแต่ md, เผื่อ safe-area ของ iPhone, * แท็บละ ≥ 44px ตามเกณฑ์จอสัมผัส; ใช้ผ่าน `AppShell mobileTabs` (เว้นที่ใต้เนื้อหาให้เอง) * หรือวางเองแล้วใส่ `pb-[calc(4rem+env(safe-area-inset-bottom))] md:pb-0` ให้เนื้อหา * ควรมี 3–5 แท็บ — เกินนั้นให้ใช้เมนู sidebar */ export function MobileTabBar({ items, className, "aria-label": ariaLabel, }: { items: ReadonlyArray; className?: string; "aria-label"?: string; }) { const pathname = usePathname(); const text = useUiText(); return ( ); }