Added loading card component

This commit is contained in:
Alexis
2025-03-14 17:45:09 +01:00
parent 586adee6a9
commit 5b38b3d0fa
6 changed files with 46 additions and 20 deletions

View File

@@ -68,21 +68,21 @@ watch(user, () => {
<div class="grid justify-items-center opacity-80">
<PhCalendarX size="75" class="opacity-60" />
<Heading level="h1">
<LazyHeading level="h1">
{{ $t("entity.calendar.notFound") }}
</Heading>
</LazyHeading>
<p>
{{ $t('entity.calendar.notFoundDescription') }}
</p>
<UiButton variant="default" class="mt-4 gap-2" as-child>
<LazyUiButton variant="default" class="mt-4 gap-2" as-child>
<RouterLink to="/explore">
<PhArrowBendDoubleUpLeft size="24" />
{{ $t('entity.calendar.backToList') }}
</RouterLink>
</UiButton>
</LazyUiButton>
</div>
</div>
</template>

View File

@@ -5,7 +5,9 @@ definePageMeta({
middleware: ["reset-menu"]
})
const { data: availableCalendars } = await useLazyFetch<{ data: Calendar[] }>("/api/calendars/query", { key: "explore-calendars", query: { full: true } })
const { data: availableCalendars, status: calendarStatus } = await useLazyFetch<{ data: Calendar[] }>("/api/calendars/query", { key: "explore-calendars", query: { full: true } })
const isLoading = computed(() => calendarStatus.value === "pending")
</script>
<template>
@@ -24,11 +26,14 @@ const { data: availableCalendars } = await useLazyFetch<{ data: Calendar[] }>("/
{{ $t("entity.calendar.namePublicPlural") }}
</Heading>
<ul v-if="availableCalendars?.data" class="grid md:grid-cols-3 gap-2">
<li v-for="calendar in availableCalendars.data" :key="calendar.shortId">
<CalendarPreviewCard :calendar="calendar" :gm-id="calendar.world?.gmId" />
</li>
</ul>
<div v-if="isLoading" class="grid md:grid-cols-3 gap-2">
<LoadingCard />
</div>
<ul v-else-if="availableCalendars?.data" class="grid md:grid-cols-3 gap-2">
<li v-for="calendar in availableCalendars.data" :key="calendar.shortId">
<CalendarPreviewCard :calendar="calendar" :gm-id="calendar.world?.gmId" />
</li>
</ul>
</Spacing>
</Spacing>
</main>

View File

@@ -153,8 +153,8 @@ function hideEditModal() {
</Spacing>
</section>
<WorldDialogCreate :modal-state="isCreateWorldModalOpen" @on-close="hideCreateDialog" />
<WorldDialogEdit :world="markedWorld" :modal-state="isEditWorldModalOpen" @on-close="hideEditModal" />
<WorldDialogDelete :world="markedWorld" :modal-state="isDeleteWorldModalOpen" @on-close="hideDeleteModal" />
<LazyWorldDialogCreate :modal-state="isCreateWorldModalOpen" @on-close="hideCreateDialog" />
<LazyWorldDialogEdit :world="markedWorld" :modal-state="isEditWorldModalOpen" @on-close="hideEditModal" />
<LazyWorldDialogDelete :world="markedWorld" :modal-state="isDeleteWorldModalOpen" @on-close="hideDeleteModal" />
</main>
</template>

View File

@@ -251,10 +251,10 @@ function hideEditModal() {
</Spacing>
</section>
<WorldDialogEdit :world="world.data" :modal-state="isEditWorldModalOpen" @on-close="hideEditModal" />
<CalendarDialogCreate :world="world.data" :modal-state="isCreateCalendarModalOpen" @on-close="hideCreateDialog" />
<CalendarDialogUpdate v-if="markedCalendar?.id" :world="world.data" :calendar="markedCalendar" :modal-state="isUpdateCalendarModalOpen" @on-close="hideUpdateDialog" />
<CalendarDialogDelete :calendar="markedCalendar" :modal-state="isDeleteCalendarModalOpen" @on-close="hideDeleteCalendarModal"/>
<LazyWorldDialogEdit :world="world.data" :modal-state="isEditWorldModalOpen" @on-close="hideEditModal" />
<LazyCalendarDialogCreate :world="world.data" :modal-state="isCreateCalendarModalOpen" @on-close="hideCreateDialog" />
<LazyCalendarDialogUpdate v-if="markedCalendar?.id" :world="world.data" :calendar="markedCalendar" :modal-state="isUpdateCalendarModalOpen" @on-close="hideUpdateDialog" />
<LazyCalendarDialogDelete :calendar="markedCalendar" :modal-state="isDeleteCalendarModalOpen" @on-close="hideDeleteCalendarModal"/>
</template>
<template v-else>
<div class="h-full w-full grid place-items-center">