From 4c16ed30fd0d60db85eb7558ba4c4c171fef95e4 Mon Sep 17 00:00:00 2001 From: limes Date: Fri, 14 Aug 2026 15:23:41 +0200 Subject: [PATCH] feat: docs! --- content.config.ts | 51 ++- src/assets/css/main.css | 5 + src/components/Navbar/Navbar.vue | 13 +- src/layouts/docs.vue | 561 +++++++++++++++++++++++++++++++ src/pages/docs/[...slug].vue | 257 ++++++++++++++ src/pages/docs/error/[code].vue | 60 ++++ src/pages/docs/errors.vue | 150 +++++++++ src/pages/docs/index.vue | 23 ++ src/pages/docs/install.vue | 72 ++++ src/pages/docs/welcome.vue | 129 +++++++ 10 files changed, 1316 insertions(+), 5 deletions(-) create mode 100644 src/layouts/docs.vue create mode 100644 src/pages/docs/[...slug].vue create mode 100644 src/pages/docs/error/[code].vue create mode 100644 src/pages/docs/errors.vue create mode 100644 src/pages/docs/index.vue create mode 100644 src/pages/docs/install.vue create mode 100644 src/pages/docs/welcome.vue diff --git a/content.config.ts b/content.config.ts index a4a95f9..9d26355 100644 --- a/content.config.ts +++ b/content.config.ts @@ -1,4 +1,27 @@ -import { defineContentConfig, defineCollection, z } from '@nuxt/content'; +import { + defineContentConfig, + defineCollection, + defineCollectionSource, + z +} from '@nuxt/content'; +import { getAllErrors, getErrorInfo } from '@pretendonetwork/error-codes'; + +const errorCodeSource = defineCollectionSource({ + getKeys: () => { + return getAllErrors().map((key: string) => `${key}.json`); + }, + getItem: (key: string) => { + const errorString = key.split('.')[0]; + const sysmodule = errorString.split('-')[0]; + const code = errorString.split('-')[1]; + const errorInfo = getErrorInfo(sysmodule, code, 'en-US'); + if (errorInfo) { + errorInfo.code = errorString; + } + + return errorInfo; + } +}); export default defineContentConfig({ collections: { @@ -13,9 +36,35 @@ export default defineContentConfig({ cover_image: z.string() }) }), + docs: defineCollection({ + type: 'page', + source: 'docs/**/*.md', + schema: z.object({ + description: z.string() + }) + }), terms: defineCollection({ type: 'page', source: 'terms/*.md' + }), + errorcodes: defineCollection({ + type: 'data', + source: errorCodeSource, + schema: z.object({ + name: z.string(), + message: z.string(), + short_description: z.string(), + long_description: z.string(), + short_solution: z.string(), + long_solution: z.string(), + support_link: z.string(), + module: z.object({ + name: z.string(), + description: z.string(), + system: z.string() + }), + code: z.string() + }) }) } }); diff --git a/src/assets/css/main.css b/src/assets/css/main.css index c78c46f..82e1050 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -180,6 +180,11 @@ p.switch-tier-modal-caption span { padding: 12px 24px; } +.purple-card { + border-radius: 10px; + background: var(--bg-shade-0); +} + @media screen and (max-width: 600px) { div.modal { padding: 24px; diff --git a/src/components/Navbar/Navbar.vue b/src/components/Navbar/Navbar.vue index 55df013..7448bab 100644 --- a/src/components/Navbar/Navbar.vue +++ b/src/components/Navbar/Navbar.vue @@ -28,8 +28,11 @@ onMounted(() => {