import Konva from "konva"; import type { EditorObject } from "../../store/editorStore"; import { RectangleShape, CircleShape, TriangleShape, AbstractShape, TextShape, LineShape, ArrowShape, ImageObject, LinkShape, VideoShape, } from "../tools"; import Table from "@/components/Table"; type ObjectRendererProps = { obj: EditorObject; isSelected: boolean; transformerRef: React.RefObject; layerRef: React.RefObject; onSelect: (id: string, node: Konva.Node) => void; onUpdate: (id: string, updates: Partial) => void; draggable: boolean; onCellClick?: (tableId: string, cellId: string) => void; onCellDblClick?: (tableId: string, cellId: string, x: number, y: number, width: number, height: number, text: string) => void; selectedCellId?: string | null; }; const ObjectRenderer = ({ obj, isSelected, transformerRef, layerRef, onSelect, onUpdate, draggable, onCellClick, onCellDblClick, selectedCellId, }: ObjectRendererProps) => { if (obj.visible === false) { return null; } const commonProps = { obj, isSelected, transformerRef, onSelect, onUpdate, draggable, }; switch (obj.type) { case "rectangle": if (obj.shapeType === "circle") { return ; } if (obj.shapeType === "triangle") { return ; } if (obj.shapeType === "abstract") { return ; } return ; case "text": return ; case "line": return ; case "arrow": return ; case "image": return ; case "link": return ; case "video": return ; case "document": return ; case "grid": return ( { onSelect(tableId, node); onCellClick?.(tableId, cellId); }} onCellDblClick={(tableId, cellId, x, y, width, height, text) => { onCellDblClick?.(tableId, cellId, x, y, width, height, text); }} onDragEnd={(tableId, x, y) => { onUpdate(tableId, { x, y }); }} draggable={draggable} /> ); default: return null; } }; export default ObjectRenderer;