Skip to content

Fit long study names on every surface that shows one - #817

Merged
InfinityBowman merged 1 commit into
mainfrom
fix/long-study-names
Sep 15, 2026
Merged

InfinityBowman merged 1 commit into
mainfrom
fix/long-study-names

Conversation

@InfinityBowman

Copy link
Copy Markdown
Owner

Closes #815.

Study names arrive from citation titles and PDF filenames and routinely run past 200 characters. Every surface that shows one handled it differently and none handled it well: the card header wrapped into the reviewer avatars, three tabs cut the name with no way to read it, the results tables shoved the judgement pills behind a scrollbar, the charts cut at 20 characters, and the PDF export ran off the page.

What changes

  • TruncatedText + useIsTruncated: single-line text whose tooltip only mounts while the text is actually clipped, so short names stay quiet. Used by the to-do, completed, reconcile and assign-reviewers rows and both overview results tables.
  • InlineEdit gains truncate: the study card header and study sheet title clip to one line with the same tooltip instead of wrapping. Callers that want the whole value (descriptions) are unchanged.
  • Overview results tables: the study column is capped at 22rem so a long name cannot widen the table.
  • Traffic-light chart: labels are fitted to a 240px margin with an ellipsis instead of a blind 20-character cut, and the full name is kept as an SVG <title> for hover.
  • PDF export: section and subsection header text is fitted to the bar width. jsPDF neither wraps nor clips on its own.
  • fitToWidth: one shared estimate-then-shrink fitter behind the chart and the PDF, so both take a couple of measurements per name rather than one per character.

The ResizeObserver mock in the test setup becomes a function expression because vitest 4 rejects new on an arrow-function implementation.

Not in this PR

Containing names at the source (defaulting new studies to an author-year name such as "Smith 2019") is a separate follow-up. It shortens the common case but does not remove the need for these fallbacks, since a bare PDF with no extractable metadata still lands on the filename.

Verification

  • pnpm typecheck, pnpm lint: clean
  • pnpm --filter web test: 56 files, 584 tests pass, including one test each for TruncatedText and fitToWidth

Study names arrive from citation titles and filenames and routinely run
past 200 characters. Each surface now clips to one line and offers the
full name when it is actually cut:

- TruncatedText and useIsTruncated: single-line text with a tooltip that
  only mounts while the text is clipped. Used by the to-do, completed,
  reconcile and assign-reviewers rows and both overview results tables.
- InlineEdit gains a truncate flag so the study card header and study
  sheet title clip instead of wrapping into the reviewer avatars.
- Overview results tables cap the study column so a long name cannot
  push the judgement pills behind the horizontal scrollbar.
- TrafficLightChart fits labels to a 240px margin instead of a blind
  20-character cut, keeping the full name as an SVG title.
- PDF export fits section header text to the bar width; jsPDF neither
  wraps nor clips on its own.
- fitToWidth is the shared estimate-then-shrink fitter behind the chart
  and the PDF.

The ResizeObserver test mock becomes a function expression because
vitest 4 rejects new on an arrow-function implementation.

Closes #815
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 44 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 58aebdfe-6387-45ef-8bcb-9269561ec4d7

📥 Commits

Reviewing files that changed from the base of the PR and between 74b8254 and 8885416.

📒 Files selected for processing (18)
  • packages/web/src/__tests__/setup.ts
  • packages/web/src/components/charts/TrafficLightChart.tsx
  • packages/web/src/components/project/all-studies-tab/study-card/StudyCardHeader.tsx
  • packages/web/src/components/project/assign-reviewers/ReviewerAssignment.tsx
  • packages/web/src/components/project/completed-tab/CompletedStudyRow.tsx
  • packages/web/src/components/project/overview-tab/AMSTAR2ResultsTable.tsx
  • packages/web/src/components/project/overview-tab/ChartSection.tsx
  • packages/web/src/components/project/overview-tab/ResultsTable.tsx
  • packages/web/src/components/project/reconcile-tab/ReconcileStudyRow.tsx
  • packages/web/src/components/project/study-sheet/StudySheet.tsx
  • packages/web/src/components/project/todo-tab/TodoStudyRow.tsx
  • packages/web/src/components/ui/__tests__/truncated-text.test.tsx
  • packages/web/src/components/ui/inline-edit.tsx
  • packages/web/src/components/ui/truncated-text.tsx
  • packages/web/src/hooks/useIsTruncated.ts
  • packages/web/src/lib/__tests__/fitToWidth.test.ts
  • packages/web/src/lib/export-pdf.ts
  • packages/web/src/lib/fitToWidth.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@InfinityBowman
InfinityBowman merged commit 0556bad into main Sep 15, 2026
10 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.

Handle study names that are much longer than the UI expects

1 participant