import { type ReactNode, type CSSProperties } from "react"; import { useTranslation } from "react-i18next"; import { ChevronDown, Eye, EyeOff, GripVertical } from "lucide-react"; import { useSortable } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; // One collapsible "island" card inside a SidePanel: a titled glass-card with per-group collapse, // and — in the panel's edit mode — a drag handle (reorder) and a hide toggle. Generalized from // the feed sidebar's WidgetCard so all three panels share the same island look and behavior. export default function PanelGroup({ id, title, editing, collapsed, hidden, onToggleCollapse, onToggleHidden, children, }: { id: string; title: string; editing: boolean; collapsed: boolean; hidden: boolean; onToggleCollapse: () => void; onToggleHidden: () => void; children: ReactNode; }) { const { t } = useTranslation(); const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id, disabled: !editing, }); const style: CSSProperties = { transform: CSS.Transform.toString(transform), transition }; const showBody = !editing && !collapsed; return (
{editing && ( )} {editing ? ( ) : ( )}
{showBody &&
{children}
}
); }