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

@@ -11,13 +11,10 @@ export const useConfirmationModal = defineStore("confirmationModal", {
text: "",
aLabel: null as string | null,
bLabel: null as string | null,
onConfirm: null as (() => void) | null,
onCancel: null as (() => void) | null,
onClosed: null as ((choice: "confirm" | "cancel") => void) | null,
keepButtonsDown: null as
| boolean
| ((choice: "confirm" | "cancel") => boolean)
| null,
onActivateA: null as (() => void) | null,
onActivateB: null as (() => void) | null,
onClosed: null as ((choice: "A" | "B") => void) | null,
keepButtonsDown: null as boolean | ((choice: "A" | "B") => boolean) | null,
offsetY: MODAL_MAX_Y_OFFSET,
buttonsYOffset: 0,
modalButtonsYOffset: BUTTONS_MAX_Y_OFFSET,
@@ -30,18 +27,18 @@ export const useConfirmationModal = defineStore("confirmationModal", {
text: string;
aLabel?: string;
bLabel?: string;
onCancel?: () => void;
onConfirm?: () => void;
onClosed?: (choice: "confirm" | "cancel") => void;
keepButtonsDown?: boolean | ((choice: "confirm" | "cancel") => boolean);
onActivateA?: () => void;
onActivateB?: () => void;
onClosed?: (choice: "A" | "B") => void;
keepButtonsDown?: boolean | ((choice: "A" | "B") => boolean);
timeout?: number;
}) {
gsap.killTweensOf(this);
this.text = options.text;
this.aLabel = options.aLabel ?? null;
this.bLabel = options.bLabel ?? null;
this.onConfirm = options.onConfirm ?? null;
this.onCancel = options.onCancel ?? null;
this.onActivateA = options.onActivateA ?? null;
this.onActivateB = options.onActivateB ?? null;
this.onClosed = options.onClosed ?? null;
this.keepButtonsDown = options.keepButtonsDown ?? null;
this.isVisible = true;
@@ -75,13 +72,13 @@ export const useConfirmationModal = defineStore("confirmationModal", {
.call(() => {
if (options.timeout) {
setTimeout(() => {
this.close("cancel");
this.close("B");
}, options.timeout);
}
});
},
close(choice: "confirm" | "cancel") {
close(choice: "A" | "B") {
if (!this.isVisible || this.isClosing) return;
this.isClosing = true;