Fix upcoming event groups on homeview

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-11-07 09:02:20 +01:00
parent 67b63a9a6e
commit 8f49c66b3f
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
2 changed files with 23 additions and 15 deletions

View File

@ -213,9 +213,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ParticipantRole } from "@/types/enums"; import { ParticipantRole } from "@/types/enums";
import RouteName from "@/router/name"; import RouteName from "@/router/name";
import { IParticipant } from "../../types/participant.model"; import type { IParticipant } from "../../types/participant.model";
import { LOGGED_USER_DRAFTS } from "../../graphql/actor"; import { LOGGED_USER_DRAFTS } from "../../graphql/actor";
import { IEvent } from "../../types/event.model"; import type { IEvent } from "../../types/event.model";
import MultiEventMinimalistCard from "../../components/Event/MultiEventMinimalistCard.vue"; import MultiEventMinimalistCard from "../../components/Event/MultiEventMinimalistCard.vue";
import EventMinimalistCard from "../../components/Event/EventMinimalistCard.vue"; import EventMinimalistCard from "../../components/Event/EventMinimalistCard.vue";
import { import {
@ -366,7 +366,7 @@ const monthlyFutureEvents = computed((): Map<string, Eventable[]> => {
eventable = [...eventable, ...futureParticipations.value]; eventable = [...eventable, ...futureParticipations.value];
} }
if (showMyGroups.value) { if (showMyGroups.value) {
eventable = [...eventable, ...groupEvents.value]; eventable = [...eventable, ...groupEvents.value.map(({ event }) => event)];
} }
return monthlyEvents(eventable); return monthlyEvents(eventable);
}); });

View File

@ -35,12 +35,12 @@
v-if="currentActor?.id && (welcomeBack || newRegisteredUser)" v-if="currentActor?.id && (welcomeBack || newRegisteredUser)"
> >
<o-notification variant="info" v-if="welcomeBack">{{ <o-notification variant="info" v-if="welcomeBack">{{
$t("Welcome back {username}!", { t("Welcome back {username}!", {
username: displayName(currentActor), username: displayName(currentActor),
}) })
}}</o-notification> }}</o-notification>
<o-notification variant="info" v-if="newRegisteredUser">{{ <o-notification variant="info" v-if="newRegisteredUser">{{
$t("Welcome to Mobilizon, {username}!", { t("Welcome to Mobilizon, {username}!", {
username: displayName(currentActor), username: displayName(currentActor),
}) })
}}</o-notification> }}</o-notification>
@ -48,7 +48,7 @@
<!-- Your upcoming events --> <!-- Your upcoming events -->
<section v-if="canShowMyUpcomingEvents" class="container mx-auto"> <section v-if="canShowMyUpcomingEvents" class="container mx-auto">
<h2 class="dark:text-white font-bold"> <h2 class="dark:text-white font-bold">
{{ $t("Your upcoming events") }} {{ t("Your upcoming events") }}
</h2> </h2>
<div <div
v-for="row of goingToEvents" v-for="row of goingToEvents"
@ -57,7 +57,7 @@
> >
<p class="date-component-container" v-if="isInLessThanSevenDays(row[0])"> <p class="date-component-container" v-if="isInLessThanSevenDays(row[0])">
<span v-if="isToday(row[0])">{{ <span v-if="isToday(row[0])">{{
$t( t(
"You have one event today.", "You have one event today.",
{ {
count: row[1].size, count: row[1].size,
@ -66,7 +66,7 @@
) )
}}</span> }}</span>
<span v-else-if="isTomorrow(row[0])">{{ <span v-else-if="isTomorrow(row[0])">{{
$t( t(
"You have one event tomorrow.", "You have one event tomorrow.",
{ {
count: row[1].size, count: row[1].size,
@ -76,7 +76,7 @@
}}</span> }}</span>
<span v-else-if="isInLessThanSevenDays(row[0])"> <span v-else-if="isInLessThanSevenDays(row[0])">
{{ {{
$t( t(
"You have one event in {days} days.", "You have one event in {days} days.",
{ {
count: row[1].size, count: row[1].size,
@ -101,16 +101,21 @@
<router-link <router-link
:to="{ name: RouteName.MY_EVENTS }" :to="{ name: RouteName.MY_EVENTS }"
class="hover:text-slate-800 hover:dark:text-slate-400" class="hover:text-slate-800 hover:dark:text-slate-400"
>{{ $t("View everything") }} >></router-link >{{ t("View everything") }} >></router-link
> >
</span> </span>
</section> </section>
<!-- Events from your followed groups --> <!-- Events from your followed groups -->
<section class="followActivity" v-if="canShowFollowedGroupEvents"> <section
<h2 class="title"> class="relative pt-10 px-2 container mx-auto px-2"
{{ $t("Upcoming events from your groups") }} v-if="canShowFollowedGroupEvents"
>
<h2
class="text-xl font-bold tracking-tight text-gray-900 dark:text-gray-100 mt-0"
>
{{ t("Upcoming events from your groups") }}
</h2> </h2>
<p>{{ $t("That you follow or of which you are a member") }}</p> <p>{{ t("That you follow or of which you are a member") }}</p>
<multi-card :events="filteredFollowedGroupsEvents" /> <multi-card :events="filteredFollowedGroupsEvents" />
<span <span
class="block mt-2 text-right underline text-slate-700 dark:text-slate-300" class="block mt-2 text-right underline text-slate-700 dark:text-slate-300"
@ -126,7 +131,7 @@
showMyGroups: 'true', showMyGroups: 'true',
}, },
}" }"
>{{ $t("View everything") }} >></router-link >{{ t("View everything") }} >></router-link
> >
</span> </span>
</section> </section>
@ -218,6 +223,9 @@ import { geoHashToCoords } from "@/utils/location";
import { useServerProvidedLocation } from "@/composition/apollo/config"; import { useServerProvidedLocation } from "@/composition/apollo/config";
import { ABOUT } from "@/graphql/config"; import { ABOUT } from "@/graphql/config";
import { IConfig } from "@/types/config.model"; import { IConfig } from "@/types/config.model";
import { useI18n } from "vue-i18n";
const { t } = useI18n({ useScope: "global" });
const EventParticipationCard = defineAsyncComponent( const EventParticipationCard = defineAsyncComponent(
() => import("@/components/Event/EventParticipationCard.vue") () => import("@/components/Event/EventParticipationCard.vue")