Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions apps/v4/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,13 @@ const useIdFunction = () => useId()
</script>

<template>
<Body
class="text-foreground group/body overscroll-none font-sans antialiased [--footer-height:calc(var(--spacing)*14)] [--header-height:calc(var(--spacing)*14)] xl:[--footer-height:calc(var(--spacing)*24)]"
:class="[
activeTheme ? `theme-${activeTheme}` : '',
isScaled ? 'theme-scaled' : '',
isLayoutFull ? 'layout-full' : 'layout-fixed',
]"
>
<SiteBody>
<ConfigProvider>
<NuxtLayout :use-id="useIdFunction">
<NuxtPage />
</NuxtLayout>
</ConfigProvider>

<Toaster :theme="colorMode.preference as any || 'system'" position="top-center" />
</Body>
</SiteBody>
</template>
18 changes: 18 additions & 0 deletions apps/v4/components/SiteBody.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script setup lang="ts">
const { config, isLayoutFull } = useConfig()
const activeTheme = computed(() => config.value.activeTheme)
const isScaled = computed(() => !!activeTheme.value?.endsWith('-scaled'))
</script>

<template>
<Body
class="text-foreground group/body overscroll-none font-sans antialiased [--footer-height:calc(var(--spacing)*14)] [--header-height:calc(var(--spacing)*14)] xl:[--footer-height:calc(var(--spacing)*24)]"
:class="[
activeTheme ? `theme-${activeTheme}` : '',
isScaled ? 'theme-scaled' : '',
isLayoutFull ? 'layout-full' : 'layout-fixed',
]"
>
<slot />
</Body>
</template>
31 changes: 31 additions & 0 deletions apps/v4/error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script setup lang="ts">
import type { NuxtError } from '#app'
import { ConfigProvider } from 'reka-ui'
import Button from './registry/new-york-v4/ui/button/Button.vue'

defineProps<{
error: NuxtError
}>()

const useIdFunction = () => useId()
</script>

<template>
<SiteBody>
<ConfigProvider>
<NuxtLayout name="default" :use-id="useIdFunction">
<div class="flex flex-col items-center justify-center gap-6 text-center min-h-[80vh]">
<PageHeader>
<PageHeaderHeading>{{ error.statusCode }}</PageHeaderHeading>
<PageHeaderDescription>{{ error.message }}</PageHeaderDescription>
<Button as-child class="w-fit mt-6">
<NuxtLink to="/">
Go back home
</NuxtLink>
</Button>
</PageHeader>
</div>
</NuxtLayout>
</ConfigProvider>
</SiteBody>
</template>
14 changes: 4 additions & 10 deletions apps/v4/pages/docs/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const { data: page } = await useAsyncData(route.path, () => {
return queryCollection('content').path(route.path).first()
})

if (!page.value) {
throw createError({ statusCode: 404, statusMessage: 'Page not found' })
}

const { data: neighbours } = await useAsyncData(`surround-${route.path}`, () => {
return queryCollectionItemSurroundings('content', route.path)
})
Expand Down Expand Up @@ -120,14 +124,4 @@ const { data: neighbours } = await useAsyncData(`surround-${route.path}`, () =>
</div>
</div>
</template>

<template v-else>
<div class="empty-page">
<h1>Page Not Found</h1>
<p>Oops! The content you're looking for doesn't exist.</p>
<NuxtLink to="/">
Go back home
</NuxtLink>
</div>
</template>
</template>