Repository navigation
feat(demo-schema-react): render the research card related documents - #8675
dguerinCoveo wants to merge 8 commits into
Conversation
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
commit: |
|
Tip All tests passed and all changes approved!🟢 UI Tests: 439 tests unchanged |
|
Tip All tests passed and all changes approved!🟢 UI Tests: 439 tests unchanged |
fbeaudoincoveo
left a comment
There was a problem hiding this comment.
What this PR is currently lacking is adjustments in the mock service (based on the schema changes in https://github.com/coveo-platform/thermidor-schema/pull/152) to be able to test the feature before actually implementing it in the backend.
See for instance what I did in this PR stack to add breadbox support:
- #8640 (simulate breadbox in mock service responses, based on schema changes in https://github.com/coveo-platform/thermidor-schema/pull/158)
- #8642 (rendering in demo-schema-react, similar to what you did in this PR)
f84da2e to
d2ba2b3
Compare
The ProductResearchCard lists the relatedDocuments the agent sends, with each document's file type and size. createThermidorCatalog takes a productResearchCard.maxLinks option (default 10) that caps the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Render a document without a link as plain text, drop the separator when the file type or size is missing, label the section by its heading, and round the size before choosing its unit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The demo creates its catalog with productResearchCard.maxLinks set to 5. The component default stays 10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nentid thermidor-schema#152 ships related documents without permanentid, and only title is required, so file type and size are optional in the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The catalog builds the card through createProductResearchCard, so the prebuilt ProductResearchCard and the exported default limit are unused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A document with neither a title nor a link no longer takes a maxLinks slot. Tests cover negative, fractional and infinite maxLinks, as the option's doc comment describes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…earch card The documents move out of the card into a full-width "Documentation & manuals" section: one row per document with a file icon, the title and the file type and size. The whole row opens the document. Sizes use decimal units, like 333.2 kB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bb4a65a to
21fb08e
Compare
Added a mock server in pr1 |
There was a problem hiding this comment.
🟡 Changes recommended
Document metadata contrast falls below WCAG AA requirements on both normal and hover/focus backgrounds.
1 open finding
What changed in this PR
Adds related documentation to the React demo’s product research cards, using documents supplied by the agent and mock service.
Changes:
- Renders document rows with optional links, file types, and decimal file sizes.
- Adds configurable document limits: 10 by default, 5 in the demo.
- Extends tests and updates the component documentation.
| File | Description |
|---|---|
| samples/thermidor/demo-schema-react/src/components/AppShell.tsx | Limits displayed documents to five. |
| samples/thermidor/demo-schema-react/src/a2ui/ProductResearchCard/ProductResearchCard.tsx | Renders documents and formats sizes. |
| samples/thermidor/demo-schema-react/src/a2ui/ProductResearchCard/ProductResearchCard.test.tsx | Tests rendering, limits, and formatting. |
| samples/thermidor/demo-schema-react/src/a2ui/ProductResearchCard/ProductResearchCard.module.css | Styles document rows and interaction states. |
| samples/thermidor/demo-schema-react/src/a2ui/mount-surface.harness.tsx | Supports catalog options in tests. |
| samples/thermidor/demo-schema-react/src/a2ui/icons/index.ts | Exports the file icon. |
| samples/thermidor/demo-schema-react/src/a2ui/icons/FileIcon.tsx | Adds a decorative document icon. |
| samples/thermidor/demo-schema-react/src/a2ui/components.tsx | Passes options to the research-card factory. |
| samples/thermidor/demo-schema-react/README.md | Documents the related-document input. |
🧠 Review effort: Balanced
The file type and size line used the muted text colour, below WCAG AA contrast on the row and its hover background. It now uses the secondary text colour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Jira
https://coveord.atlassian.net/browse/SVCC-6607
Motivation
Stacked on #8710, which adds the documents to the mock service and pins the schema.
The demo's Product Education answer now lists the product's related documents, such as manuals and installation guides, in a "Documentation & manuals" section under the research card. The agent sends them on the card state as
relatedDocuments(agent-smith#988), and each client chooses how many to show.Changes
ProductResearchCardrenders the documents below the card, one row each: a file icon, the title, and the file type and size (PDF - 333.2 kB). The whole row opens the document in a new tab. The section is hidden when there are none.maxLinksoption (default 10), set throughcreateThermidorCatalog({productResearchCard: {maxLinks}}). The demo app shows 5.Details
titleis required on a document. File type and size show only when present, a document without a link renders as plain text, and one with neither a title nor a link is skipped.createThermidorCatalog()without options behaves as before.Validation
pnpm --filter @coveo/thermidor run build, then insamples/thermidor/demo-schema-reactrunpnpm exec vitest run src/a2ui/ProductResearchCard. All 28 tests pass.pnpm exec tsc --noEmit -p .. No errors.pnpm dev:mock, then sendtell me more about the thermoflex winter wetsuit. The card shows, then 5 of the 6 mock documents as rows.Screenshots
Checklist
feat(<scope>): <description>)pnpm changeset) if modifying public package source code: not needed, the demo is a private sample.🤖 Generated with Claude Code