@@ -136,15 +137,12 @@ const props = defineProps<{
}>();
const { linkURL } = useLinkURL(props);
+const modals = useModals();
+const modalName = "ModalsQRCode";
+const modalIsOpen = computed(() => modals.modals[modalName]?.isOpen ?? false);
-const modalIsOpen = computed(() => props.isOpen);
-const modalShouldClose = ref(false);
-
-const emit = defineEmits(["closeModal"]);
const handleCloseModal = () => {
- modalShouldClose.value = true;
- emit("closeModal");
- modalShouldClose.value = false;
+ modals.closeModal(modalName);
};
const showTooltip = ref(false);
diff --git a/frontend/components/modal/qr-code/ModalQRCodeBtn.vue b/frontend/components/modal/qr-code/ModalQRCodeBtn.vue
index e4ad29544..41c0a5389 100644
--- a/frontend/components/modal/qr-code/ModalQRCodeBtn.vue
+++ b/frontend/components/modal/qr-code/ModalQRCodeBtn.vue
@@ -80,13 +80,17 @@ defineProps<{
type: "icon" | "meta-tag";
}>();
+const modals = useModals();
+const modalName = "ModalsQRCode";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/components/modal/upload-images/ModalUploadImages.vue b/frontend/components/modal/upload-images/ModalUploadImages.vue
index 4bd393413..885dd2aad 100644
--- a/frontend/components/modal/upload-images/ModalUploadImages.vue
+++ b/frontend/components/modal/upload-images/ModalUploadImages.vue
@@ -1,7 +1,8 @@
@@ -112,13 +113,11 @@ const props = withDefaults(defineProps(), {
uploadLimit: 10,
});
-const modalIsOpen = computed(() => props.isOpen);
-const modalShouldClose = ref(false);
+const modals = useModals();
+const modalName = "ModalUploadImages";
+const modalIsOpen = computed(() => modals.modals[modalName]?.isOpen ?? false);
-const emit = defineEmits(["closeModal"]);
const handleCloseModal = () => {
- modalShouldClose.value = true;
- emit("closeModal");
- modalShouldClose.value = false;
+ modals.closeModal(modalName);
};
diff --git a/frontend/components/sidebar/left/SidebarLeftIndex.vue b/frontend/components/sidebar/left/SidebarLeftIndex.vue
index 2df3e35a2..a69de145e 100644
--- a/frontend/components/sidebar/left/SidebarLeftIndex.vue
+++ b/frontend/components/sidebar/left/SidebarLeftIndex.vue
@@ -107,14 +107,17 @@ const sidebarTypeToDisplay = computed(() => props.sidebarType);
const sidebar = useSidebar();
const menuEntriesState = useMenuEntriesState();
-
+const modals = useModals();
+const modalName = "ModalUploadImages";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultEvent.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultEvent.vue
index 3b45cc48d..2a046f04d 100644
--- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultEvent.vue
+++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultEvent.vue
@@ -50,13 +50,17 @@ defineProps<{
const emit = defineEmits(["tab"]);
const { handleTabPress } = useTabNavigationEmit(emit);
+const modals = useModals();
+const modalName = "ModalSharePage";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultGroup.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultGroup.vue
index f458f6190..e6928996a 100644
--- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultGroup.vue
+++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultGroup.vue
@@ -55,13 +55,17 @@ defineProps<{
const emit = defineEmits(["tab"]);
const { handleTabPress } = useTabNavigationEmit(emit);
+const modals = useModals();
+const modalName = "ModalSharePage";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultOrganization.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultOrganization.vue
index 7a77d786b..aac2e023f 100644
--- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultOrganization.vue
+++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultOrganization.vue
@@ -55,13 +55,17 @@ defineProps<{
const emit = defineEmits(["tab"]);
const { handleTabPress } = useTabNavigationEmit(emit);
+const modals = useModals();
+const modalName = "ModalSharePage";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultResource.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultResource.vue
index 572fdbe1d..77871ca5d 100644
--- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultResource.vue
+++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultResource.vue
@@ -42,13 +42,17 @@ defineProps<{
const emit = defineEmits(["tab"]);
const { handleTabPress } = useTabNavigationEmit(emit);
+const modals = useModals();
+const modalName = "ModalSharePage";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultUser.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultUser.vue
index 3cad6269f..00dca7b4c 100644
--- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultUser.vue
+++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultUser.vue
@@ -42,13 +42,17 @@ defineProps<{
const emit = defineEmits(["tab"]);
const { handleTabPress } = useTabNavigationEmit(emit);
+const modals = useModals();
+const modalName = "ModalSharePage";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/pages/docs/get-active.vue b/frontend/pages/docs/get-active.vue
index 72b493c01..fdc05bd5f 100644
--- a/frontend/pages/docs/get-active.vue
+++ b/frontend/pages/docs/get-active.vue
@@ -126,13 +126,18 @@
diff --git a/frontend/pages/docs/get-organized.vue b/frontend/pages/docs/get-organized.vue
index 17154358e..8c32a91dc 100644
--- a/frontend/pages/docs/get-organized.vue
+++ b/frontend/pages/docs/get-organized.vue
@@ -99,13 +99,17 @@
diff --git a/frontend/pages/docs/grow-organization.vue b/frontend/pages/docs/grow-organization.vue
index cf6b102e2..12d8d91fb 100644
--- a/frontend/pages/docs/grow-organization.vue
+++ b/frontend/pages/docs/grow-organization.vue
@@ -106,13 +106,17 @@
diff --git a/frontend/pages/events/[id]/about.vue b/frontend/pages/events/[id]/about.vue
index 85084fa0c..85b8f901c 100644
--- a/frontend/pages/events/[id]/about.vue
+++ b/frontend/pages/events/[id]/about.vue
@@ -122,13 +122,17 @@ onUnmounted(() => {
window.removeEventListener("resize", updateShareBtnLabel);
});
+const modals = useModals();
+const modalName = "ModalSharePage";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/pages/organizations/[id]/about.vue b/frontend/pages/organizations/[id]/about.vue
index abd75e5b7..5c238fd39 100644
--- a/frontend/pages/organizations/[id]/about.vue
+++ b/frontend/pages/organizations/[id]/about.vue
@@ -122,13 +122,17 @@ onUnmounted(() => {
window.removeEventListener("resize", updateShareBtnLabel);
});
+const modals = useModals();
+const modalName = "ModalSharePage";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/pages/organizations/[id]/groups/[id]/about.vue b/frontend/pages/organizations/[id]/groups/[id]/about.vue
index fa2b8a2b5..905578b28 100644
--- a/frontend/pages/organizations/[id]/groups/[id]/about.vue
+++ b/frontend/pages/organizations/[id]/groups/[id]/about.vue
@@ -134,13 +134,17 @@ onUnmounted(() => {
window.removeEventListener("resize", updateShareBtnLabel);
});
+const modals = useModals();
+const modalName = "ModalSharePage";
const modalIsOpen = ref(false);
function openModal() {
- modalIsOpen.value = true;
+ modals.openModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
}
const handleCloseModal = () => {
- modalIsOpen.value = false;
+ modals.closeModal(modalName);
+ modalIsOpen.value = modals.modals[modalName].isOpen;
};
diff --git a/frontend/stores/modals.ts b/frontend/stores/modals.ts
new file mode 100644
index 000000000..d47fe7f22
--- /dev/null
+++ b/frontend/stores/modals.ts
@@ -0,0 +1,27 @@
+import { defineStore } from "pinia";
+
+interface Modal {
+ isOpen: boolean;
+}
+
+export const useModals = defineStore("modals", {
+ state: () => ({
+ modals: {} as Record,
+ }),
+
+ actions: {
+ openModal(modalName: string) {
+ const modals = this.modals;
+ for (const key in modals) {
+ modals[key].isOpen = false;
+ }
+ modals[modalName] = { isOpen: true };
+ },
+
+ closeModal(modalName: string) {
+ if (this.modals[modalName]) {
+ this.modals[modalName].isOpen = false;
+ }
+ },
+ },
+});