"use client"; import { createContext, useCallback, useContext, useMemo, useState } from "react"; type Ctx = { open: boolean; toggle: () => void; close: () => void }; const C = createContext(null); export function QueuePanelProvider({ children }: { children: React.ReactNode }) { const [open, setOpen] = useState(false); const toggle = useCallback(() => setOpen((o) => !o), []); const close = useCallback(() => setOpen(false), []); const value = useMemo(() => ({ open, toggle, close }), [open, toggle, close]); return {children}; } export function useQueuePanel() { const ctx = useContext(C); if (!ctx) throw new Error("useQueuePanel must be used within QueuePanelProvider"); return ctx; }