|
2 | 2 | import { onMount } from 'svelte'; |
3 | 3 | import '@xyflow/svelte/dist/style.css'; |
4 | 4 | import type { Node, Edge, NodeTypes } from '@xyflow/svelte'; |
5 | | -
|
6 | 5 | import {Logs, VaultNode} from '$lib/fragments'; |
7 | 6 | import { HugeiconsIcon } from '@hugeicons/svelte'; |
8 | 7 | import { PauseFreeIcons, PlayFreeIcons } from '@hugeicons/core-free-icons'; |
9 | | - import {ButtonAction} from '$lib/ui'; |
| 8 | + import {ButtonAction, Checkbox} from '$lib/ui'; |
| 9 | + import { Modal } from 'flowbite-svelte'; |
10 | 10 | |
11 | 11 |
|
12 | 12 | let SvelteFlowComponent: typeof import('@xyflow/svelte').SvelteFlow | null = $state(null); |
|
16 | 16 | }; |
17 | 17 |
|
18 | 18 | let isPaused = $state(false); |
19 | | - let modal: HTMLDialogElement | undefined = $state(); |
| 19 | + let isModalOpen= $state(false); |
| 20 | + let selectedVaults = $state([]); |
20 | 21 |
|
21 | 22 | let nodes: Node[] = $state([ |
22 | 23 | { |
|
117 | 118 | from: 'Pic' |
118 | 119 | } |
119 | 120 | ]; |
120 | | -
|
| 121 | + |
| 122 | + let vaults = [ |
| 123 | + { id: 'vault-1', name: 'Personal Documents', sublabel: 'Important files' }, |
| 124 | + { id: 'vault-2', name: 'Family Photos', sublabel: 'Cherished memories' }, |
| 125 | + { id: 'vault-3', name: 'Work Projects', sublabel: 'Current tasks and files' }, |
| 126 | + { id: 'vault-4', name: 'Archived Data', sublabel: 'Old projects and backups' }, |
| 127 | + ]; |
| 128 | + |
121 | 129 | onMount(async () => { |
122 | 130 | const mod = await import('@xyflow/svelte'); |
123 | 131 | SvelteFlowComponent = mod.SvelteFlow; |
|
129 | 137 | <div class="w-full flex justify-between items-center p-4 bg-white shadow-sm z-10"> |
130 | 138 | <h4 class="text-xl text-gray-800 font-semibold">Live Monitoring</h4> |
131 | 139 | <div class="flex gap-2"> |
132 | | - <ButtonAction class="w-[max-content]" variant="soft" size="sm" callback={() => {modal?.show()}}>Add Vault</ButtonAction> |
| 140 | + <ButtonAction class="w-[max-content]" variant="soft" size="sm" callback={() => {isModalOpen = !isModalOpen}}>Add Vault</ButtonAction> |
133 | 141 | <button |
134 | 142 | onclick={() => isPaused = !isPaused} |
135 | 143 | class="px-4 py-2 flex items-center gap-2 text-base font-geist font-medium text-gray-700 bg-white border border-[#e5e5e5] rounded-full shadow-md hover:bg-gray-50 transition-colors" |
|
157 | 165 | <div class="flex-grow flex justify-center items-center text-gray-700">Loading flow chart...</div> |
158 | 166 | {/if} |
159 | 167 | </div> |
160 | | - <Logs class="w-[40%]" {events} bind:activeEventIndex={currentSelectedEventIndex} /> |
| 168 | + <Logs class="w-[40%]" {events} bind:activeEventIndex={currentSelectedEventIndex}/> |
161 | 169 | </section> |
162 | 170 |
|
| 171 | +<Modal bind:open={isModalOpen} class="absolute top-[50%] start-[50%] translate-x-[-50%] translate-y-[-50%] max-w-[30vw] w-full p-4" closeBtnClass="fixed end-4 top-4"> |
| 172 | + <h4 class="text-primary mb-2">Search vaults</h4> |
| 173 | + <input type="search" value="" placeholder="Please search to vaults to add" class="w-full border-transparent outline-transparent bg-gray rounded-4xl py-3 px-4 font-geist text-black text-base"> |
| 174 | + |
| 175 | + <ul class="mt-4"> |
| 176 | + {#each vaults as vault (vault.id)} |
| 177 | + <li class="flex items-center gap-4 px-4 py-1 mb-2 rounded-2xl bg-gray hover:bg-gray-200"> |
| 178 | + <input id={vault.id} type="checkbox" value={vault.id} bind:group={selectedVaults}> |
| 179 | + |
| 180 | + <label for={vault.id} class="cursor-pointer"> |
| 181 | + <p>{vault.name}</p> |
| 182 | + <p class="small">{vault.sublabel}</p> |
| 183 | + </label> |
| 184 | + </li> |
| 185 | + {/each} |
| 186 | + </ul> |
| 187 | +</Modal> |
163 | 188 |
|
164 | 189 | <style> |
165 | 190 | /* |
|
0 commit comments