Skip to content

feat(examples): extract shared UI components into examples/shared#86

Merged
danielrx-echo merged 7 commits into
mainfrom
daniel/sonar-113
May 7, 2026
Merged

feat(examples): extract shared UI components into examples/shared#86
danielrx-echo merged 7 commits into
mainfrom
daniel/sonar-113

Conversation

@danielrx-echo

Copy link
Copy Markdown
Contributor

Summary

  • Moves 7 identical UI components (EntityCard, EntityDetailRows, EntityStateDescription, EligibilityResults, EntitiesList, CommitmentDataCard, NotEligibleMessage) from all four example apps into a single examples/shared/ directory
  • Wires a @shared path alias in each app (tsconfig paths + Vite resolve.alias) so imports read @shared/components/...
  • Fixes EntitiesList to use its existing sonarFrontendURL prop instead of importing sonarConfig directly — removes the only per-app import from that component
  • Updates generate-example.mjs to copy examples/shared/ alongside each distributed app so standalone builds remain self-contained

Components that stay per-app: AuthenticationSection (server actions vs props pattern differs by framework) and CommitCard (EVM receipt model vs SVM signature model).

Closes SONAR-113

Test plan

  • cd examples/framework/react-evm && pnpm dev — app loads, entity/sale components render
  • cd examples/framework/react-svm && pnpm dev — same
  • cd examples/framework/nextjs-evm && pnpm dev — same
  • cd examples/framework/nextjs-svm && pnpm dev — same
  • node examples/scripts/generate-example.mjs react-evm — builds successfully with shared dir copied to dist/shared/

@danielrx-echo danielrx-echo marked this pull request as ready for review May 7, 2026 09:01
DanielRX added 6 commits May 7, 2026 13:27
Consolidates 7 identical components (EntityCard, EntityDetailRows,
EntityStateDescription, EligibilityResults, EntitiesList,
CommitmentDataCard, NotEligibleMessage) from all four example apps into
examples/shared/. Each app now imports via @shared alias, wired through
tsconfig paths and Vite resolve.alias. The generate script copies the
shared directory alongside each distributed app so standalone builds
remain self-contained.
WillSewell
WillSewell previously approved these changes May 7, 2026
Comment thread eslint.config.mjs
{
// DOLATER: fix eslint violations in framework dirs and remove this ignore
ignores: ["**/node_modules/**", "**/dist/**", "contracts/**", "examples/framework/**"],
ignores: ["**/node_modules/**", "**/dist/**", "contracts/**", "examples/framework/**", "examples/shared/**"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be nice to actually fix this in a follow up while you're touching this

Comment thread examples/scripts/generate-example.mjs Outdated
.join("\n");
await writeFile(filePath, cleaned);
} catch {
// file may not exist (e.g. Next.js apps have no vite.config.ts)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could we catch "not exists" errors explicitly here and rethrow any others?

@danielrx-echo danielrx-echo merged commit aed829f into main May 7, 2026
8 checks passed
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.

3 participants