'use client'; import { Fragment } from 'react'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; import type { FloatingAction } from '@/lib/edit/scene-editor-surface'; interface FloatingToolbarProps { readonly actions: readonly FloatingAction[]; } /** * Contextual mini-bar shown above the canvas when something is selected. * Each action is either a button (onInvoke) or a popover trigger * (popoverContent) — used by the slide surface for color pickers, font * select, etc. so properties live here instead of in a fixed right panel. */ export function FloatingToolbar({ actions }: FloatingToolbarProps) { if (actions.length === 0) return null; const grouped = groupByGroup(actions); return (
{grouped.map((group, groupIndex) => ( {groupIndex > 0 &&
} {group.map((action) => ( ))} ))}
); } function ActionButton({ action }: { readonly action: FloatingAction }) { const isDanger = action.id === 'delete'; const button = ( ); const triggerWithTooltip = ( {button} {action.tooltip ?? action.label} ); if (!action.popoverContent) return triggerWithTooltip; // Chain both triggers' asChild Slots directly onto the real