forked from potsda.mn/mobilizon
Fix: don't show passed/finished events in related events section
potsda.mn/mobilizon#19
This commit is contained in:
parent
0a300ea5e5
commit
7d7f925907
|
@ -64,6 +64,7 @@ const FULL_EVENT_FRAGMENT = gql`
|
||||||
uuid
|
uuid
|
||||||
title
|
title
|
||||||
beginsOn
|
beginsOn
|
||||||
|
endsOn
|
||||||
status
|
status
|
||||||
language
|
language
|
||||||
picture {
|
picture {
|
||||||
|
|
|
@ -250,12 +250,12 @@
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="bg-white dark:bg-zinc-700 px-3 pt-1 pb-3 rounded my-4"
|
class="bg-white dark:bg-zinc-700 px-3 pt-1 pb-3 rounded my-4"
|
||||||
v-if="(event?.relatedEvents ?? []).length > 0"
|
v-if="(nonPassedRelatedEvents ?? []).length > 0"
|
||||||
>
|
>
|
||||||
<h2 class="text-2xl mb-2">
|
<h2 class="text-2xl mb-2">
|
||||||
{{ t("These events may interest you") }}
|
{{ t("These events may interest you") }}
|
||||||
</h2>
|
</h2>
|
||||||
<multi-card :events="event?.relatedEvents ?? []" />
|
<multi-card :events="nonPassedRelatedEvents ?? []" />
|
||||||
</section>
|
</section>
|
||||||
<o-modal
|
<o-modal
|
||||||
v-model:active="showMap"
|
v-model:active="showMap"
|
||||||
|
@ -335,6 +335,7 @@ import { useI18n } from "vue-i18n";
|
||||||
import { Notifier } from "@/plugins/notifier";
|
import { Notifier } from "@/plugins/notifier";
|
||||||
import { AbsintheGraphQLErrors } from "@/types/errors.model";
|
import { AbsintheGraphQLErrors } from "@/types/errors.model";
|
||||||
import { useHead } from "@vueuse/head";
|
import { useHead } from "@vueuse/head";
|
||||||
|
import { IEvent } from "@/types/event.model";
|
||||||
|
|
||||||
const IntegrationTwitch = defineAsyncComponent(
|
const IntegrationTwitch = defineAsyncComponent(
|
||||||
() => import("@/components/Event/Integrations/TwitchIntegration.vue")
|
() => import("@/components/Event/Integrations/TwitchIntegration.vue")
|
||||||
|
@ -619,6 +620,19 @@ const organizerDomain = computed((): string | undefined => {
|
||||||
return organizer.value?.domain ?? undefined;
|
return organizer.value?.domain ?? undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filterNonPassedRelatedEvents = (relatedEvents: IEvent[] | undefined) => {
|
||||||
|
console.log(relatedEvents);
|
||||||
|
return relatedEvents?.filter((relatedEvent) => {
|
||||||
|
let endsOn = relatedEvent.endsOn ? new Date(relatedEvent.endsOn) : new Date(relatedEvent.beginsOn);
|
||||||
|
console.log(endsOn);
|
||||||
|
return endsOn > new Date();
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
const nonPassedRelatedEvents = computed((): IEvent[] | undefined => {
|
||||||
|
return filterNonPassedRelatedEvents(event.value?.relatedEvents);
|
||||||
|
});
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
title: computed(() => eventTitle.value ?? ""),
|
title: computed(() => eventTitle.value ?? ""),
|
||||||
meta: [{ name: "description", content: eventDescription.value }],
|
meta: [{ name: "description", content: eventDescription.value }],
|
||||||
|
|
Loading…
Reference in a new issue