fix empty popups
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
import { onDestroy } from 'svelte';
|
import { onDestroy } from 'svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
end: Date,
|
end: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { end }: Props = $props();
|
let { end }: Props = $props();
|
||||||
|
|||||||
@@ -5,16 +5,22 @@
|
|||||||
// html bindings
|
// html bindings
|
||||||
let modal: HTMLDialogElement;
|
let modal: HTMLDialogElement;
|
||||||
|
|
||||||
|
// state
|
||||||
|
let closeTimeoutId = $state(-1);
|
||||||
|
|
||||||
// lifecycle
|
// lifecycle
|
||||||
const cancel = confirmPopupState.subscribe((value) => {
|
const cancel = confirmPopupState.subscribe((value) => {
|
||||||
if (value) modal.show();
|
if (!value) return;
|
||||||
|
|
||||||
|
clearTimeout(closeTimeoutId);
|
||||||
|
modal.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
onDestroy(cancel);
|
onDestroy(cancel);
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
function onModalClose() {
|
function onModalClose() {
|
||||||
setTimeout(() => ($confirmPopupState = null), 300);
|
closeTimeoutId = setTimeout(() => ($confirmPopupState = null), 300);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,15 @@
|
|||||||
// html bindings
|
// html bindings
|
||||||
let modal: HTMLDialogElement;
|
let modal: HTMLDialogElement;
|
||||||
|
|
||||||
|
// state
|
||||||
|
let closeTimeoutId = $state(-1);
|
||||||
|
|
||||||
// lifecycle
|
// lifecycle
|
||||||
const cancel = popupState.subscribe((value) => {
|
const cancel = popupState.subscribe((value) => {
|
||||||
if (value) modal.show();
|
if (!value) return;
|
||||||
|
|
||||||
|
clearTimeout(closeTimeoutId);
|
||||||
|
modal.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
onDestroy(cancel);
|
onDestroy(cancel);
|
||||||
|
|||||||
Reference in New Issue
Block a user