feat(common): handleConfirm -> handleActivateA, handleCancel -> handleActivateB
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user