|
16 | 16 | import EditMotionContent from "$lib/components/modals/EditMotionContent.svelte"; |
17 | 17 | import UniModal from "$lib/components/modals/UniModal.svelte"; |
18 | 18 | import MotionForm, { numSpeakersStr } from "$lib/components/motions/form/MotionForm.svelte"; |
19 | | - import { createSpeaker } from "$lib/components/SpeakerList.svelte"; |
20 | 19 | import { getSessionContext } from "$lib/context/index.svelte"; |
21 | 20 | import { findDelegate } from "$lib/db/delegates"; |
22 | 21 | import { db } from "$lib/db/index.svelte"; |
|
39 | 38 | const { motions, selectedMotion, selectedMotionState, delegates, sortOrder } = getSessionContext(); |
40 | 39 | const pid = $props.id(); |
41 | 40 |
|
42 | | - let openModals = $state({ |
43 | | - editMotion: -1 |
44 | | - }); |
| 41 | + let editMotionModal = $state({ open: false, index: -1 }); |
45 | 42 | // A clone of $motions used solely for use:dndzone |
46 | 43 | let dndItems = $derived(proxify($motions)); |
47 | 44 | |
|
210 | 207 | "data-dnd-dragging:preset-tonal-primary" |
211 | 208 | ]} |
212 | 209 | animate:flip={{ duration: 150 }} |
213 | | - ondblclick={() => openModals.editMotion = i} |
| 210 | + ondblclick={() => editMotionModal = { open: true, index: i }} |
214 | 211 | {...a11yLabel(`${delName}'s Motion`)} |
215 | 212 | > |
216 | 213 | <td>{motionName(motion)}</td> |
|
239 | 236 | </button> |
240 | 237 | <button |
241 | 238 | class="btn-icon-std p-1" |
242 | | - onclick={() => openModals.editMotion = i} |
| 239 | + onclick={() => editMotionModal = { open: true, index: i }} |
243 | 240 | {...a11yLabel(`Edit ${delName}'s Motion`)} |
244 | 241 | > |
245 | 242 | <MdiPencil /> |
|
255 | 252 | </div> |
256 | 253 | </div> |
257 | 254 | <UniModal |
258 | | - bind:open={ |
259 | | - () => openModals.editMotion >= 0, |
260 | | - open => { if (!open) openModals.editMotion = -1} |
261 | | - } |
262 | | - onSubmit={(m: Motion) => editMotion(openModals.editMotion, m)} |
| 255 | + bind:open={editMotionModal.open} |
| 256 | + onSubmit={(m: Motion) => editMotion(editMotionModal.index, m)} |
263 | 257 | > |
264 | 258 | {#snippet content(exitState)} |
265 | | - <EditMotionContent motion={$motions[openModals.editMotion]} {motionSchema} {exitState} /> |
| 259 | + <EditMotionContent motion={$motions[editMotionModal.index]} {motionSchema} {exitState} /> |
266 | 260 | {/snippet} |
267 | 261 | </UniModal> |
0 commit comments