"use client"; import { useEffect, useRef } from "react"; import { useHydrated } from "@/components/ui/use-hydrated"; import { cn } from "@/lib/utils"; import { SheetHead, closeSheet, openSheet, useSheetFrame, useSheetOpen } from "./Sheet"; // --------------------------------------------------------------------------- // A list's filter chips, which are two things in ONE element (as the page's // actions are, PageActions.tsx): // - the desk: the chip groups in the toolbar, exactly as they were -- the // wrapper is `display: contents`, so they stay the toolbar's own items; // - a phone: one summary line -- "Active · any stage · any kind — 77" -- that // opens them in a bottom sheet, with "Show N" to close it. // The chips are links, so a choice re-renders the page under the sheet and the // sheet stays open for the next one; the summary and the count follow. // --------------------------------------------------------------------------- export default function FilterSheet({ id = "filters", summary, count, children }: { id?: string; summary: string; count: number; children: React.ReactNode }) { const hydrated = useHydrated(); const open = useSheetOpen(id); const panel = useRef(null); const close = () => closeSheet(id); useSheetFrame(open, close, panel); // A soft navigation to another page leaves no sheet open behind it. useEffect(() => () => closeSheet(id), [id]); return ( <> {open &&