File size: 1,244 Bytes
6ce4ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3cdf7b9
6ce4ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<script lang="ts">
	import type { Robot } from "$lib/elements/robot/Robot.svelte.js";
	import { Container } from "threlte-uikit";
	import { StatusArrow } from "$lib/components/3d/ui";
	import InputBoxUIKit from "./InputBoxUIKit.svelte";
	import RobotBoxUIKit from "./RobotBoxUIKit.svelte";
	import OutputBoxUIKit from "./OutputBoxUIKit.svelte";

	interface Props {
		robot: Robot;
		onInputBoxClick: (robot: Robot) => void;
		onRobotBoxClick: (robot: Robot) => void;
		onOutputBoxClick: (robot: Robot) => void;
	}

	let { robot, onInputBoxClick, onRobotBoxClick, onOutputBoxClick }: Props = $props();

	const inputColor = "rgb(34, 197, 94)";
	const outputColor = "rgb(59, 130, 246)";
</script>

<Container flexDirection="row" alignItems="center" gap={12}>
	<!-- Input Box -->
	<InputBoxUIKit {robot} {onInputBoxClick} />

	<!-- Arrow 1: Input to Robot -->
	<StatusArrow direction="right" color={inputColor} opacity={robot.hasConsumer ? 1 : 0.5} />

	<!-- Robot Box -->
	<RobotBoxUIKit {robot} {onRobotBoxClick} />

	<!-- Arrow 2: Robot to Outputs -->
	<StatusArrow
		direction="right"
		color={outputColor}
		opacity={robot.outputDriverCount > 0 ? 1 : 0.5}
	/>

	<!-- Outputs Box -->
	<OutputBoxUIKit {robot} {onOutputBoxClick} />
</Container>