Skip to content

Commit c78e81c

Browse files
Copilothotlong
andcommitted
Enhance Phase 2 schema documentation with use cases and improved overview
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent d924b5e commit c78e81c

File tree

5 files changed

+149
-45
lines changed

5 files changed

+149
-45
lines changed

content/docs/core/app-schema.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,16 @@ Use expression syntax to show/hide menu items based on user permissions:
287287
}
288288
```
289289

290+
## Use Cases
291+
292+
AppSchema is ideal for:
293+
294+
- **Multi-page applications** - Configure complex application structures with multiple routes
295+
- **Admin dashboards** - Create comprehensive admin panels with role-based navigation
296+
- **CRM systems** - Build customer relationship management interfaces
297+
- **Internal tools** - Develop enterprise internal tools with centralized navigation
298+
- **SaaS products** - Configure multi-tenant applications with customizable layouts
299+
290300
## Best Practices
291301

292302
1. **Use semantic icons** - Choose Lucide icons that clearly represent the section

content/docs/core/enhanced-actions.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,17 @@ if (result.success) {
403403
}
404404
```
405405

406+
## Use Cases
407+
408+
Enhanced Actions are ideal for:
409+
410+
- **API integration** - Connect to backend services and external APIs
411+
- **Multi-step processes** - Execute complex workflows with multiple stages
412+
- **Form submissions** - Handle form data with validation and callbacks
413+
- **Confirmation dialogs** - Add safety checks for critical operations
414+
- **Event tracking** - Monitor user interactions for analytics
415+
- **Batch operations** - Process multiple items in sequence or parallel
416+
406417
## Best Practices
407418

408419
1. **Use confirm for destructive actions** - Always confirm delete, archive, etc.

content/docs/core/report-schema.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,17 @@ if (result.success) {
391391
}
392392
```
393393

394+
## Use Cases
395+
396+
ReportSchema is perfect for:
397+
398+
- **Analytics dashboards** - Display key business metrics and KPIs
399+
- **Business intelligence** - Generate insights from operational data
400+
- **Automated reporting** - Schedule regular reports for stakeholders
401+
- **Data exports** - Provide data in multiple formats (PDF, Excel, CSV)
402+
- **Compliance reporting** - Generate audit trails and regulatory reports
403+
- **Executive summaries** - Create high-level overviews for management
404+
394405
## Best Practices
395406

396407
1. **Use meaningful aggregations** - Choose aggregation types that make sense for the data

content/docs/core/theme-schema.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,16 @@ if (result.success) {
352352
}
353353
```
354354

355+
## Use Cases
356+
357+
ThemeSchema is perfect for:
358+
359+
- **Brand consistency** - Maintain consistent visual identity across applications
360+
- **White-labeling** - Enable multi-tenant applications with custom branding
361+
- **Accessibility** - Provide light/dark modes for user preference
362+
- **Design systems** - Implement comprehensive design tokens
363+
- **A/B testing** - Test different color schemes and typography
364+
355365
## Best Practices
356366

357367
1. **Use semantic colors** - Stick to the semantic color tokens for consistency

content/docs/guide/phase2-schemas.md

Lines changed: 107 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
---
2-
title: "Phase 2 Schema Reference"
3-
description: "Complete reference for ObjectUI Phase 2 schemas including App, Theme, Reports, Blocks, and Enhanced Actions"
2+
title: "Phase 2 Schemas Overview"
3+
description: "Comprehensive overview of ObjectUI Phase 2 schemas for building enterprise applications"
44
---
55

6-
# Phase 2 Schema Reference
6+
# Phase 2 Schemas Overview
77

8-
ObjectUI Phase 2 introduces advanced schemas for enterprise applications, providing comprehensive solutions for theming, reporting, reusable components, and complex action workflows.
8+
ObjectUI Phase 2 introduces powerful new schemas that enable you to build sophisticated enterprise applications with advanced features like theming, reporting, reusable components, and complex workflows. This guide provides an overview of all Phase 2 schemas and helps you get started quickly.
99

10-
## New Schemas
10+
## What's New in Phase 2?
11+
12+
Phase 2 brings enterprise-grade capabilities to ObjectUI, making it easier to build production-ready applications:
13+
14+
- **Application Structure** - Define complete multi-page applications with navigation
15+
- **Dynamic Theming** - Brand your applications with custom themes and light/dark modes
16+
- **Advanced Actions** - Build complex workflows with API calls, chaining, and conditions
17+
- **Enterprise Reporting** - Generate, schedule, and export comprehensive reports
18+
- **Reusable Components** - Create and share component blocks across projects
19+
20+
## Core Schemas
1121

1222
### Application Configuration
1323

@@ -172,19 +182,23 @@ Advanced filtering interface with multiple field types.
172182
### [Sort UI](/docs/components/sort-ui)
173183
Sort configuration with multiple fields.
174184

175-
## Getting Started
185+
## Installation & Setup
176186

177-
### Installation
187+
### Package Installation
178188

179-
All Phase 2 schemas are included in `@object-ui/types`:
189+
All Phase 2 schemas are included in `@object-ui/types`. Install it in your project:
180190

181191
```bash
182192
npm install @object-ui/types
183193
# or
184194
pnpm add @object-ui/types
195+
# or
196+
yarn add @object-ui/types
185197
```
186198

187-
### Basic Usage
199+
### TypeScript Usage
200+
201+
Import the type definitions you need:
188202

189203
```typescript
190204
import type {
@@ -198,7 +212,7 @@ import type {
198212

199213
### Runtime Validation
200214

201-
Use Zod schemas for runtime validation:
215+
For runtime validation, use the included Zod schemas:
202216

203217
```typescript
204218
import {
@@ -212,18 +226,21 @@ import {
212226
const result = AppSchema.safeParse(myConfig);
213227
if (result.success) {
214228
// Valid configuration
229+
const app = result.data;
215230
} else {
216231
// Handle validation errors
232+
console.error(result.error);
217233
}
218234
```
219235

220-
## Examples
236+
## Quick Start Example
221237

222-
### Complete Application
238+
Here's a complete example showing how to build a simple CRM application using Phase 2 schemas:
223239

224240
```typescript
225241
import type { AppSchema, ThemeSchema } from '@object-ui/types';
226242

243+
// Define your application structure
227244
const app: AppSchema = {
228245
type: 'app',
229246
name: 'enterprise-crm',
@@ -259,6 +276,7 @@ const app: AppSchema = {
259276
]
260277
};
261278

279+
// Configure your theme
262280
const theme: ThemeSchema = {
263281
type: 'theme',
264282
mode: 'system',
@@ -272,52 +290,96 @@ const theme: ThemeSchema = {
272290
};
273291
```
274292

275-
## Migration Guide
293+
This creates a professional-looking CRM application with:
294+
- A sidebar layout with navigation menu
295+
- Sales section with leads and deals
296+
- User menu with profile and logout options
297+
- Professional theme with light/dark mode support
276298

277-
If you're upgrading from Phase 1, here's what's new:
299+
## Upgrading from Phase 1
278300

279-
### ActionSchema Enhancements
280-
- ✅ New `ajax`, `confirm`, `dialog` action types
281-
- ✅ Action chaining with `chain` array
282-
- ✅ Conditional execution with `condition`
283-
- ✅ Callbacks with `onSuccess` and `onFailure`
284-
- ✅ Tracking with `tracking` config
301+
If you're currently using ObjectUI Phase 1, here's what's new and how to upgrade:
285302

286303
### New Top-Level Schemas
287-
-`AppSchema` - Application configuration
288-
-`ThemeSchema` - Theming system
289-
-`ReportSchema` - Reporting system
290-
-`BlockSchema` - Reusable blocks
291304

292-
### View Enhancements
293-
-`DetailViewSchema` - Rich detail pages
294-
-`ViewSwitcherSchema` - View mode toggling
295-
-`FilterUISchema` - Enhanced filtering
296-
-`SortUISchema` - Sort configuration
305+
Phase 2 introduces four new top-level schemas:
306+
307+
- **`AppSchema`** - Define your entire application structure (new in Phase 2)
308+
- **`ThemeSchema`** - Configure themes and color palettes (new in Phase 2)
309+
- **`ReportSchema`** - Create data reports with aggregation (new in Phase 2)
310+
- **`BlockSchema`** - Build reusable component blocks (new in Phase 2)
311+
312+
### Enhanced ActionSchema
313+
314+
The `ActionSchema` has been significantly enhanced with:
315+
316+
- ✅ New action types: `ajax`, `confirm`, `dialog`
317+
- ✅ Action chaining via the `chain` array (sequential or parallel)
318+
- ✅ Conditional execution with the `condition` property
319+
- ✅ Success/failure callbacks: `onSuccess` and `onFailure`
320+
- ✅ Event tracking with the `tracking` configuration
321+
- ✅ Automatic retry logic
322+
323+
### New View Components
324+
325+
Phase 2 includes enhanced view components:
297326

298-
## Resources
327+
- **`DetailViewSchema`** - Rich detail pages with sections and tabs
328+
- **`ViewSwitcherSchema`** - Toggle between list, grid, kanban, calendar views
329+
- **`FilterUISchema`** - Advanced filtering interface
330+
- **`SortUISchema`** - Multi-field sort configuration
331+
332+
### Backward Compatibility
333+
334+
Phase 2 is fully backward compatible with Phase 1 schemas. You can:
335+
336+
- Continue using existing Phase 1 schemas
337+
- Gradually adopt Phase 2 features
338+
- Mix Phase 1 and Phase 2 schemas in the same application
339+
340+
### Migration Steps
341+
342+
1. **Update package** - Install latest `@object-ui/types`
343+
```bash
344+
npm install @object-ui/types@latest
345+
```
346+
347+
2. **Add AppSchema** - Wrap your pages in an application structure (optional)
348+
349+
3. **Configure theme** - Add a ThemeSchema for consistent styling (optional)
350+
351+
4. **Enhance actions** - Update critical actions to use new features like `confirm` and callbacks
352+
353+
5. **Test thoroughly** - Verify all existing functionality works as expected
354+
355+
## Learning Resources
299356

300357
### Documentation
301-
- [PHASE2_IMPLEMENTATION.md](https://github.com/objectstack-ai/objectui/blob/main/packages/types/PHASE2_IMPLEMENTATION.md) - Complete implementation guide
302-
- [PHASE2_QUICK_START.md](https://github.com/objectstack-ai/objectui/blob/main/PHASE2_QUICK_START.md) - Quick start guide
358+
- **[Implementation Guide](https://github.com/objectstack-ai/objectui/blob/main/packages/types/PHASE2_IMPLEMENTATION.md)** - Complete implementation details and technical specifications
359+
- **[Quick Start Guide](https://github.com/objectstack-ai/objectui/blob/main/PHASE2_QUICK_START.md)** - Step-by-step tutorial for getting started with Phase 2
303360

304361
### API Reference
305-
- [TypeScript Types](https://github.com/objectstack-ai/objectui/tree/main/packages/types/src)
306-
- [Zod Validation](https://github.com/objectstack-ai/objectui/tree/main/packages/types/src/zod)
362+
- **[TypeScript Types](https://github.com/objectstack-ai/objectui/tree/main/packages/types/src)** - Browse all type definitions
363+
- **[Zod Validation Schemas](https://github.com/objectstack-ai/objectui/tree/main/packages/types/src/zod)** - Runtime validation schemas
307364

308-
### Examples
309-
- [Test Suite](https://github.com/objectstack-ai/objectui/blob/main/packages/types/src/__tests__/phase2-schemas.test.ts) - 40+ example configurations
365+
### Code Examples
366+
- **[Test Suite](https://github.com/objectstack-ai/objectui/blob/main/packages/types/src/__tests__/phase2-schemas.test.ts)** - 40+ working examples demonstrating all Phase 2 features
310367

311-
## Support
368+
## Getting Help
312369

313-
Need help? Check out:
314-
- [GitHub Issues](https://github.com/objectstack-ai/objectui/issues)
315-
- [Discussions](https://github.com/objectstack-ai/objectui/discussions)
316-
- [Documentation](https://objectui.com/docs)
370+
### Community Support
371+
- **[GitHub Discussions](https://github.com/objectstack-ai/objectui/discussions)** - Ask questions and share ideas
372+
- **[GitHub Issues](https://github.com/objectstack-ai/objectui/issues)** - Report bugs and request features
373+
374+
### Official Documentation
375+
- **[Documentation Site](https://objectui.com/docs)** - Full documentation and guides
376+
- **[Schema Reference](/docs/core)** - Detailed schema documentation
317377

318378
## Next Steps
319379

320-
1. Review individual schema documentation
321-
2. Check out the [Quick Start Guide](https://github.com/objectstack-ai/objectui/blob/main/PHASE2_QUICK_START.md)
322-
3. Explore [test examples](https://github.com/objectstack-ai/objectui/blob/main/packages/types/src/__tests__/phase2-schemas.test.ts)
323-
4. Build your first Phase 2 application!
380+
Ready to build with Phase 2? Here's what to do next:
381+
382+
1. **[Review schema documentation](/docs/core)** - Learn about each schema in detail
383+
2. **[Try the Quick Start](https://github.com/objectstack-ai/objectui/blob/main/PHASE2_QUICK_START.md)** - Build your first Phase 2 application
384+
3. **[Explore examples](https://github.com/objectstack-ai/objectui/blob/main/packages/types/src/__tests__/phase2-schemas.test.ts)** - See real-world usage patterns
385+
4. **[Join the community](https://github.com/objectstack-ai/objectui/discussions)** - Connect with other developers

0 commit comments

Comments
 (0)