diff --git a/app/diagram/page.tsx b/app/diagram/page.tsx index c5d3eaf..b4d6ea1 100644 --- a/app/diagram/page.tsx +++ b/app/diagram/page.tsx @@ -12,5 +12,21 @@ import ComponentSidebar from '@/components/diagram/ComponentSidebar' export default function DiagramPage() { const [selectedId, setSelectedId] = useState(null) - return
This is the Diagram page
+ return ( +
+
+
+ + +
+ +
+
+ ) } diff --git a/components/diagram/CADiagram.tsx b/components/diagram/CADiagram.tsx index 9b83c7a..2d5c3c5 100644 --- a/components/diagram/CADiagram.tsx +++ b/components/diagram/CADiagram.tsx @@ -10,6 +10,195 @@ interface CADiagramProps { onSelect: (id: string | null) => void } +const CANVAS_WIDTH = 920 +const CANVAS_HEIGHT = 560 + +const LAYER_BOUNDS = { + 'frameworks-drivers': { x: 36, y: 36, width: 848, height: 488 }, + 'interface-adapters': { x: 60, y: 76, width: 800, height: 408 }, + 'application-business-rules': { x: 84, y: 116, width: 752, height: 328 }, + 'enterprise-business-rules': { x: 108, y: 156, width: 704, height: 248 }, +} as const + +interface ContainerSvgProps { + x: number + y: number + width: number + height: number + fill: string + stroke: string + shadowId: string +} + +function OuterContainerSvg() { + return ( + + + + + + + + + ) +} + +function LayerContainerSvg({ + x, + y, + width, + height, + fill, + stroke, + shadowId, +}: ContainerSvgProps) { + return ( + + ) +} + +function FrameworksContainerSvg() { + return ( + + ) +} + +function InterfaceAdaptersContainerSvg() { + return ( + + ) +} + +function ApplicationBusinessRulesContainerSvg() { + return ( + + ) +} + +function EnterpriseBusinessRulesContainerSvg() { + return ( + + ) +} + export default function CADiagram({ selectedId, onSelect }: CADiagramProps) { - return
onSelect(null)}>
+ const selectedComponent = CA_COMPONENTS.find((component) => component.id === selectedId) ?? null + const selectedLayer = selectedComponent ? CA_LAYERS[selectedComponent.layer] : null + const selectedBounds = selectedComponent ? LAYER_BOUNDS[selectedComponent.layer] : null + + return ( +
onSelect(null)} + style={{ + position: 'relative', + width: '100%', + maxWidth: `${CANVAS_WIDTH}px`, + aspectRatio: `${CANVAS_WIDTH} / ${CANVAS_HEIGHT}`, + margin: '0 auto', + }} + > + + + + + + {selectedLayer && selectedBounds ? ( + + ) : null} +
+ ) }