feat(common): handleConfirm -> handleActivateA, handleCancel -> handleActivateB

This commit is contained in:
2026-02-10 15:30:08 +01:00
parent ca05d0ea65
commit 38b36d0e1c
12 changed files with 60 additions and 63 deletions

View File

@@ -98,7 +98,7 @@ onMounted(() => {
animateIntro();
});
const handleCancel = async () => {
const handleActivateB = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
@@ -111,7 +111,7 @@ const handleReset = () => {
bLabel: $t("common.no"),
aLabel: $t("common.yes"),
onClosed: (choice) => {
if (choice === "confirm") {
if (choice === "A") {
achievements.reset();
}
},
@@ -199,7 +199,7 @@ onRender((ctx) => {
:y-offset="confirmationModal.buttonsYOffset + store.submenuButtonsOffsetY"
:b-label="$t('common.cancel')"
:a-label="$t('common.reset')"
@activate-b="handleCancel()"
@activate-b="handleActivateB()"
@activate-a="handleReset()"
/>
</template>

View File

@@ -39,13 +39,13 @@ onMounted(() => {
animateIntro();
});
const handleCancel = async () => {
const handleActivateB = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
};
const handleConfirm = async () => {
const handleActivateA = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
@@ -82,7 +82,7 @@ defineOptions({ render: () => null });
:y-offset="store.submenuButtonsOffsetY"
:b-label="$t('common.cancel')"
:a-label="$t('common.confirm')"
@activate-b="handleCancel"
@activate-a="handleConfirm"
@activate-b="handleActivateB"
@activate-a="handleActivateA"
/>
</template>

View File

@@ -59,13 +59,13 @@ onMounted(() => {
animateIntro();
});
const handleCancel = async () => {
const handleActivateB = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
};
const handleConfirm = async () => {
const handleActivateA = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
@@ -100,7 +100,7 @@ defineOptions({ render: () => null });
:y-offset="store.submenuButtonsOffsetY"
:b-label="$t('common.cancel')"
:a-label="$t('common.confirm')"
@activate-b="handleCancel"
@activate-a="handleConfirm"
@activate-b="handleActivateB"
@activate-a="handleActivateA"
/>
</template>

View File

@@ -15,12 +15,12 @@ const handleActivateB = () => {
bLabel: $t("common.no"),
aLabel: $t("common.yes"),
onClosed: async (choice) => {
if (choice === "confirm") {
if (choice === "A") {
await animateOutro();
store.closeSubMenu();
}
},
keepButtonsDown: (choice) => choice === "confirm",
keepButtonsDown: (choice) => choice === "A",
});
};
@@ -35,7 +35,7 @@ const handleActivateA = () => {
bLabel: $t("common.no"),
aLabel: $t("common.yes"),
onClosed: (choice) => {
if (choice === "confirm") {
if (choice === "A") {
resetBoard();
}
},
@@ -116,9 +116,9 @@ let animating = false;
const showRestartModal = () => {
confirmationModal.open({
text: $t("settings.options.2048.gameOver"),
onConfirm: () => {},
onActivateA: () => {},
onClosed: (choice) => {
if (choice === "confirm") {
if (choice === "A") {
resetBoard();
}
},

View File

@@ -135,13 +135,13 @@ onMounted(() => {
animateIntro();
});
const handleCancel = async () => {
const handleActivateB = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
};
const handleConfirm = () => {
const handleActivateA = () => {
if (isAnimating.value) return;
const selectedLocale = locales.value[BUTTON_KEYS.indexOf(selected.value)]!;
@@ -206,8 +206,8 @@ defineOptions({
:y-offset="confirmationModal.buttonsYOffset + store.submenuButtonsOffsetY"
:b-label="$t('common.cancel')"
:a-label="$t('common.confirm')"
@activate-b="handleCancel"
@activate-a="handleConfirm"
@activate-b="handleActivateB"
@activate-a="handleActivateA"
/>
<CommonButtonSelector

View File

@@ -89,13 +89,13 @@ const { selected, selectorPosition } = useButtonNavigation({
},
});
const handleCancel = async () => {
const handleActivateB = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
};
const handleConfirm = () => {
const handleActivateA = () => {
if (isAnimating.value) return;
const mode = selected.value === "_3dMode" ? "3d" : "2d";
app.setRenderingMode(mode);
@@ -184,8 +184,8 @@ onRender((ctx) => {
:y-offset="confirmationModal.buttonsYOffset + store.submenuButtonsOffsetY"
:b-label="$t('common.cancel')"
:a-label="$t('common.confirm')"
@activate-b="handleCancel"
@activate-a="handleConfirm"
@activate-b="handleActivateB"
@activate-a="handleActivateA"
/>
<CommonButtonSelector

View File

@@ -132,14 +132,14 @@ const handleActivateB = () => {
bLabel: $t("common.no"),
aLabel: $t("common.yes"),
onClosed: async (choice) => {
if (choice === "confirm") {
if (choice === "A") {
await animateOutro();
store.closeSubMenu();
} else {
state.value = "playing";
}
},
keepButtonsDown: (choice) => choice === "confirm",
keepButtonsDown: (choice) => choice === "A",
});
} else {
animateOutro().then(() => store.closeSubMenu());
@@ -155,7 +155,7 @@ const handleActivateA = async () => {
bLabel: $t("common.no"),
aLabel: $t("common.yes"),
onClosed: (choice) => {
if (choice === "confirm") {
if (choice === "A") {
resetGame();
} else {
state.value = "playing";
@@ -233,14 +233,14 @@ const showDeathScreen = () => {
bLabel: $t("common.quit"),
aLabel: $t("common.restart"),
onClosed: async (choice) => {
if (choice === "confirm") {
if (choice === "A") {
resetGame();
} else {
await animateOutro();
store.closeSubMenu();
}
},
keepButtonsDown: (choice) => choice === "cancel",
keepButtonsDown: (choice) => choice === "B",
});
};

View File

@@ -84,7 +84,7 @@ onMounted(() => {
animateIntro();
});
const handleCancel = async () => {
const handleActivateB = async () => {
if (isAnimating.value) return;
switch (state.value) {
case "alive": {
@@ -94,14 +94,14 @@ const handleCancel = async () => {
bLabel: $t("common.no"),
aLabel: $t("common.yes"),
onClosed: async (choice) => {
if (choice === "confirm") {
if (choice === "A") {
await animateOutro();
store.closeSubMenu();
} else {
state.value = "alive";
}
},
keepButtonsDown: (choice) => choice === "confirm",
keepButtonsDown: (choice) => choice === "A",
});
break;
}
@@ -115,7 +115,7 @@ const handleCancel = async () => {
}
};
const handleConfirm = () => {
const handleActivateA = () => {
if (isAnimating.value) return;
switch (state.value) {
case "alive": {
@@ -125,7 +125,7 @@ const handleConfirm = () => {
bLabel: $t("common.no"),
aLabel: $t("common.yes"),
onClosed: (choice) => {
if (choice === "confirm") {
if (choice === "A") {
spawn();
} else {
state.value = "alive";
@@ -334,7 +334,7 @@ defineOptions({ render: () => null });
:y-offset="confirmationModal.buttonsYOffset + store.submenuButtonsOffsetY"
:b-label="$t('common.quit')"
:a-label="state === 'waiting' ? $t('common.start') : $t('common.restart')"
@activate-b="handleCancel"
@activate-a="handleConfirm"
@activate-b="handleActivateB"
@activate-a="handleActivateA"
/>
</template>

View File

@@ -67,13 +67,13 @@ onMounted(() => {
animateIntro();
});
const handleCancel = async () => {
const handleActivateB = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
};
const handleConfirm = async () => {
const handleActivateA = async () => {
if (isAnimating.value) return;
await animateOutro();
store.closeSubMenu();
@@ -130,7 +130,7 @@ defineOptions({ render: () => null });
:y-offset="store.submenuButtonsOffsetY"
:b-label="$t('common.cancel')"
:a-label="$t('common.confirm')"
@activate-b="handleCancel"
@activate-a="handleConfirm"
@activate-b="handleActivateB"
@activate-a="handleActivateA"
/>
</template>