Add JSON page routing support

This commit is contained in:
2026-01-18 17:15:39 +00:00
parent 6388880362
commit 7be52ffc1e
4 changed files with 78 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import pagesConfig from './pages.json'
import { PageSchema } from '@/types/json-ui'
import { FeatureToggles } from '@/types/project'
export interface PropConfig {
@@ -23,7 +24,10 @@ export interface PageConfig {
id: string
title: string
icon: string
component: string
component?: string
type?: 'json' | 'component'
schemaPath?: string
schema?: PageSchema
enabled: boolean
isRoot?: boolean
toggleKey?: string

View File

@@ -57,7 +57,9 @@ export function validatePageConfig(): ValidationError[] {
})
}
if (!page.component) {
const isJsonPage = page.type === 'json' || Boolean(page.schemaPath)
if (!page.component && !isJsonPage) {
errors.push({
page: page.id || 'Unknown',
field: 'component',
@@ -66,6 +68,15 @@ export function validatePageConfig(): ValidationError[] {
})
}
if (isJsonPage && !page.schemaPath && !page.schema) {
errors.push({
page: page.id || 'Unknown',
field: 'schemaPath',
message: 'schemaPath is required for JSON pages',
severity: 'error',
})
}
if (!page.icon) {
errors.push({
page: page.id || 'Unknown',