"use client"; import { ChevronRight } from "lucide-react"; import Link from "next/link"; import type React from "react"; import { useCallback, useEffect, useState } from "react"; import { Button } from "@/components/ui/button"; import { Drawer, DrawerContent, DrawerHandle, DrawerTitle, DrawerTrigger, } from "@/components/ui/drawer"; import { Separator } from "@/components/ui/separator"; import { cn } from "@/lib/utils"; export interface RoutedSectionItem { value: string; label: string; href: string; icon?: React.ReactNode; } export interface RoutedSectionGroup { value: string; label: string; icon?: React.ReactNode; items: RoutedSectionItem[]; } interface RoutedSectionShellProps { title: string; items: RoutedSectionItem[]; activeValue: string; selectedLabel: string; children: React.ReactNode; groups?: RoutedSectionGroup[]; mobileNav?: "scroll" | "drawer"; contentClassName?: string; } function findActiveGroupValue(groups: RoutedSectionGroup[], activeValue: string): string | null { return ( groups.find((group) => group.items.some((item) => item.value === activeValue))?.value ?? null ); } function SectionNavLink({ item, activeValue, onNavigate, }: { item: RoutedSectionItem; activeValue: string; onNavigate?: () => void; }) { const isActive = activeValue === item.value; return ( {item.icon} {item.label} ); } function SectionNavGroup({ group, activeValue, isExpanded, onToggle, onNavigate, }: { group: RoutedSectionGroup; activeValue: string; isExpanded: boolean; onToggle: () => void; onNavigate?: () => void; }) { return (