feat(common): move confirmation modal to his own store, and add 'onClosed' event

This commit is contained in:
2025-12-30 00:37:39 +01:00
parent 98b2959501
commit 6d1edc1b8a
5 changed files with 116 additions and 109 deletions

View File

@@ -6,7 +6,7 @@ import Buttons from "./Buttons.vue";
import ButtonSelector from "~/components/Common/ButtonSelector.vue";
const store = useContactStore();
const { open: openModal, state: modalState } = useConfirmationModal();
const confirmationModal = useConfirmationModal();
const ACTIONS = {
github: ["Open", "Github profile", "https://github.com/pihkaal"],
@@ -59,7 +59,7 @@ const actionateButton = async (button: (typeof selectedButton)["value"]) => {
}
} else {
const url = content.replace(/^https?:\/\//, "");
openModal({
confirmationModal.open({
text: `Open ${url}?`,
onConfirm: async () => {
store.pushNotification(`${verb} opened`);
@@ -92,7 +92,7 @@ const actionateButton = async (button: (typeof selectedButton)["value"]) => {
<CommonConfirmationModal />
<CommonButtons
:y-offset="
store.isIntro ? store.intro.barOffsetY : modalState.buttonsYOffset
store.isIntro ? store.intro.barOffsetY : confirmationModal.buttonsYOffset
"
:opacity="
store.isIntro