fix(common): show buttons only if onConfirm is passed instead of having separate boolean

This commit is contained in:
2025-12-29 19:58:59 +01:00
parent bdc27d72c8
commit ef232c9007
2 changed files with 3 additions and 9 deletions

View File

@@ -48,7 +48,7 @@ onUnmounted(() => {
<template>
<Buttons
v-if="state.showButtons"
v-if="state.onConfirm"
:y-offset="state.modalButtonsYOffset"
b-label="Cancel"
a-label="Confirm"

View File

@@ -15,22 +15,16 @@ const state = useState("confirmationModal", () =>
modalButtonsYOffset: BUTTONS_MAX_Y_OFFSET,
isVisible: false,
isClosing: false,
showButtons: true,
}),
);
const open = (
options: {
text: string;
} & ({ showButtons?: true; onConfirm: () => void } | { showButtons: false }),
) => {
const open = (options: { text: string; onConfirm?: () => void }) => {
gsap.killTweensOf(state.value);
state.value.text = options.text;
state.value.onConfirm = options.showButtons ? options.onConfirm : null;
state.value.onConfirm = options.onConfirm ?? null;
state.value.isVisible = true;
state.value.isClosing = false;
state.value.isOpen = true;
state.value.showButtons = options.showButtons ?? false;
gsap
.timeline()