Skip to content

Commit

Permalink
Renamed modal files (#1066) (#1068)
Browse files Browse the repository at this point in the history
* Renamed modal files (#1066)

* fix: Tipe of variable location

* Update pyproject.toml

* Add opcional variable

* fix: Tipe of data in test

* fix: Ruff import block formatted

* fix: Ruff format

* fix: test suit frontend

* Rename parent directory of new edit text modals

---------

Co-authored-by: Andrew Tavis McAllister <[email protected]>
  • Loading branch information
YoSoyAlexElPine and andrewtavis authored Dec 20, 2024
1 parent 53ec1c9 commit cf83551
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 34 deletions.
9 changes: 4 additions & 5 deletions frontend/components/card/CardDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
{{ $t("components.card_details.header") }}
</h3>
<IconEdit
@click="openModalEditAboutEvent()"
@keydown.enter="openModalEditAboutEvent()"
@click="openModalEditTextEvent()"
@keydown.enter="openModalEditTextEvent()"
/>
</div>
<div v-if="event" class="flex-col space-y-6 py-2">
Expand Down Expand Up @@ -51,9 +51,8 @@
<script setup lang="ts">
import { useModalHandlers } from "~/composables/useModalHandlers";
const { openModal: openModalEditAboutEvent } = useModalHandlers(
"ModalEditAboutEvent"
);
const { openModal: openModalEditTextEvent } =
useModalHandlers("ModalEditTextEvent");
const { openModal: openModalOrganizationOverview } = useModalHandlers(
"ModalOrganizationOverview"
);
Expand Down
9 changes: 4 additions & 5 deletions frontend/components/card/about/CardAboutEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
{{ $t("_global.about") }}
</h3>
<IconEdit
@click="openModalEditAboutEvent()"
@keydown.enter="openModalEditAboutEvent()"
@click="openModalEditTextEvent()"
@keydown.enter="openModalEditTextEvent()"
/>
</div>
<div class="flex-col space-y-3">
Expand Down Expand Up @@ -60,9 +60,8 @@
<script setup lang="ts">
import { useModalHandlers } from "~/composables/useModalHandlers";
const { openModal: openModalEditAboutEvent } = useModalHandlers(
"ModalEditAboutEvent"
);
const { openModal: openModalEditTextEvent } =
useModalHandlers("ModalEditTextEvent");
const idParam = useRoute().params.id;
const id = typeof idParam === "string" ? idParam : undefined;
Expand Down
9 changes: 4 additions & 5 deletions frontend/components/card/about/CardAboutGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
{{ $t("_global.about") }}
</h3>
<IconEdit
@click="openModalEditAboutGroup()"
@keydown.enter="openModalEditAboutGroup()"
@click="openModalEditTextGroup()"
@keydown.enter="openModalEditTextGroup()"
/>
</div>
<div class="flex-col space-y-3">
Expand Down Expand Up @@ -81,9 +81,8 @@
import { useModalHandlers } from "~/composables/useModalHandlers";
import { IconMap } from "~/types/icon-map";
const { openModal: openModalEditAboutGroup } = useModalHandlers(
"ModalEditAboutGroup"
);
const { openModal: openModalEditTextGroup } =
useModalHandlers("ModalEditTextGroup");
const idParam = useRoute().params.id;
const id = typeof idParam === "string" ? idParam : undefined;
Expand Down
8 changes: 4 additions & 4 deletions frontend/components/card/about/CardAboutOrganization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</h3>
<IconEdit
v-if="userIsSignedIn"
@click="openModalEditAboutOrganization"
@keydown.enter="openModalEditAboutOrganization"
@click="openModalEditTextOrganization"
@keydown.enter="openModalEditTextOrganization"
/>
</div>
<div class="flex-col space-y-3">
Expand Down Expand Up @@ -87,8 +87,8 @@
import { useModalHandlers } from "~/composables/useModalHandlers";
import { IconMap } from "~/types/icon-map";
const { openModal: openModalEditAboutOrganization } = useModalHandlers(
"ModalEditAboutOrganization"
const { openModal: openModalEditTextOrganization } = useModalHandlers(
"ModalEditTextOrganization"
);
const { userIsSignedIn } = useUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{ $t("components._global.participate") }}
</h3>
<IconEdit @click="openModal()" @keydown.enter="openModal()" />
<ModalEditAboutEvent
<ModalEditTextEvent
v-if="event"
@closeModal="handleCloseModal"
:event="event"
Expand Down Expand Up @@ -53,7 +53,7 @@ defineProps<{
}>();
const modals = useModals();
const modalName = "ModalEditAboutEvent";
const modalName = "ModalEditTextEvent";
const modalIsOpen = ref(false);
function openModal() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{ $t("components._global.get_involved") }}
</h3>
<IconEdit @click="openModal()" @keydown.enter="openModal()" />
<ModalEditAboutGroup
<ModalEditTextGroup
v-if="group"
@closeModal="handleCloseModal"
:group="group"
Expand Down Expand Up @@ -52,7 +52,7 @@ defineProps<{
}>();
const modals = useModals();
const modalName = "ModalEditAboutGroup";
const modalName = "ModalEditTextGroup";
const modalIsOpen = ref(false);
function openModal() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</h3>
<IconEdit
v-if="userIsSignedIn"
@click="openModalEditAboutOrganization()"
@keydown.enter="openModalEditAboutOrganization()"
@click="openModalEditTextOrganization()"
@keydown.enter="openModalEditTextOrganization()"
/>
</div>
<div class="flex space-x-2 pt-2 lg:absolute lg:right-0 lg:pt-0">
Expand All @@ -31,7 +31,7 @@
ariaLabel="_global.join_organization_aria_label"
/>
</div>
<ModalEditAboutOrganization
<ModalEditTextOrganization
:organization="organization"
:description="organization.texts.description"
:getInvolved="organization.texts.getInvolved"
Expand Down Expand Up @@ -81,8 +81,8 @@
import { useModalHandlers } from "~/composables/useModalHandlers";
import { IconMap } from "~/types/icon-map";
const { openModal: openModalEditAboutOrganization } = useModalHandlers(
"ModalEditAboutOrganization"
const { openModal: openModalEditTextOrganization } = useModalHandlers(
"ModalEditTextOrganization"
);
const { userIsSignedIn } = useUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function handleSubmit() {
}
const modals = useModals();
const modalName = "ModalEditAboutEvent";
const modalName = "ModalEditTextEvent";
let modalIsOpen = computed(() => props.isOpen);
onMounted(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function handleSubmit() {
}
const modals = useModals();
const modalName = "ModalEditAboutGroup";
const modalName = "ModalEditTextGroup";
let modalIsOpen = computed(() => props.isOpen);
onMounted(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import { useModalHandlers } from "~/composables/useModalHandlers";
import type { OrganizationUpdateTextFormData } from "~/types/entities/organization";
const modalName = "ModalEditAboutOrganization";
const modalName = "ModalEditTextOrganization";
const { handleCloseModal } = useModalHandlers(modalName);
const idParam = useRoute().params.id;
Expand Down
4 changes: 2 additions & 2 deletions frontend/pages/organizations/[id]/events.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
</HeaderAppPage>
<div v-if="organization.events?.length > 0" class="space-y-3 py-4">
<CardSearchResultEvent
v-for="(u, i) in organization.events"
v-for="(e, i) in organization.events"
:key="i"
:event="e"
:isReduced="true"
:event="u"
/>
</div>
<EmptyState v-else pageType="events" :permission="false" class="py-4" />
Expand Down
10 changes: 10 additions & 0 deletions frontend/tests/specs/organizationLogic.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

// Mock fetchById function and organization data directly.
const mockFetchById = vi.fn();
const mockOrganization = { id: "test-uuid", name: "Test Organization" };
Expand All @@ -7,3 +9,11 @@ vi.mock("@/components/page/PageBreadcrumbs.vue", () => ({
fetchById: mockFetchById,
organization: mockOrganization,
}));

describe("Organization Logic", () => {
it("should fetch organization by ID", () => {
const organization = { id: "test-uuid", name: "Test Organization" };
expect(organization.id).toBe("test-uuid");
expect(organization.name).toBe("Test Organization");
});
});
2 changes: 1 addition & 1 deletion frontend/types/entities/group.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Group {
organization: Organization;
createdBy: User;
iconUrl?: string;

orgId?: string;
location: Location;

getInvolvedUrl: string;
Expand Down

0 comments on commit cf83551

Please sign in to comment.