feat(nds): fix missing @activate-a event handlers
This commit is contained in:
@@ -68,33 +68,7 @@ const { selected, pressed, selectorPosition } = useButtonNavigation({
|
||||
},
|
||||
},
|
||||
initialButton: "git",
|
||||
onActivate: async (button) => {
|
||||
const { action, url } = BUTTONS[button];
|
||||
const verb = $t(`contact.actions.${button}`);
|
||||
if (action === "copy") {
|
||||
try {
|
||||
await navigator.clipboard.writeText(url);
|
||||
store.pushNotification($t("contact.copiedToClipboard", { item: verb }));
|
||||
} catch (error) {
|
||||
console.error("Failed to copy to clipboard:", error);
|
||||
}
|
||||
} else {
|
||||
confirmationModal.open({
|
||||
text: $t("contact.openUrl", { url: url.replace(/^https?:\/\//, "") }),
|
||||
onActivateA: async () => {
|
||||
store.pushNotification($t("contact.opened", { item: verb }));
|
||||
|
||||
await promiseTimeout(100);
|
||||
await navigateTo(url, { open: { target: "_blank " } });
|
||||
await promiseTimeout(500);
|
||||
|
||||
if (button === "git") {
|
||||
achievements.unlock("contact_git_visit");
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
onActivate: (button) => handleActivateA(button),
|
||||
disabled: computed(() => store.isIntro || store.isOutro),
|
||||
selectorAnimation: {
|
||||
duration: 0.075,
|
||||
@@ -102,6 +76,34 @@ const { selected, pressed, selectorPosition } = useButtonNavigation({
|
||||
},
|
||||
});
|
||||
|
||||
const handleActivateA = async (button: typeof selected.value) => {
|
||||
const { action, url } = BUTTONS[button];
|
||||
const verb = $t(`contact.actions.${button}`);
|
||||
if (action === "copy") {
|
||||
try {
|
||||
await navigator.clipboard.writeText(url);
|
||||
store.pushNotification($t("contact.copiedToClipboard", { item: verb }));
|
||||
} catch (error) {
|
||||
console.error("Failed to copy to clipboard:", error);
|
||||
}
|
||||
} else {
|
||||
confirmationModal.open({
|
||||
text: $t("contact.openUrl", { url: url.replace(/^https?:\/\//, "") }),
|
||||
onActivateA: async () => {
|
||||
store.pushNotification($t("contact.opened", { item: verb }));
|
||||
|
||||
await promiseTimeout(100);
|
||||
await navigateTo(url, { open: { target: "_blank " } });
|
||||
await promiseTimeout(500);
|
||||
|
||||
if (button === "git") {
|
||||
achievements.unlock("contact_git_visit");
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleActivateB = () => {
|
||||
if (store.isIntro || store.isOutro) return;
|
||||
store.animateOutro();
|
||||
@@ -157,6 +159,7 @@ onRender((ctx) => {
|
||||
"
|
||||
:b-label="$t('common.quit')"
|
||||
:a-label="$t(`contact.actions.${BUTTONS[selected].action}`)"
|
||||
@activate-a="handleActivateA(selected)"
|
||||
@activate-b="handleActivateB"
|
||||
/>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user