diff --git a/docs/app.vue b/docs/app.vue
index e016a047..2ce49779 100644
--- a/docs/app.vue
+++ b/docs/app.vue
@@ -10,7 +10,7 @@
-
+
@@ -28,29 +28,32 @@
diff --git a/docs/components/Header.vue b/docs/components/Header.vue
index efb7d04e..7411ab24 100644
--- a/docs/components/Header.vue
+++ b/docs/components/Header.vue
@@ -19,7 +19,7 @@
-
+
diff --git a/docs/composables/useContentSource.ts b/docs/composables/useContentSource.ts
index 9f0fd4ce..552c3f1d 100644
--- a/docs/composables/useContentSource.ts
+++ b/docs/composables/useContentSource.ts
@@ -1,57 +1,43 @@
-import type { NavItem, ParsedContent } from '@nuxt/content/dist/runtime/types'
-
export const useContentSource = () => {
const route = useRoute()
+ const router = useRouter()
const config = useRuntimeConfig().public
- const branches = [{
+ const branches = computed(() => [{
+ id: 'dev',
name: 'dev',
icon: 'i-heroicons-cube',
suffix: 'dev',
- label: 'Edge'
+ label: 'Edge',
+ disabled: route.path.startsWith('/dev'),
+ click: () => select({ name: 'dev' })
}, {
+ id: 'main',
name: 'main',
icon: 'i-heroicons-cube',
suffix: 'latest',
- label: `v${config.version}`
- }]
+ label: `v${config.version}`,
+ disabled: !route.path.startsWith('/dev'),
+ click: () => select({ name: 'main' })
+ }])
- const branch = computed(() => branches.find(b => b.name === (route.path.startsWith('/dev') ? 'dev' : 'main')))
+ const branch = computed(() => branches.value.find(b => b.name === (route.path.startsWith('/dev') ? 'dev' : 'main')))
- const prefix = computed(() => `/${branch.value.name}`)
-
- function removePrefixFromNavigation (navigation: NavItem[]): NavItem[] {
- return navigation.map((link) => {
- const { _path, children, ...rest } = link
-
- return {
- ...rest,
- _path: route.path.startsWith(prefix.value) ? _path : _path.replace(new RegExp(`^${prefix.value}`, 'g'), ''),
- children: children?.length ? removePrefixFromNavigation(children) : undefined
- }
- })
- }
-
- function removePrefixFromFiles (files: ParsedContent[]) {
- return files.map((file) => {
- if (!file) {
+ function select (branch) {
+ if (branch.name === 'dev') {
+ if (route.path.startsWith('/dev')) {
return
}
- const { _path, ...rest } = file
-
- return {
- ...rest,
- _path: route.path.startsWith(prefix.value) ? _path : _path.replace(new RegExp(`^${prefix.value}`, 'g'), '')
- }
- })
+ router.push(`/dev${route.path}`)
+ } else {
+ router.push(route.path.replace('/dev', ''))
+ }
}
return {
branches,
branch,
- prefix,
- removePrefixFromNavigation,
- removePrefixFromFiles
+ select
}
}
diff --git a/docs/error.vue b/docs/error.vue
index 1d2a5b1e..815af38b 100644
--- a/docs/error.vue
+++ b/docs/error.vue
@@ -11,7 +11,7 @@
-
+
@@ -20,8 +20,7 @@