Skip to content

Swap out Library sample components for @cratis/components equivalents#377

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/swap-library-sample-components
Draft

Swap out Library sample components for @cratis/components equivalents#377
Copilot wants to merge 3 commits intomainfrom
copilot/swap-library-sample-components

Conversation

Copy link

Copilot AI commented Feb 24, 2026

The Library sample contained hand-rolled duplicates of components already provided by @cratis/components, and dialog forms used manual useState + PrimeReact primitives instead of the CommandForm abstraction.

Added dependency

  • @cratis/components added to Library/package.json

Command dialogs rewritten with CommandForm

AddAuthor and AddBook now use CommandDialog + typed field components from @cratis/components, eliminating manual state and imperative command wiring:

// Before
const [name, setName] = useState<string>('');
const [registerAuthor] = RegisterAuthor.use();
const handleAdd = async () => { registerAuthor.name = name; await registerAuthor.execute(); ... };
// <InputText value={name} onChange={e => setName(e.target.value)} />

// After
<CommandDialog command={RegisterAuthor} visible={true} header="Register author"
    onConfirm={() => closeDialog(DialogResult.Ok)}
    onCancel={() => closeDialog(DialogResult.Cancelled)}>
    <InputTextField<RegisterAuthor> value={c => c.name} title="Name" placeholder="Name" />
</CommandDialog>

AddBook additionally uses NumberField and DropdownField for author selection.

Duplicate components removed

The following local implementations are replaced by re-exports from @cratis/components:

Removed local file Source
Components/Common/{Page,FormElement,ErrorBoundary}.tsx @cratis/components/Common
Components/Dialogs/{ConfirmationDialog,BusyIndicatorDialog}.tsx @cratis/components/Dialogs
Components/DataTables/{DataTableForObservableQuery,DataTableForQuery}.tsx @cratis/components/DataTables
Components/DataPage/DataPage.tsx @cratis/components/DataPage

Each index.ts now re-exports from the package, keeping existing path-aliased imports working without changes to consumers.

Minor fixes

  • DefaultLayout.tsx imports ErrorBoundary directly from @cratis/components/Common
  • Authors.tsx / Inventory.tsx: added panel prop to <Page> (the @cratis/components version applies the panel CSS class conditionally); removed unused DialogResult imports

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • ofcncog2cu-dsn.algolia.net
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node /home/REDACTED/work/Samples/Samples/.yarn/releases/yarn-4.5.3.cjs add @cratis/components (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Swap out components in Library sample</issue_title>
<issue_description>Switch to using CommandForm from @cratis/arc.react, documentation can be found here:

https://www.cratis.io/docs/Arc/frontend/react/commands/command-form/index.html

For CommandForm fields, use the ones adapted for PrimeReact in the @cratis/components.
Also remove any components that already exist in @cratis/components and adapt the code to match them. Documentation can be found here:
https://www.cratis.io/docs/Components/index.html</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 24, 2026 07:03
Co-authored-by: einari <134365+einari@users.noreply.github.com>
…y sample

Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot AI changed the title [WIP] Swap components in Library sample to CommandForm Swap out Library sample components for @cratis/components equivalents Feb 24, 2026
Copilot AI requested a review from einari February 24, 2026 07:08
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.

Swap out components in Library sample

2 participants