2026-03-15 08:55:13 +07:00
|
|
|
import React from 'react';
|
Add backend and frontend test suites for Arduino compilation and simulation
- Implemented a comprehensive backend test suite in `test_compilation.py` to validate the Arduino CLI installation, AVR core presence, compilation service, and API endpoint functionality.
- Created a frontend test suite in `simulation.test.ts` to test the `PinManager` and `AVRSimulator` components, ensuring proper functionality and integration.
- Introduced new components for wire management in the simulator, including `PinOverlay`, `WireInProgressRenderer`, `WireLayer`, and `WireRenderer`, enhancing the visual wiring system.
- Developed utility functions for pin position calculations and wire color management, ensuring accurate connections and visual representation.
- Added types for wire management in `wire.ts`, defining structures for wire endpoints, control points, and signal types.
2026-03-04 02:44:07 +07:00
|
|
|
import { useSimulatorStore } from '../../store/useSimulatorStore';
|
|
|
|
|
import { WireRenderer } from './WireRenderer';
|
|
|
|
|
import { WireInProgressRenderer } from './WireInProgressRenderer';
|
|
|
|
|
|
2026-03-15 08:55:13 +07:00
|
|
|
interface WireLayerProps {
|
|
|
|
|
hoveredWireId: string | null;
|
|
|
|
|
wireDragPreview: { wireId: string; waypoints: { x: number; y: number }[] } | null;
|
|
|
|
|
}
|
2026-03-05 04:03:54 +07:00
|
|
|
|
2026-03-15 08:55:13 +07:00
|
|
|
export const WireLayer: React.FC<WireLayerProps> = ({ hoveredWireId, wireDragPreview }) => {
|
|
|
|
|
const wires = useSimulatorStore((s) => s.wires);
|
|
|
|
|
const wireInProgress = useSimulatorStore((s) => s.wireInProgress);
|
|
|
|
|
const selectedWireId = useSimulatorStore((s) => s.selectedWireId);
|
2026-03-05 04:03:54 +07:00
|
|
|
|
Add backend and frontend test suites for Arduino compilation and simulation
- Implemented a comprehensive backend test suite in `test_compilation.py` to validate the Arduino CLI installation, AVR core presence, compilation service, and API endpoint functionality.
- Created a frontend test suite in `simulation.test.ts` to test the `PinManager` and `AVRSimulator` components, ensuring proper functionality and integration.
- Introduced new components for wire management in the simulator, including `PinOverlay`, `WireInProgressRenderer`, `WireLayer`, and `WireRenderer`, enhancing the visual wiring system.
- Developed utility functions for pin position calculations and wire color management, ensuring accurate connections and visual representation.
- Added types for wire management in `wire.ts`, defining structures for wire endpoints, control points, and signal types.
2026-03-04 02:44:07 +07:00
|
|
|
return (
|
|
|
|
|
<svg
|
|
|
|
|
className="wire-layer"
|
|
|
|
|
style={{
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0,
|
|
|
|
|
width: '100%',
|
|
|
|
|
height: '100%',
|
2026-03-15 08:55:13 +07:00
|
|
|
overflow: 'visible',
|
|
|
|
|
pointerEvents: 'none',
|
|
|
|
|
zIndex: 1,
|
Add backend and frontend test suites for Arduino compilation and simulation
- Implemented a comprehensive backend test suite in `test_compilation.py` to validate the Arduino CLI installation, AVR core presence, compilation service, and API endpoint functionality.
- Created a frontend test suite in `simulation.test.ts` to test the `PinManager` and `AVRSimulator` components, ensuring proper functionality and integration.
- Introduced new components for wire management in the simulator, including `PinOverlay`, `WireInProgressRenderer`, `WireLayer`, and `WireRenderer`, enhancing the visual wiring system.
- Developed utility functions for pin position calculations and wire color management, ensuring accurate connections and visual representation.
- Added types for wire management in `wire.ts`, defining structures for wire endpoints, control points, and signal types.
2026-03-04 02:44:07 +07:00
|
|
|
}}
|
|
|
|
|
>
|
2026-03-15 08:55:13 +07:00
|
|
|
{wires.map((wire) => (
|
Add backend and frontend test suites for Arduino compilation and simulation
- Implemented a comprehensive backend test suite in `test_compilation.py` to validate the Arduino CLI installation, AVR core presence, compilation service, and API endpoint functionality.
- Created a frontend test suite in `simulation.test.ts` to test the `PinManager` and `AVRSimulator` components, ensuring proper functionality and integration.
- Introduced new components for wire management in the simulator, including `PinOverlay`, `WireInProgressRenderer`, `WireLayer`, and `WireRenderer`, enhancing the visual wiring system.
- Developed utility functions for pin position calculations and wire color management, ensuring accurate connections and visual representation.
- Added types for wire management in `wire.ts`, defining structures for wire endpoints, control points, and signal types.
2026-03-04 02:44:07 +07:00
|
|
|
<WireRenderer
|
|
|
|
|
key={wire.id}
|
|
|
|
|
wire={wire}
|
|
|
|
|
isSelected={wire.id === selectedWireId}
|
2026-03-15 08:55:13 +07:00
|
|
|
isHovered={wire.id === hoveredWireId}
|
|
|
|
|
previewWaypoints={
|
|
|
|
|
wireDragPreview?.wireId === wire.id ? wireDragPreview.waypoints : undefined
|
|
|
|
|
}
|
Add backend and frontend test suites for Arduino compilation and simulation
- Implemented a comprehensive backend test suite in `test_compilation.py` to validate the Arduino CLI installation, AVR core presence, compilation service, and API endpoint functionality.
- Created a frontend test suite in `simulation.test.ts` to test the `PinManager` and `AVRSimulator` components, ensuring proper functionality and integration.
- Introduced new components for wire management in the simulator, including `PinOverlay`, `WireInProgressRenderer`, `WireLayer`, and `WireRenderer`, enhancing the visual wiring system.
- Developed utility functions for pin position calculations and wire color management, ensuring accurate connections and visual representation.
- Added types for wire management in `wire.ts`, defining structures for wire endpoints, control points, and signal types.
2026-03-04 02:44:07 +07:00
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
|
|
{wireInProgress && (
|
|
|
|
|
<WireInProgressRenderer wireInProgress={wireInProgress} />
|
|
|
|
|
)}
|
|
|
|
|
</svg>
|
|
|
|
|
);
|
|
|
|
|
};
|