Skip to content

fix: address explorer feedback issues#18

Merged
lewisjared merged 5 commits intomainfrom
fix/explorer-feedback-issues
Mar 30, 2026
Merged

fix: address explorer feedback issues#18
lewisjared merged 5 commits intomainfrom
fix/explorer-feedback-issues

Conversation

@lewisjared
Copy link
Copy Markdown
Contributor

Summary

Addresses multiple feedback items from the explorer review email:

  • Fix duplicate figures: Figure gallery now uses only latest_execution per group instead of iterating all executions, preventing repeated/outdated figures
  • LaTeX rendering in captions: Added KaTeX for rendering LaTeX math notation in figure captions (e.g., $^\circ$ renders as degree symbol). KaTeX is bundled as a separate chunk to minimize main bundle impact
  • Season ordering: Extended known category orderings to include "Annual"/"ANN" variants so box-whisker plots sort chronologically (Annual, DJF, MAM, JJA, SON)
  • X-axis labels always visible: Replaced hidden x-axis behavior (for >6 categories) with rotated labels at -45 degrees, so regional temperature trends labels are always readable
  • Remove placeholder cards: Filter out cards and content items marked as placeholder from the explorer view
  • Paginated figure galleries: Added optional pageSize prop to FigureGallery. Explorer galleries use pageSize=12 with previous/next controls so users can discover more figures without infinite scrolling. Diagnostics page retains infinite scroll

Not addressed (require diagnostic reruns)

  • Season acronym capitalization / spelling out "Annual"
  • Axis label capitalization (ECS/TCRE, Soil carbon, etc.)
  • "Time" vs "Year" axis label

Not addressed (needs investigation with live data)

  • AMOC "show outliers" error

Test plan

  • 21 new tests for LaTeX rendering and season sort ordering pass
  • Full frontend test suite passes (pre-existing failures in apiEndpoint.test.ts unrelated)
  • TypeScript and Biome checks pass
  • Verify duplicate figures no longer appear on Warming Levels page
  • Verify degree symbols render in figure captions
  • Verify season ordering on Atmosphere box-whisker plots
  • Verify regional temperature trend labels are visible
  • Verify placeholder cards (cloud radiative effects, SSS/SST) are hidden
  • Verify explorer figure galleries paginate correctly

- Fix duplicate figures by using only latest execution per group
- Add KaTeX for rendering LaTeX math in figure captions (e.g. degree symbols)
- Fix season ordering to include Annual alongside DJF/MAM/JJA/SON
- Show rotated x-axis labels instead of hiding them for charts with many categories
- Filter out placeholder cards from explorer view
- Fix figure gallery whitespace by using useLayoutEffect for scroll margin
- Tests for renderLatexToHtml and containsLatex (LaTeX to HTML conversion)
- Tests for sortCategories with season auto-detection, Annual variants,
  explicit ordering, and edge cases
- Export sortCategories and KNOWN_CATEGORY_ORDERS for testability
Add pageSize prop to FigureGallery that switches from infinite scroll
(window virtualizer) to paginated mode with previous/next controls
and a page counter. Explorer galleries use pageSize=12 by default
so users can see there are more figures without scrolling through
hundreds. Diagnostics page still uses infinite scroll.

Also extracts FigureCard as a reusable component.
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 30, 2026

Deploy Preview for climate-ref ready!

Name Link
🔨 Latest commit 7fe7392
🔍 Latest deploy log https://app.netlify.com/projects/climate-ref/deploys/69ca98b9f02b7f0008da3e9f
😎 Deploy Preview https://deploy-preview-18--climate-ref.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Explorer/Diagnostics frontend to address review feedback around figure duplication, LaTeX caption rendering, season ordering, axis label visibility, placeholder content filtering, and (optionally) paginated figure galleries.

Changes:

  • Add KaTeX-based inline LaTeX rendering for figure captions and split KaTeX into its own Rollup chunk.
  • Fix figure gallery duplication by only using each execution group’s latest_execution, add optional pagination, and filter out placeholder cards/content items in Explorer.
  • Extend season ordering (Annual variants) and rotate X-axis labels to keep them visible for many categories.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/vite.config.ts Adds manual chunking to bundle KaTeX separately.
frontend/src/lib/latex.ts Introduces KaTeX-based $...$ inline LaTeX rendering helper.
frontend/src/lib/latex.test.ts Adds unit tests for LaTeX detection/rendering and HTML escaping.
frontend/src/components/explorer/thematicContent.tsx Filters out placeholder cards and placeholder content items.
frontend/src/components/explorer/content/figureGalleryContent.tsx Enables paginated gallery mode in Explorer via pageSize={12}.
frontend/src/components/diagnostics/figureGallery.tsx Uses latest_execution to avoid duplicates; adds optional pagination and shared card rendering.
frontend/src/components/diagnostics/figure.tsx Renders LaTeX in figure captions via dangerouslySetInnerHTML when detected.
frontend/src/components/diagnostics/ensembleChart.tsx Extends known season ordering (Annual variants) and rotates X-axis labels instead of hiding them.
frontend/src/components/diagnostics/ensembleChart.test.ts Adds tests for season ordering/sorting behavior.
frontend/package.json Adds KaTeX dependency.
frontend/package-lock.json Locks KaTeX and its transitive dependency versions.
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Memoize KaTeX rendering in Figure component with useMemo
- Hoist LaTeX regex patterns to module scope to avoid re-creation
- Remove dead try/catch (KaTeX throwOnError:false handles errors)
- Remove redundant placeholder field from filtered cards
- Cap XAxis interval at ~20 labels for very large datasets
- Remove unnecessary comment
- Re-add try/catch in renderLatexToHtml with escaped fallback to
  prevent XSS if KaTeX throws an unexpected internal error
- Stop event propagation on FigureDropDown trigger button to prevent
  card onClick from firing when interacting with the dropdown menu
@lewisjared lewisjared merged commit 2c85260 into main Mar 30, 2026
7 checks passed
@lewisjared lewisjared deleted the fix/explorer-feedback-issues branch March 30, 2026 15:42
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.

2 participants