🐛 Updates svelte-modals

This commit is contained in:
Rune Harlyk
2025-03-01 22:49:46 +01:00
committed by Rune Harlyk
parent 788f4ffea3
commit 0b01634a20
13 changed files with 230 additions and 240 deletions
@@ -1,28 +1,28 @@
<script lang="ts">
import { useFeatureFlags } from '$lib/stores';
import { closeModal, openModal } from 'svelte-modals';
import { useFeatureFlags } from '$lib/stores';
import { closeModal, openModal } from 'svelte-modals/legacy';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
import { api } from '$lib/api';
import { Cancel, Power } from '../icons';
import { api } from '$lib/api';
import { Cancel, Power } from '../icons';
const features = useFeatureFlags();
const postSleep = async () => await api.post('/api/system/sleep');
const confirmSleep = () => {
openModal(ConfirmDialog, {
title: 'Confirm Power Down',
message: 'Are you sure you want to switch off the device?',
labels: {
cancel: { label: 'Abort', icon: Cancel },
confirm: { label: 'Switch Off', icon: Power }
},
onConfirm: () => {
closeModal();
postSleep();
}
});
}
openModal(ConfirmDialog, {
title: 'Confirm Power Down',
message: 'Are you sure you want to switch off the device?',
labels: {
cancel: { label: 'Abort', icon: Cancel },
confirm: { label: 'Switch Off', icon: Power }
},
onConfirm: () => {
closeModal();
postSleep();
}
});
};
</script>
{#if $features.sleep}
@@ -31,4 +31,4 @@
<Power class="text-error h-9 w-9" />
</button>
</div>
{/if}
{/if}
@@ -1,6 +1,6 @@
<script lang="ts">
import { page } from '$app/stores';
import { openModal, closeAllModals } from 'svelte-modals';
import { openModal, closeAllModals } from 'svelte-modals/legacy';
import { notifications } from '$lib/components/toasts/notifications';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';