import { useDroppable } from '@dnd-kit/core' import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable' import { EQUATION_PRESETS } from '../engine/equations.js' import { WorkspaceCard } from './VariableCard.jsx' export function Workspace({ workspaceVarIds, userValues, solved, onRemove, onValueChange, onAddPreset, onClear, getUnit, setUnit, sciNotation, areaRatioBranch, onToggleAreaRatioBranch, }) { const { setNodeRef, isOver } = useDroppable({ id: 'workspace' }) return (
{/* Equation preset bar */}
Presets: {EQUATION_PRESETS.map(preset => ( ))} {workspaceVarIds.length > 0 && ( )}
{/* Drop zone */}
{workspaceVarIds.length === 0 ? (
⚗️
{isOver ? 'Drop variable here' : 'Workspace is empty'}
Drag variables from the left panel, or click a preset above to get started. Enter known values — unknowns solve automatically.
) : (
{workspaceVarIds.map(varId => ( onRemove(varId)} onValueChange={val => onValueChange(varId, val)} getUnit={getUnit} onUnitChange={unitId => setUnit(varId, unitId)} sciNotation={sciNotation} areaRatioBranch={areaRatioBranch} onToggleBranch={onToggleAreaRatioBranch} /> ))} {/* Drop indicator card when dragging over a non-empty workspace */} {isOver && (
Drop here
)}
)}
) }