Skip to content

feat(ui): add resource-kit, auth-pages and dashboard-tiles for generated apps - #55

Open
yyyyaaa wants to merge 8 commits into
mainfrom
feat/fast-app-path
Open

yyyyaaa wants to merge 8 commits into
mainfrom
feat/fast-app-path

Conversation

@yyyyaaa

@yyyyaaa yyyyaaa commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Three registry items for the apps Constructive Desktop generates, so a generated Next.js app installs its screens from @constructive instead of carrying a copy of blocks.

What's added

  • resource-kit: list, detail and form screens generated from resource definitions.
    • A view with search, sort, pagination, and empty and error states.
    • A table that formats cells by field, shows option badges and relation labels, and folds columns in narrow panes.
    • A create and edit sheet with validation, async relation pickers and many-to-many links.
    • A record view with has-many lists, and delete confirmation.
    • In-memory sources and a memory router (createMemorySource, useMemoryRouter, MemoryRoute) for demos, stories and tests.
  • auth-pages: sign-in, sign-up, check-email, verify and reset panels, with the submit handlers passed in.
  • dashboard-tiles: count and recent-record tiles over resource-kit sources.
  • Framework- and backend-neutral. Data comes through an injected source and routing through an injected router, so nothing imports next/* or a GraphQL client. They're built from blocks' existing parts (workspace-kit panels and table surface, constructive-theme tokens, form-kit controls), with no new look.
  • Registry entries are enough to wire them. Each entry's docs field says how to wire the item, so a coding agent can install and connect it without reading the source.
  • Coverage:
    • docs pages with live previews (apps/blocks/src/lib/app-kit/)
    • stories with break-ui cases
    • unit tests (packages/ui/test/resource-kit.test.tsx, auth-pages.test.tsx)
    • a smoke-install step that installs the three items into a scratch app from the built registry
  • ToneBadge fix: the corners no longer show the tone's background past the border.
  • ViewFrame fix: a view inside a column layout, as the resource-kit screens are, now scrolls its body. Before, it grew past the window and WorkspaceShell cut off long lists and record views. Views placed directly in the shell look the same.
pnpm dlx shadcn@latest add @constructive/resource-kit @constructive/auth-pages @constructive/dashboard-tiles

After merge

Deploy Pages. The composed app template in constructive-io/sandbox-templates installs these items from https://constructive-io.github.io/blocks/r/{name}.json, and its CI pins 734b33b from this branch until the merged SHA replaces it.

Screenshots

To add (gh can't upload images): resource-kit list, sheet and record view in light and dark; the auth panels; the tiles; and the ToneBadge corners before and after.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TzSs1SgpRVHH81mRAK3ecK

resource-kit renders list, detail and form screens for an app's own tables
from a resource definition and a host-supplied source, with relation pickers,
many-to-many links and delete. auth-pages are the account panels with
injected handlers, and dashboard-tiles are count and recent-record tiles over
resource-kit sources. All three are framework- and backend-agnostic: routing
and data come in through adapters.
@tenki-reviewer

tenki-reviewer Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 2 medium

💬 Inline comments (2)

  • 🟡 @tanstack/react-query missing from runtime dependency declarations — package.json:852
  • 🟡 Folded-column summary omits columns 4 and beyond — data-table.tsx:162
🧹 Nitpicks (3) — 🟢 3 low
  • 🟢 Module-scope attempts counter leaks across stories (AuthPages.stories.tsx:28) — let attempts = 0 lives at module scope in packages/ui/src/stories/break-ui/AuthPages.stories.tsx:28 and the worst handler flips success/failure on attempts % 2 (lines 38-39).
  • 🟢 Dataset toggle labels the huge state 1,000 rows; fixture builds 10,000 (dataset.tsx:16) — DATASET_LABELS.huge reads '1,000 rows' in packages/ui/src/stories/break-ui/dataset.tsx:16, but hugeCrm in packages/ui/src/stories/break-ui/resource-worst-case.ts:65-73 generates 10,000 contacts and 10,000 deals.
  • 🟢 Verify-email success card dead-ends without links (verify-email-panel.tsx:60) — When verification succeeds but the host passes neither links.continue nor links.signIn, the success card renders only the 'Email verified' heading and description with no onward action and no footer (packages/ui/src/components/auth-pages/verify-email-panel.tsx:60-65); the verified AuthCard also omits the footer the other two states include.

The PR introduces three new application blocks in packages/ui/src/components: Resource Kit (generated list/detail/form CRUD machinery over injected data sources with TanStack Query caching and many-to-many linking), Auth Pages (six account panels with validation and injected handlers), and Dashboard Tiles (stat, count, and recent-records tiles sharing the same data-source contracts). Registry entries, docs-site routes and previews, and smoke-install consumers are wired for all three.

Files Change
packages/ui/src/components/resource-kit/* New CRUD kit: provider/context, memory source, queries, entity form and sheet, data table, relation picker, nav, and save-failure UI
packages/ui/src/components/auth-pages/* New auth kit: six panels, shared use-auth-form, auth card/layout, password input, and types
packages/ui/src/components/dashboard-tiles/* New tiles kit: DashboardGrid, StatTile, ResourceCountTile, RecentRecords
apps/blocks/src/** Docs-site pages, preview shells, ApplicationBlockDoc entries, doc navigation, and @source Tailwind lines
apps/registry/scripts/smoke-install.ts, packages/*/registry.json, packages/ui/package.json Registry manifests, smoke consumers, and the @tanstack/react-query dev dependency
packages/ui/src/stories/**, packages/ui/test/* Storybook stories including break-ui worst-case fixtures and flow tests for the two functional kits

Reviewed commit: 734b33b

@tenki-reviewer tenki-reviewer Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds three new @constructive registry application blocks — Resource Kit, Auth Pages, and Dashboard Tiles — plus docs-site pages, smoke-install consumers, and Storybook stories and tests.

Key findings

  • 🟡 @tanstack/react-query missing from runtime dependency declarations — package.json:852
  • 🟡 Folded-column summary omits columns 4 and beyond — data-table.tsx:162

Comment thread packages/ui/package.json
"@storybook/addon-a11y": "^10.1.11",
"@storybook/react-vite": "^10.1.11",
"@tailwindcss/postcss": "^4.1.18",
"@tanstack/react-query": "^5.90.16",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 bug · medium

@tanstack/react-query missing from runtime dependency declarations

@tanstack/react-query is declared only in devDependencies (packages/ui/package.json:852), yet the new Resource Kit and dashboard-tiles code imports it at runtime (e.g. packages/ui/src/components/resource-kit/queries.ts and context.tsx). Consumers installing @constructive-io/ui from npm get no dependency or peer declaration for it, so module resolution fails unless they happen to install it themselves. Sibling runtime libraries like lucide-react and react are declared as peerDependencies, so react-query is the odd one out.

📋 Prompt for AI Agents

In packages/ui/package.json, add "@tanstack/react-query": "^5.90.16" (or a suitable range) to the peerDependencies block (around line 811) alongside lucide-react and react, keeping the existing devDependencies entry at line 852 for the workspace build. The new resource-kit and dashboard-tiles components import @tanstack/react-query at runtime, so npm consumers currently receive no dependency declaration for it and module resolution fails unless they install it themselves.

Comment on lines +162 to +165
const folded = fields
.slice(2, 4)
.map((field) => summary(field, row))
.filter((text): text is string => Boolean(text));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 bug · medium

Folded-column summary omits columns 4 and beyond

The summary line under the first cell is built only from fields.slice(2, 4) (packages/ui/src/components/resource-kit/data-table.tsx:163), but foldClass also hides columns 4-5 below @4xl/table and columns 6+ below @6xl/table — at the narrow widths where the summary renders, all columns from index 4 onward are hidden too. The doc comment says "Folded values are summarised under the first cell", yet those columns' values are completely unreachable on a narrow pane.

📋 Prompt for AI Agents

In packages/ui/src/components/resource-kit/data-table.tsx around lines 162-165, change fields.slice(2, 4) to fields.slice(2) so the folded summary under the first cell includes every column that foldClass (lines 46-49) hides at narrow container widths — columns 4-5 are hidden until @4xl/table and columns 6+ until @6xl/table, yet currently get no summary. Keep the existing .map(summary).filter(Boolean) chain.

The Pages artifact check rejects root-relative links outside /blocks. The
auth and resource previews route by component state, so their links now
render as #/<path> and the auth brand drops its href.
- resource-kit: useRecordDialogs owns the create, edit and delete dialogs
  that the list, related lists and record view each wired by hand;
  LoadFailure, queryFailure and NUMERIC_FORMATS replace repeated copies;
  MemoryRoute keeps id decoding next to useMemoryRouter's encoding; labels
  read related rows through one deduped detail cache.
- auth-pages: AuthCard hands the link component down, useAuthForm owns the
  values, and passwordRule gives sign-up and reset one minimum-length rule.
- Stories and the blocks previews route through useMemoryRouter and
  MemoryRoute instead of their own copies.

Before/after screenshots of the three previews (light and dark, 1280 and
390 wide) match pixel for pixel.
ViewFrame's section had no min-h-0, so as a flex-1 child of a column (the
wrapper resource-kit screens render) it grew to its content instead of
letting its body scroll. Inside WorkspaceShell's overflow-hidden frame a
long list or record view was cut off, with its pagination and lower
related lists out of reach. Views that sit directly in the shell's row
layout look the same, checked against the billing and data-rooms previews.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant