From 89b1d2a547c65c6b236e2f1375b8cb45f1c0f3d9 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 15 Mar 2025 20:37:08 +0100 Subject: [PATCH] Show crew on event cards when logged in as crew --- components/EventCard.vue | 6 ++++++ composables/accounts.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/components/EventCard.vue b/components/EventCard.vue index edf017a..8992621 100644 --- a/components/EventCard.vue +++ b/components/EventCard.vue @@ -31,6 +31,10 @@ +

+ Crew: + {{ slot.assigned.map(id => idToAccount.get(id)?.name).join(", ") }} +

@@ -48,6 +52,8 @@ const runtimeConfig = useRuntimeConfig(); const { data: session, refresh: refreshSession } = await useAccountSession(); const interestedIds = computed(() => new Set(session.value?.account.interestedIds ?? [])); const timezone = computed(() => session.value?.account?.timezone ?? runtimeConfig.public.defaultTimezone); +const { data: accounts } = await useAccounts(); +const idToAccount = computed(() => new Map(accounts.value?.map(a => [a.id, a]))); function formatTime(time: string) { return DateTime.fromISO(time, { zone: timezone.value }).toFormat("yyyy-LL-dd HH:mm"); diff --git a/composables/accounts.ts b/composables/accounts.ts index ffc4a55..a6be47e 100644 --- a/composables/accounts.ts +++ b/composables/accounts.ts @@ -5,5 +5,6 @@ export const useAccounts = () => useFetch( getCachedData(key, nuxtApp) { return nuxtApp.payload.data[key]; }, + dedupe: "defer", } );