mirror of
https://github.com/wukko/cobalt.git
synced 2025-04-29 22:14:26 +02:00
web/SmallDialog: add error haptics to error popups
This commit is contained in:
parent
a2e08b9ccb
commit
7e71701e10
@ -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>
|
||||
|
@ -33,3 +33,11 @@ export const hapticConfirm = () => {
|
||||
hapticSwitch();
|
||||
setTimeout(() => hapticSwitch(), 120);
|
||||
}
|
||||
|
||||
export const hapticError = () => {
|
||||
if (!canUseHaptics()) return;
|
||||
|
||||
hapticSwitch();
|
||||
setTimeout(() => hapticSwitch(), 120);
|
||||
setTimeout(() => hapticSwitch(), 240);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user