Skip to content

Commit de674d1

Browse files
Copilothotlong
andcommitted
Address code review: fix empty state routing for no-app create-app flow, update docs
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 2ab8f92 commit de674d1

3 files changed

Lines changed: 37 additions & 4 deletions

File tree

apps/console/src/App.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,18 @@ export function AppContent() {
250250
);
251251

252252
if (!dataSource || metadataLoading) return <LoadingScreen />;
253-
if (!activeApp) return (
253+
254+
// Allow create-app route even when no active app exists
255+
const isCreateAppRoute = location.pathname.endsWith('/create-app');
256+
257+
if (!activeApp && !isCreateAppRoute) return (
254258
<div className="h-screen flex items-center justify-center">
255259
<Empty>
256260
<EmptyTitle>No Apps Configured</EmptyTitle>
257261
<EmptyDescription>No applications have been registered.</EmptyDescription>
258262
<button
259263
className="mt-4 inline-flex items-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90"
260-
onClick={() => navigate('/apps/_/create-app')}
264+
onClick={() => navigate('create-app')}
261265
data-testid="create-first-app-btn"
262266
>
263267
Create Your First App
@@ -266,6 +270,17 @@ export function AppContent() {
266270
</div>
267271
);
268272

273+
// When on create-app without an active app, render a minimal layout with just the wizard
274+
if (!activeApp && isCreateAppRoute) {
275+
return (
276+
<Suspense fallback={<LoadingScreen />}>
277+
<Routes>
278+
<Route path="create-app" element={<CreateAppPage />} />
279+
</Routes>
280+
</Suspense>
281+
);
282+
}
283+
269284
// Expression context for dynamic visibility/disabled/hidden expressions
270285
const expressionUser = user
271286
? { name: user.name, email: user.email, role: user.role ?? 'user' }
@@ -436,7 +451,7 @@ function RootRedirect() {
436451
{!error && (
437452
<button
438453
className="mt-4 inline-flex items-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90"
439-
onClick={() => navigate('/apps/_/create-app')}
454+
onClick={() => navigate('/apps/_new/create-app')}
440455
data-testid="create-first-app-btn"
441456
>
442457
Create Your First App

content/docs/guide/console-architecture.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ The console uses React Router DOM v7 with a simple flat route structure:
5555
| `/apps/:appName/:objectName` | `ObjectView` | Object list with view switcher |
5656
| `/apps/:appName/:objectName/view/:viewId` | `ObjectView` | Specific view for an object |
5757
| `/apps/:appName/:objectName/record/:recordId` | `RecordDetailView` | Single-record detail |
58+
| `/apps/:appName/create-app` | `CreateAppPage` | App creation wizard (4-step) |
59+
| `/apps/:appName/edit-app/:editAppName` | `EditAppPage` | Edit existing app configuration |
5860

5961
## Key Patterns
6062

@@ -101,7 +103,19 @@ The console's `ObjectView` is a **thin wrapper** around `@object-ui/plugin-view`
101103
- Passes a `renderListView` callback for multi-view rendering (kanban, calendar, chart)
102104
- Handles console-specific concerns: URL routing, MetadataInspector, record detail Sheet
103105

104-
### 4. Branding
106+
### 4. App Creation & Editing
107+
108+
The console integrates the `AppCreationWizard` from `@object-ui/plugin-designer` for creating and editing apps:
109+
110+
- **Create App**`CreateAppPage` at `/apps/:appName/create-app`. Passes metadata objects as `availableObjects`, handles `onComplete` (converts draft via `wizardDraftToAppSchema()`, navigates to new app), `onCancel` (navigate back), and `onSaveDraft` (localStorage persistence).
111+
- **Edit App**`EditAppPage` at `/apps/:appName/edit-app/:editAppName`. Loads existing app config as `initialDraft` and updates on completion.
112+
113+
**Entry Points:**
114+
- AppSidebar app switcher → "Add App" / "Edit App" buttons
115+
- CommandPalette (⌘+K) → "Create New App" command in Actions group
116+
- Empty state CTA → "Create Your First App" button when no apps are configured
117+
118+
### 5. Branding
105119

106120
Per-app branding is applied via `AppShell`'s `branding` prop:
107121

content/docs/guide/console.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The console opens at **http://localhost:5175** with MSW (Mock Service Worker) pr
2828
| **Expression Visibility** | Show/hide navigation items using `visible: "${data.role === 'admin'}"`. |
2929
| **Branding** | Per-app colors, favicons, and logos via `AppShell` branding. |
3030
| **Command Palette** | `⌘+K` opens a searchable command bar for quick navigation. |
31+
| **App Creation Wizard** | 4-step wizard (Basic Info → Objects → Navigation → Branding) to create or edit apps. |
3132
| **Error Boundary** | Graceful error handling with a retry button. |
3233

3334
## Configuration
@@ -88,6 +89,9 @@ apps/console/
8889
ConsoleLayout.tsx # AppShell wrapper
8990
ObjectView.tsx # Object list view (wraps plugin-view)
9091
RecordDetailView.tsx # Single-record detail view
92+
pages/
93+
CreateAppPage.tsx # App creation wizard page
94+
EditAppPage.tsx # Edit existing app page
9195
context/
9296
ExpressionProvider.tsx # Expression evaluation context
9397
hooks/

0 commit comments

Comments
 (0)