Skip to content

Commit

Permalink
Merge branch 'main' into add-event-creation-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis authored Jul 1, 2024
2 parents d7a8001 + a2a115a commit 13e3cbe
Show file tree
Hide file tree
Showing 37 changed files with 294 additions and 144 deletions.
10 changes: 7 additions & 3 deletions frontend/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<ModalCommandPalette
@closeModal="handleCloseModal"
:isOpen="modalIsOpen"
:modalName="modalName"
/>
<NuxtPage />
</NuxtLayout>
Expand All @@ -28,15 +29,18 @@ useHead({
return titleChunk ? `${titleChunk} • activist` : "activist";
},
});
const modals = useModals();
const modalName = "generalModal";
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;
};
const { isMacOS } = useDevice();
Expand Down
11 changes: 8 additions & 3 deletions frontend/components/card/CardDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,22 @@
<script setup lang="ts">
import type { Event } from "~/types/events/event";
const props = defineProps<{
defineProps<{
event?: Event;
}>();
const modals = useModals();
const modalName = "ModalEditPageText";
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;
};
</script>
8 changes: 6 additions & 2 deletions frontend/components/card/about/CardAboutEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,17 @@ function expand_reduce_text() {
expandText.value = !expandText.value;
}
const modals = useModals();
const modalName = "ModalEditAboutEvent";
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;
};
</script>
8 changes: 6 additions & 2 deletions frontend/components/card/about/CardAboutGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,17 @@ function expand_reduce_text() {
expandText.value = !expandText.value;
}
const modals = useModals();
const modalName = "ModalEditAboutGroup";
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;
};
</script>
8 changes: 6 additions & 2 deletions frontend/components/card/about/CardAboutOrganization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,17 @@ function expand_reduce_text() {
expandText.value = !expandText.value;
}
const modals = useModals();
const modalName = "ModalEditAboutOrganization";
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;
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,17 @@ defineProps<{
disclaimer?: string;
}>();
const modals = useModals();
const modalName = "ModalEditAboutEvent";
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;
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ defineProps<{
disclaimer?: string;
}>();
const modals = useModals();
const modalName = "ModalEditAboutGroup";
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;
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,17 @@ await organizationStore.fetchByID(id);
const { organization } = organizationStore;
const modals = useModals();
const modalName = "ModalEditAboutOrganization";
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;
};
</script>
9 changes: 6 additions & 3 deletions frontend/components/icon/IconOrganizationStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,17 @@ defineProps<{
status: number;
organization: Organization;
}>();
const modals = useModals();
const modalName = "ModalOrganizationStatus";
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;
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ const imageUrls = [
`${GET_ORGANIZED_IMAGE_URL}_${imageColor}.png`,
`${GROW_ORGANIZATION_IMAGE_URL}_${imageColor}.png`,
];
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;
};
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@
<script setup lang="ts">
import { IconMap } from "~/types/icon-map";
const modals = useModals();
const modalName = "ModalMediaImage";
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;
};
</script>
21 changes: 10 additions & 11 deletions frontend/components/modal/ModalBase.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<template>
<Dialog
@close="closeModal()"
class="relative z-50"
:open="modalShouldClose == false ? modalIsOpen : false"
>
<Dialog @close="closeModal()" class="relative z-50" :open="modalIsOpen">
<div
@click="closeModal()"
class="fixed inset-0 cursor-pointer bg-light-layer-0/95 dark:bg-dark-layer-0/95"
Expand Down Expand Up @@ -66,15 +62,18 @@ import { IconMap } from "~/types/icon-map";
const props = defineProps<{
isOpen: boolean;
imageModal?: boolean;
modalName: string;
}>();
const modalIsOpen = computed(() => props.isOpen);
const modalShouldClose = ref(false);
const modals = useModals();
const modalName = props.modalName;
let modalIsOpen = computed(() => props.isOpen);
onMounted(() => {
modalIsOpen = computed(() => modals.modals[modalName].isOpen);
});
const emit = defineEmits(["closeModal"]);
const closeModal = () => {
modalShouldClose.value = true;
emit("closeModal");
modalShouldClose.value = false;
modals.closeModal(modalName);
};
</script>
17 changes: 10 additions & 7 deletions frontend/components/modal/ModalMediaImageCarousel.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<ModalBase
@closeModal="handleCloseModal"
:isOpen="modalShouldClose == false ? modalIsOpen : false"
:isOpen="modalIsOpen"
:modalName="modalName"
>
<MediaImageCarousel :fullscreen="true" />
</ModalBase>
Expand All @@ -12,13 +13,15 @@ const props = defineProps<{
isOpen: boolean;
}>();
const modalIsOpen = computed(() => props.isOpen);
const modalShouldClose = ref(false);
const modals = useModals();
const modalName = "ModalMediaImage";
let modalIsOpen = computed(() => props.isOpen);
onMounted(() => {
modalIsOpen = computed(() => modals.modals[modalName].isOpen);
});
const emit = defineEmits(["closeModal"]);
const handleCloseModal = () => {
modalShouldClose.value = true;
emit("closeModal");
modalShouldClose.value = false;
modals.closeModal(modalName);
};
</script>
17 changes: 10 additions & 7 deletions frontend/components/modal/ModalOrganizationStatus.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<ModalBase
@closeModal="handleCloseModal"
:isOpen="modalShouldClose == false ? modalIsOpen : false"
:isOpen="modalIsOpen"
:modalName="modalName"
>
<div class="max-h-[80vh] px-2 pb-2 pt-1 lg:px-4 lg:pb-4 lg:pt-2">
<DialogTitle class="font-display">
Expand Down Expand Up @@ -40,14 +41,16 @@ const props = defineProps<{
isOpen: boolean;
}>();
const modalIsOpen = computed(() => props.isOpen);
const modalShouldClose = ref(false);
const modals = useModals();
const modalName = "ModalOrganizationStatus";
let modalIsOpen = computed(() => props.isOpen);
onMounted(() => {
modalIsOpen = computed(() => modals.modals[modalName].isOpen);
});
const emit = defineEmits(["closeModal"]);
const handleCloseModal = () => {
modalShouldClose.value = true;
emit("closeModal");
modalShouldClose.value = false;
modals.closeModal(modalName);
};
const modalOrganizationStatusData = inject<{
Expand Down
16 changes: 9 additions & 7 deletions frontend/components/modal/ModalSharePage.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<ModalBase
@closeModal="handleCloseModal"
:isOpen="modalShouldClose == false ? modalIsOpen : false"
:isOpen="modalIsOpen"
:modalName="modalName"
>
<div class="px-2 pb-2 pt-1 lg:px-4 lg:pb-4 lg:pt-2">
<DialogTitle class="font-display">
Expand Down Expand Up @@ -211,15 +212,16 @@ const props = defineProps<{
user?: User;
isOpen: boolean;
}>();
const modals = useModals();
const modalName = "ModalSharePage";
let modalIsOpen = computed(() => props.isOpen);
const modalIsOpen = computed(() => props.isOpen);
const modalShouldClose = ref(false);
onMounted(() => {
modalIsOpen = computed(() => modals.modals[modalName].isOpen);
});
const emit = defineEmits(["closeModal"]);
const handleCloseModal = () => {
modalShouldClose.value = true;
emit("closeModal");
modalShouldClose.value = false;
modals.closeModal(modalName);
};
const getEntityType = () => {
Expand Down
Loading

0 comments on commit 13e3cbe

Please sign in to comment.