diff --git a/docs/app/app.vue b/docs/app/app.vue index d70202f6..cd9cc885 100644 --- a/docs/app/app.vue +++ b/docs/app/app.vue @@ -2,16 +2,13 @@ import { withoutTrailingSlash } from 'ufo' import colors from 'tailwindcss/colors' // import { debounce } from 'perfect-debounce' -import type { ContentSearchFile } from '@nuxt/ui-pro' const route = useRoute() const appConfig = useAppConfig() const colorMode = useColorMode() -const runtimeConfig = useRuntimeConfig() -const { integrity, api } = runtimeConfig.public.content -const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(), { default: () => [] }) -const { data: files } = await useLazyFetch(`${api.baseURL}/search${integrity ? '-' + integrity : ''}`, { default: () => [] }) +const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content')) +const { data: files } = await useAsyncData('files', () => queryCollectionSearchSections('content', { ignoredTags: ['style'] })) const searchTerm = ref('') @@ -29,7 +26,7 @@ const links = computed(() => { icon: 'i-heroicons-book-open', to: '/getting-started', active: route.path.startsWith('/getting-started') || route.path.startsWith('/components') - }, ...(navigation.value.find(item => item._path === '/pro') + }, ...(navigation.value?.find(item => item.path === '/pro') ? [{ label: 'Pro', icon: 'i-heroicons-square-3-stack-3d', @@ -76,12 +73,15 @@ useServerSeoMeta({ twitterCard: 'summary_large_image' }) -const updatedNavigation = computed(() => navigation.value.map(item => ({ +const updatedNavigation = computed(() => navigation.value?.map(item => ({ ...item, - children: item.children?.map(child => ({ + children: item.children?.map((child: typeof item) => ({ ...child, - active: child.title === 'Installation' ? route.path.startsWith('/getting-started/installation') : undefined, - children: child.title === 'Installation' ? [] : child.children + ...(child.path === '/getting-started/installation' && { + title: 'Installation', + active: route.path.startsWith('/getting-started/installation'), + children: [] + }) })) || [] }))) diff --git a/docs/app/components/Header.vue b/docs/app/components/Header.vue index a1b6909b..49946cf2 100644 --- a/docs/app/components/Header.vue +++ b/docs/app/components/Header.vue @@ -1,5 +1,5 @@