refactor(contact): use CommonButtons @activate events

This commit is contained in:
2025-12-29 19:59:15 +01:00
parent ef232c9007
commit e9412a2e20

View File

@@ -69,33 +69,6 @@ const actionateButton = async (button: (typeof selectedButton)["value"]) => {
});
}
};
// TODO: use @activate events from common buttons
const QUIT_BUTTON: Rect = [31, 172, 80, 18];
const OK_BUTTON: Rect = [144, 172, 80, 18];
useScreenClick((x, y) => {
if (modalState.value.isOpen || store.isIntro || store.isOutro) {
return;
}
if (rectContains(QUIT_BUTTON, [x, y])) {
store.animateOutro();
} else if (rectContains(OK_BUTTON, [x, y])) {
actionateButton(selectedButton.value);
}
});
useKeyDown((key) => {
if (modalState.value.isOpen || store.isIntro || store.isOutro) return;
switch (key) {
case "NDS_B":
store.animateOutro();
break;
}
});
</script>
<template>
@@ -130,5 +103,7 @@ useKeyDown((key) => {
"
b-label="Quit"
:a-label="ACTIONS[selectedButton][0]"
@activate-a="actionateButton(selectedButton)"
@activate-b="store.animateOutro()"
/>
</template>