mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 13:44:54 +00:00
Convert TypeScript schemas to JSON with compute functions
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -45,7 +45,10 @@ This project demonstrates a comprehensive JSON-driven UI architecture with atomi
|
||||
|
||||
```typescript
|
||||
import { PageRenderer } from '@/lib/json-ui/page-renderer'
|
||||
import { dashboardSchema } from '@/schemas/dashboard-schema'
|
||||
import { hydrateSchema } from '@/schemas/schema-loader'
|
||||
import analyticsDashboardJson from '@/schemas/analytics-dashboard.json'
|
||||
|
||||
const dashboardSchema = hydrateSchema(analyticsDashboardJson)
|
||||
|
||||
export function DashboardPage() {
|
||||
return <PageRenderer schema={dashboardSchema} />
|
||||
@@ -439,8 +442,12 @@ src/
|
||||
│ ├── component-renderer.tsx
|
||||
│ └── component-registry.tsx
|
||||
├── schemas/ # JSON page schemas
|
||||
│ ├── dashboard-schema.ts
|
||||
│ └── page-schemas.ts
|
||||
│ ├── analytics-dashboard.json
|
||||
│ ├── todo-list.json
|
||||
│ ├── dashboard-simple.json
|
||||
│ ├── new-molecules-showcase.json
|
||||
│ ├── compute-functions.ts
|
||||
│ └── schema-loader.ts
|
||||
└── types/
|
||||
└── json-ui.ts # TypeScript types
|
||||
```
|
||||
|
||||
@@ -163,7 +163,12 @@ src/
|
||||
│ └── json-ui/
|
||||
│ └── component-registry.tsx [MODIFIED]
|
||||
├── schemas/
|
||||
│ └── dashboard-schema.ts [NEW]
|
||||
│ ├── analytics-dashboard.json [NEW]
|
||||
│ ├── todo-list.json [NEW]
|
||||
│ ├── dashboard-simple.json [NEW]
|
||||
│ ├── new-molecules-showcase.json [NEW]
|
||||
│ ├── compute-functions.ts [NEW]
|
||||
│ └── schema-loader.ts [NEW]
|
||||
├── types/
|
||||
│ └── json-ui.ts [MODIFIED]
|
||||
├── App.simple-json-demo.tsx [NEW]
|
||||
|
||||
@@ -59,7 +59,7 @@ Enhanced the JSON-driven UI system by creating additional custom hooks, atomic c
|
||||
|
||||
## JSON Page Schema Created
|
||||
|
||||
### Analytics Dashboard Schema (/src/schemas/dashboard-schema.ts)
|
||||
### Analytics Dashboard Schema (/src/schemas/analytics-dashboard.json)
|
||||
Comprehensive JSON-driven page demonstrating:
|
||||
|
||||
- **Data Sources**:
|
||||
|
||||
@@ -524,7 +524,7 @@ events: [{
|
||||
|
||||
## Example: Complete Todo App
|
||||
|
||||
See `/src/schemas/page-schemas.ts` for a full working example with:
|
||||
See `/src/schemas/todo-list.json` for a full working example with:
|
||||
- KV persistence
|
||||
- Computed statistics
|
||||
- CRUD operations
|
||||
@@ -577,7 +577,9 @@ See `/src/schemas/page-schemas.ts` for a full working example with:
|
||||
## Resources
|
||||
|
||||
- **Type Definitions**: `/src/types/json-ui.ts`
|
||||
- **Page Schemas**: `/src/schemas/page-schemas.ts`
|
||||
- **JSON Schemas**: `/src/schemas/*.json`
|
||||
- **Compute Functions**: `/src/schemas/compute-functions.ts`
|
||||
- **Schema Loader**: `/src/schemas/schema-loader.ts`
|
||||
- **Custom Hooks**: `/src/hooks/data/` and `/src/hooks/ui/`
|
||||
- **Atomic Components**: `/src/components/atoms/`
|
||||
- **Component Registry**: `/src/lib/json-ui/component-registry.ts`
|
||||
|
||||
Reference in New Issue
Block a user