Made about page more reactive
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
<script lang="ts" setup>
|
||||
import { PhCircleNotch } from '@phosphor-icons/vue'
|
||||
|
||||
const { locale } = useI18n()
|
||||
|
||||
const { data: page, refresh } = await useAsyncData(`about-content-${locale}`, () => {
|
||||
const { data: page, refresh, status } = useLazyAsyncData(`about-content-${locale}`, () => {
|
||||
return queryCollection("sections").path(`/sections/${locale.value}/legal`).first()
|
||||
})
|
||||
|
||||
@@ -9,25 +11,25 @@ watch(locale, () => refresh())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="py-8 px-5 md:px-8 overflow-y-auto">
|
||||
<Head>
|
||||
<Title>{{ $t("pages.about.title") }}</Title>
|
||||
</Head>
|
||||
<Head>
|
||||
<Title>{{ $t("pages.about.title") }}</Title>
|
||||
</Head>
|
||||
|
||||
<div class="container max-md:px-0">
|
||||
<Spacing size="lg">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="md:hidden">
|
||||
<SidebarToggle />
|
||||
</div>
|
||||
<main class="container overflow-y-auto py-8 px-5 md:px-8 grid gap-4 grid-rows-[auto_1fr]">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="md:hidden">
|
||||
<SidebarToggle />
|
||||
</div>
|
||||
|
||||
<Heading level="h1">
|
||||
{{ $t("pages.about.title") }}
|
||||
</Heading>
|
||||
</div>
|
||||
|
||||
<ContentRenderer v-if="page" :value="page" class="content" />
|
||||
</Spacing>
|
||||
<Heading level="h1">
|
||||
{{ $t("pages.about.title") }}
|
||||
</Heading>
|
||||
</div>
|
||||
|
||||
<div v-if="status === 'pending'" class="grid place-items-center">
|
||||
<PhCircleNotch size="50" class="opacity-33 animate-spin"/>
|
||||
</div>
|
||||
|
||||
<LazyContentRenderer v-else-if="status === 'success' && page" :value="page" class="content" />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
@@ -44,7 +44,7 @@ watch(isLoading, (n) => {
|
||||
<p>
|
||||
{{ $t('entity.calendar.isLoading') }}
|
||||
</p>
|
||||
<PhCircleNotch size="50" class="animate-spin"/>
|
||||
<PhCircleNotch size="50" class="opacity-33 animate-spin"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ definePageMeta({
|
||||
middleware: ["reset-menu"]
|
||||
})
|
||||
|
||||
const { data: availableCalendars, status: calendarStatus } = await useLazyFetch<{ data: Calendar[] }>("/api/calendars/query", { key: "explore-calendars", query: { full: true } })
|
||||
const { data: availableCalendars, status: calendarStatus } = useLazyFetch<{ data: Calendar[] }>("/api/calendars/query", { key: "explore-calendars", query: { full: true } })
|
||||
|
||||
const isLoading = computed(() => calendarStatus.value === "pending")
|
||||
</script>
|
||||
|
||||
@@ -51,7 +51,7 @@ watch([calendar], () => {
|
||||
<p>
|
||||
{{ $t('entity.calendar.isLoading') }}
|
||||
</p>
|
||||
<PhCircleNotch size="50" class="animate-spin"/>
|
||||
<PhCircleNotch size="50" class="opacity-33 animate-spin"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user