Skip to content

Fix question page redesign QA fixes#4774

Draft
ncarazon wants to merge 2 commits into
feat/question-page-redesign-1st-iterationfrom
fix/question-page-redesign-qa-fixes
Draft

Fix question page redesign QA fixes#4774
ncarazon wants to merge 2 commits into
feat/question-page-redesign-1st-iterationfrom
fix/question-page-redesign-qa-fixes

Conversation

@ncarazon
Copy link
Copy Markdown
Contributor

@ncarazon ncarazon commented May 22, 2026

Summary

This PR addresses a batch of QA-reported issues on the question page redesign across forecaster and consumer views.

Implemented:

  • Meta row truncation (meta_row.tsx): always shows default_project as the single visible chip; remaining projects collapsed under "{n} more…"
  • Conditional question timeline (question_page_shell, timeline/index.tsx): forecaster and consumer shells now render ConditionalTimeline for conditional posts
  • Overlay height clamping (use_overlay_max_height.ts, forecast cards): new hook caps expanded overlay to viewport bottom; content scrollable with fade gradient, collapse button always pinned visible
  • Chart height sync (consumer_list_chart_shell, chart components): list column height propagated via context as chartAreaHeight; charts dynamically fill available space, scaling down between 1024–1280 px
  • Key factor count fix (tab_bar.tsx): tab badge now includes aggregateCoherenceLinks count alongside key_factors
  • Resolution criteria drawer (question_page_shell, use_post_text_sections): fine print stays inside the resolution criteria drawer in forecaster mode, matching prod behaviour
  • Key factor placeholder (key_factors_grid_placeholder): 50% opacity by default, full opacity + border on hover; always shows "+ Add Key Factor"; triggers login modal for unauthenticated users
  • Chip fixes (compact_legend_bar): max-width widened to 300 px; full chip click toggles visibility; resolved winner shows (Yes) instead of forecast %; showAll orders winner first
  • Hover stuck-state (compact_legend_bar): removed item.highlighted from chip className, CSS hover: handles visual state, eliminating stuck-highlight race condition

Demo videos

  • Let’s update truncation to prioritize showing the main project fully, grouping the others under “more”
tag-truncation.mp4
  • Forecast Timeline section in Conditional Question pages
image
  • The expandable section
extendable-section.mp4
  • Between 1024px and 1280px, the left pane scales down to make room for the right pane
left-pane-scale-down.mp4
  • Charts dynamically fill the available height of the container they’re in
fill-the-available-height.mp4
  • The key factor count displays the correct count
key-factor-correct-count.mp4
  • Updated the placeholder box for key factors
updated-placeholder.mp4
  • Fine Print is part of the Resolution Criteria drawer in forecaster Mode
fine-print.mp4
  • Improved multiple-choice in forecaster UX & Hover Fixes
mc-checkbox.mp4
  • Show winning option label instead
winning-option.mp4

Summary by CodeRabbit

  • New Features

    • Resolution Criteria section now displays on question pages
    • Conditional posts show timeline visualization
    • Key factors count includes linked questions
  • Bug Fixes & UI/UX Improvements

    • Resolved YES/NO items now visually distinguished in charts
    • Project chips prioritize default project display
    • Expanded forecast cards become scrollable with improved height constraints
    • Key factor placeholder button interactions refined
    • Question page layout and height calculations improved across multiple components

Review Change Stack

…ng, chart height sync, key factor count and placeholder styling, resolution criteria drawer, chip truncation/click/resolved label, and hover stuck-state
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 66a61026-c9ce-47ea-89a1-f61887c75a7e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/question-page-redesign-qa-fixes

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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-4774-fix-question-page-redesign-qa-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:fix-question-page-redesign-qa-fixes-481e0a8
🗄️ PostgreSQL NeonDB branch preview/pr-4774-fix-question-page-redesign-qa
Redis Fly Redis mtc-redis-pr-4774-fix-question-page-redesign-qa

Details

  • Commit: 8b63b0eacbdf0efa60f8895a3eed1e126ada6372
  • Branch: fix/question-page-redesign-qa-fixes
  • Fly App: metaculus-pr-4774-fix-question-page-redesign-qa

ℹ️ Preview Environment Info

Isolation:

  • PostgreSQL and Redis are fully isolated from production
  • Each PR gets its own database branch and Redis instance
  • Changes pushed to this PR will trigger a new deployment

Limitations:

  • Background workers and cron jobs are not deployed in preview environments
  • If you need to test background jobs, use Heroku staging environments

Cleanup:

  • This preview will be automatically destroyed when the PR is closed

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
front_end/src/app/(main)/questions/[id]/components/question_view/consumer_question_view/consumer_list_chart_shell.tsx (1)

52-53: ⚡ Quick win

Centralize the chart-height offset contract.

40 is part of a cross-component sizing contract; keeping it as a local literal makes drift likely as chart header/toggle heights evolve. Consider moving these offsets into shared constants (or measured refs) used by shell + chart panels.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@front_end/src/app/`(main)/questions/[id]/components/question_view/consumer_question_view/consumer_list_chart_shell.tsx
around lines 52 - 53, The hardcoded offset "40" used when computing
chartAreaHeight in consumer_list_chart_shell.tsx is part of a cross-component
sizing contract and should be centralized; replace the literal with a shared
constant (e.g., CHART_HEADER_TOGGLE_OFFSET) exported from a shared
layout/constants module (or derive it from a measured ref exposed by the chart
panel) and use that constant in consumer_list_chart_shell.tsx and the
corresponding chart panels so both sides consume the same value (update
references to chartAreaHeight and any chart panels that assume the same offset).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@front_end/src/app/`(main)/questions/[id]/components/key_factors/key_factors_grid_placeholder.tsx:
- Around line 19-28: The placeholder uses a clickable div with onClick in
key_factors_grid_placeholder.tsx which breaks keyboard accessibility; change the
interactive variant to a semantic button (e.g., render a <button type="button">
when onClick is present) so it is focusable and keyboard-activatable, preserve
all className, onClick prop, and any aria attributes, and remove the
non-semantic onClick-div pattern; if for some reason you must keep a div, add
role="button", tabIndex={0} and handle keyDown (Enter/Space) to call the same
onClick handler, but prefer replacing the div with a button for correct
semantics.

In
`@front_end/src/app/`(main)/questions/[id]/components/question_page_shell/meta_row.tsx:
- Around line 40-51: The allProjects construction currently only filters out
defaultProject?.id, so the same project appearing in multiple projectsData
buckets can be duplicated; update the logic that builds allProjects (using
projectsData, defaultProject) to perform full deduplication by project id across
all buckets—e.g., iterate through the concatenated arrays (defaultProject first
if present, then the various projectsData arrays) and include each project only
if its id has not been seen before (use a Set of ids or a Map keyed by id) so
that items appearing in multiple buckets are de-duplicated and chips/"N more"
counts are accurate.

In
`@front_end/src/components/consumer_post_card/group_forecast_card/forecast_card_wrapper.tsx`:
- Around line 66-70: The footer fade uses a hardcoded light color
(METAC_COLORS.gray[0].DEFAULT) which breaks dark mode; update the element inside
ForecastCardWrapper (the div with className "pointer-events-none absolute
bottom-0 left-0 right-0 z-10 h-8") to use a theme-aware color instead of the
fixed value: detect the current theme (e.g., via the existing theme/context hook
or a useIsDarkMode utility) or reference a CSS variable for background, and set
the linear-gradient stop to the appropriate light or dark token (or tailwind
theme class) so the fade matches both light and dark modes. Ensure you replace
the inline METAC_COLORS.gray[0].DEFAULT usage with that theme-aware value.

In `@front_end/src/hooks/use_overlay_max_height.ts`:
- Around line 14-24: The current useEffect only sets overlayMaxHeight once on
expand, so the cap grows stale when the viewport changes; modify the effect
around expanded/containerRef to recompute and setOverlayMaxHeight whenever the
window resizes or the page scrolls while expanded by adding window 'resize' (and
optionally 'scroll') event listeners that call the same height calculation
(using containerRef.current.getBoundingClientRect(), OVERLAY_OFFSET,
BOTTOM_MARGIN, MIN_HEIGHT) and cleaning them up on unmount or when expanded
becomes false; ensure the handler is the same function reference for removal and
guard containerRef.current existence before calling setOverlayMaxHeight.

---

Nitpick comments:
In
`@front_end/src/app/`(main)/questions/[id]/components/question_view/consumer_question_view/consumer_list_chart_shell.tsx:
- Around line 52-53: The hardcoded offset "40" used when computing
chartAreaHeight in consumer_list_chart_shell.tsx is part of a cross-component
sizing contract and should be centralized; replace the literal with a shared
constant (e.g., CHART_HEADER_TOGGLE_OFFSET) exported from a shared
layout/constants module (or derive it from a measured ref exposed by the chart
panel) and use that constant in consumer_list_chart_shell.tsx and the
corresponding chart panels so both sides consume the same value (update
references to chartAreaHeight and any chart panels that assume the same offset).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: afcf0256-f0ff-47ca-ad46-d6eeb4a7c1a8

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc5e9b and 30a6244.

📒 Files selected for processing (17)
  • front_end/src/app/(main)/questions/[id]/[[...slug]]/page_component.tsx
  • front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_feed.tsx
  • front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_grid_placeholder.tsx
  • front_end/src/app/(main)/questions/[id]/components/multiple_choices_chart_view/compact_legend_bar/index.tsx
  • front_end/src/app/(main)/questions/[id]/components/post_score_data/single_question_score_data.tsx
  • front_end/src/app/(main)/questions/[id]/components/question_page_shell/index.tsx
  • front_end/src/app/(main)/questions/[id]/components/question_page_shell/meta_row.tsx
  • front_end/src/app/(main)/questions/[id]/components/question_page_shell/tab_bar.tsx
  • front_end/src/app/(main)/questions/[id]/components/question_view/consumer_question_view/consumer_group_chart.tsx
  • front_end/src/app/(main)/questions/[id]/components/question_view/consumer_question_view/consumer_list_chart_shell.tsx
  • front_end/src/app/(main)/questions/[id]/components/question_view/consumer_question_view/fan_graph_chart_panel.tsx
  • front_end/src/app/(main)/questions/[id]/components/question_view/consumer_question_view/timeline/index.tsx
  • front_end/src/components/consumer_post_card/group_forecast_card/forecast_card_wrapper.tsx
  • front_end/src/components/consumer_post_card/group_forecast_card/numeric_forecast_card.tsx
  • front_end/src/components/consumer_post_card/group_forecast_card/percentage_forecast_card.tsx
  • front_end/src/hooks/use_overlay_max_height.ts
  • front_end/src/hooks/use_post_text_sections.ts
💤 Files with no reviewable changes (1)
  • front_end/src/app/(main)/questions/[id]/components/post_score_data/single_question_score_data.tsx

Comment thread front_end/src/hooks/use_overlay_max_height.ts
…eight on expand, and recompute overlay max height on resize
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.

1 participant