Skip to content

Commit de335f9

Browse files
os-zhuangclaude
andcommitted
feat(app-showcase): Command Center — a kind:'jsx' page (ADR-0080)
A polished home page authored entirely as constrained JSX + Tailwind source, compiled to the SDUI tree at save time and rendered by the normal PageRenderer. Browser-verified against the live registry (flex/grid/card/text/badge/stack). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c295ab7 commit de335f9

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import { definePage } from '@objectstack/spec/ui';
4+
5+
/**
6+
* Command Center — a `kind:'jsx'` page (ADR-0080). The entire layout is
7+
* authored as a constrained JSX + Tailwind *string*; at save time
8+
* `@objectstack/sdui-parser` compiles it (parse, never execute) into the SDUI
9+
* tree, which the normal PageRenderer / SchemaRenderer renders. Every tag is a
10+
* real registered component — `flex`, `grid`, `card`, `text`, `badge`, `stack`.
11+
*
12+
* Demonstrates what the fixed page schema cannot: Tailwind-freeform layout that
13+
* still composes the platform's real components. Browser-verified.
14+
*/
15+
export const CommandCenterJsxPage = definePage({
16+
name: 'showcase_command_center_jsx',
17+
label: 'Command Center (JSX)',
18+
type: 'home',
19+
kind: 'jsx',
20+
source: `
21+
<flex direction="col" className="min-h-screen gap-10 bg-gradient-to-br from-slate-50 via-white to-indigo-50 p-10">
22+
23+
<flex direction="col" className="gap-3">
24+
<badge className="w-fit rounded-full bg-indigo-100 px-3 py-1 text-xs font-semibold uppercase tracking-widest text-indigo-700" label="Operations · JSX-source page" />
25+
<text className="block text-5xl font-bold tracking-tight text-slate-900" content="Command Center" />
26+
<text className="block max-w-2xl text-base leading-relaxed text-slate-500" content="This whole page is authored as constrained JSX + Tailwind and compiled to the SDUI tree — parsed, never executed. Every card is a real registered component." />
27+
</flex>
28+
29+
<grid columns={4} className="gap-5">
30+
<card className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm">
31+
<text className="block text-sm font-medium text-slate-500" content="Open Tasks" />
32+
<text className="mt-3 block text-4xl font-bold text-slate-900" content="128" />
33+
<text className="mt-2 block text-xs font-semibold text-emerald-600" content="▲ 12% vs last week" />
34+
</card>
35+
<card className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm">
36+
<text className="block text-sm font-medium text-slate-500" content="In Progress" />
37+
<text className="mt-3 block text-4xl font-bold text-slate-900" content="47" />
38+
<text className="mt-2 block text-xs font-semibold text-amber-600" content="● 9 due today" />
39+
</card>
40+
<card className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm">
41+
<text className="block text-sm font-medium text-slate-500" content="Completed" />
42+
<text className="mt-3 block text-4xl font-bold text-slate-900" content="1,902" />
43+
<text className="mt-2 block text-xs font-semibold text-emerald-600" content="▲ 4% this month" />
44+
</card>
45+
<card className="rounded-2xl border border-indigo-300 bg-gradient-to-br from-indigo-500 to-violet-600 p-6 shadow-md">
46+
<text className="block text-sm font-medium text-indigo-100" content="Cycle Time" />
47+
<text className="mt-3 block text-4xl font-bold text-white" content="2.4d" />
48+
<text className="mt-2 block text-xs font-semibold text-indigo-100" content="▼ 18% faster" />
49+
</card>
50+
</grid>
51+
52+
<grid columns={3} className="gap-5">
53+
<card className="col-span-2 rounded-2xl border border-slate-200 bg-white p-6 shadow-sm">
54+
<text className="block text-lg font-semibold text-slate-900" content="Weekly Throughput" />
55+
<flex direction="row" className="mt-8 items-end gap-4">
56+
<flex className="h-12 w-full rounded-lg bg-indigo-400" />
57+
<flex className="h-20 w-full rounded-lg bg-indigo-500" />
58+
<flex className="h-16 w-full rounded-lg bg-indigo-400" />
59+
<flex className="h-28 w-full rounded-lg bg-violet-500" />
60+
<flex className="h-14 w-full rounded-lg bg-indigo-400" />
61+
<flex className="h-24 w-full rounded-lg bg-indigo-500" />
62+
<flex className="h-10 w-full rounded-lg bg-indigo-300" />
63+
</flex>
64+
</card>
65+
<card className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm">
66+
<text className="block text-lg font-semibold text-slate-900" content="Recent Activity" />
67+
<stack className="mt-4 gap-3">
68+
<flex direction="row" className="items-center gap-3"><flex className="h-2 w-2 rounded-full bg-emerald-500" /><text className="text-sm text-slate-600" content="Onboarding flow shipped" /></flex>
69+
<flex direction="row" className="items-center gap-3"><flex className="h-2 w-2 rounded-full bg-indigo-500" /><text className="text-sm text-slate-600" content="12 tasks moved to Review" /></flex>
70+
<flex direction="row" className="items-center gap-3"><flex className="h-2 w-2 rounded-full bg-amber-500" /><text className="text-sm text-slate-600" content="SLA breach on #4821" /></flex>
71+
<flex direction="row" className="items-center gap-3"><flex className="h-2 w-2 rounded-full bg-slate-300" /><text className="text-sm text-slate-600" content="Sprint 42 planning" /></flex>
72+
</stack>
73+
</card>
74+
</grid>
75+
</flex>`,
76+
});

examples/app-showcase/src/pages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export { MyWorkPage } from './my-work.page.js';
1515
export { SettingsPage } from './settings.page.js';
1616
export { StylingGalleryPage } from './styling-gallery.page.js';
1717
export { CommandCenterPage } from './command-center.page.js';
18+
export { CommandCenterJsxPage } from './command-center-jsx.page.js';
1819
export { PageVariablesPage } from './page-variables.page.js';
1920
export { ContactFormPage } from './contact-form.page.js';
2021
export {

0 commit comments

Comments
 (0)