File size: 1,514 Bytes
6ce4ca6
 
3165745
6ce4ca6
 
 
3165745
6ce4ca6
 
 
 
 
 
3cdf7b9
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
43
44
45
46
47
<script lang="ts">
	import { useThrelte } from "@threlte/core";
	import { videoManager } from "$lib/elements/video/VideoManager.svelte";
	import { onMount } from "svelte";
	import VideoInputConnectionModal from "@/components/3d/elements/video/modal/VideoInputConnectionModal.svelte";
	import VideoOutputConnectionModal from "@/components/3d/elements/video/modal/VideoOutputConnectionModal.svelte";
	import type { VideoInstance } from "$lib/elements/video/VideoManager.svelte";
	import { generateName } from "$lib/utils/generateName";
	import VideoGridItem from "@/components/3d/elements/video/VideoGridItem.svelte";

	interface Props {
		workspaceId: string;
	}
	let { workspaceId }: Props = $props();

	// Modal state
	let isInputModalOpen = $state(false);
	let isOutputModalOpen = $state(false);
	let selectedVideo = $state<VideoInstance | null>(null);

	// Modal helpers
	function onInputBoxClick(video: VideoInstance) {
		selectedVideo = video;
		isInputModalOpen = true;
	}
	function onOutputBoxClick(video: VideoInstance) {
		selectedVideo = video;
		isOutputModalOpen = true;
	}
</script>

{#each videoManager.videos as video (video.id)}
	<VideoGridItem
		{video}
		{workspaceId}
		onCameraMove={() => {}}
		{onInputBoxClick}
		{onOutputBoxClick}
	/>
{/each}

<!-- Connection Modals -->
{#if selectedVideo}
	<VideoInputConnectionModal bind:open={isInputModalOpen} video={selectedVideo} {workspaceId} />
	<VideoOutputConnectionModal bind:open={isOutputModalOpen} video={selectedVideo} {workspaceId} />
{/if}