web/SmallDialog: add error haptics to error popups

This commit is contained in:
wukko 2025-03-05 22:19:08 +06:00
parent a2e08b9ccb
commit 7e71701e10
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2
2 changed files with 14 additions and 0 deletions

View File

@ -1,4 +1,5 @@
<script lang="ts">
import { hapticError } from "$lib/haptics";
import type { Optional } from "$lib/types/generic";
import type { MeowbaltEmotions } from "$lib/types/meowbalt";
import type { DialogButton, SmallDialogIcons } from "$lib/types/dialog";
@ -21,6 +22,11 @@
export let leftAligned = false;
let close: () => void;
// error meowbalt art is not used in dialogs unless it's an error
if (meowbalt === "error") {
hapticError();
}
</script>
<DialogContainer {id} {dismissable} bind:close>

View File

@ -33,3 +33,11 @@ export const hapticConfirm = () => {
hapticSwitch();
setTimeout(() => hapticSwitch(), 120);
}
export const hapticError = () => {
if (!canUseHaptics()) return;
hapticSwitch();
setTimeout(() => hapticSwitch(), 120);
setTimeout(() => hapticSwitch(), 240);
}