import Link from "next/link"; import { ChevronLeft, HeartHandshake, House, ShieldCheck, Stethoscope, UserRound } from "lucide-react"; import type { ReactNode } from "react"; import { getCaregiverUnreadIncomingCount } from "@/lib/caregiver-panel"; const navigationItems = [ { href: "/guard", label: "守护", icon: ShieldCheck }, { href: "/family", label: "家庭", icon: House }, { href: "/care", label: "照护", icon: Stethoscope }, { href: "/companion", label: "陪伴", icon: HeartHandshake }, { href: "/settings", label: "我的", icon: UserRound }, ]; function isActivePath(currentPath: string, href: string) { return currentPath === href || currentPath.startsWith(`${href}/`); } type PanelShellProps = { currentPath: string; title: string; description?: string; caregiverLabel: string; caregiverId?: string; children: ReactNode; actions?: ReactNode; backHref?: string; showTabs?: boolean; unreadCount?: number; }; export async function PanelShell({ currentPath, title, description, caregiverLabel, caregiverId, children, actions, backHref, showTabs = !backHref, unreadCount, }: PanelShellProps) { const initial = caregiverLabel.trim().slice(-1) || "安"; const resolvedUnreadCount = unreadCount ?? (showTabs && caregiverId ? await getCaregiverUnreadIncomingCount(caregiverId) : 0); return (
{backHref ? (

{title}

{actions}
) : (

{title}

{description ?

{description}

: null}
{actions ?? ( {initial} )}
)} {children}
{showTabs ? ( ) : null}
); }