Sidebar reflow#4660
Conversation
📝 WalkthroughWalkthroughThe PR introduces variant-based conditional rendering throughout the sidebar and related components, allowing forecaster and consumer UI variants to be displayed based on user type. The backend is updated to conditionally include user forecasts in post serialization based on a new flag. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
Cleanup: Preview Environment RemovedThe preview environment for this PR has been destroyed.
Cleanup triggered by PR close at 2026-05-01T09:46:42Z |
…r and consumer views
…lar questions consumer sidebar
…user vote state is returned correctly
…r questions sidebar and remove hideResolutionIcon prop
160e699 to
643caef
Compare
| { | ||
| next: { revalidate: 3600 }, | ||
| } | ||
| `/posts/${postId}/similar-posts/` |
There was a problem hiding this comment.
To BE engineer that reviews it. Similar questions will now have post voter element in forecaster mode. I this FE tweak to allow getting the updated votes on page reload, but BE logic still needs adjustment, since right now it won't return "voted" state to render highlights on FE. Potential reason for that is described in PR description. I would appreciate a proper fix (either to this PR or as a separate branch).
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
front_end/src/app/(main)/questions/[id]/components/sidebar/similar_questions/similar_question_card.tsx (1)
23-136: Defer resolution extraction to the forecaster branch.
extractPostResolution(post)is only used in the footer that renders forvariant === "forecaster", so the consumer path is doing extra work for no visible benefit.♻️ Suggested tweak
- const resolutionData = extractPostResolution(post); - return ( @@ {isForecaster && ( <div className="flex items-center gap-1.5"> <PostVoter post={post} compact className="h-6" /> @@ <PostStatusIcon status={post.status} published_at={post.published_at} open_time={post.open_time} scheduled_close_time={post.scheduled_close_time} - resolution={resolutionData} + resolution={extractPostResolution(post)} />🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@front_end/src/app/`(main)/questions/[id]/components/sidebar/similar_questions/similar_question_card.tsx around lines 23 - 136, The call to extractPostResolution(post) is done unconditionally in SimilarQuestionCard even though resolutionData is only passed into PostStatusIcon when variant === "forecaster"; move the extraction into the forecaster branch so you only compute resolutionData when needed: remove the top-level const resolutionData = extractPostResolution(post) and instead call extractPostResolution(post) (assigning to resolutionData) inside the isForecaster conditional before rendering PostStatusIcon (used in the footer), ensuring you pass that local resolutionData into PostStatusIcon.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@front_end/src/app/`(main)/questions/[id]/components/sidebar/similar_questions/similar_question_card.tsx:
- Around line 23-136: The call to extractPostResolution(post) is done
unconditionally in SimilarQuestionCard even though resolutionData is only passed
into PostStatusIcon when variant === "forecaster"; move the extraction into the
forecaster branch so you only compute resolutionData when needed: remove the
top-level const resolutionData = extractPostResolution(post) and instead call
extractPostResolution(post) (assigning to resolutionData) inside the
isForecaster conditional before rendering PostStatusIcon (used in the footer),
ensuring you pass that local resolutionData into PostStatusIcon.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2853671c-5b44-42a3-be3e-877fa1988759
📒 Files selected for processing (15)
front_end/src/app/(main)/questions/[id]/[[...slug]]/page_component.tsxfront_end/src/app/(main)/questions/[id]/components/question_layout/question_info.tsxfront_end/src/app/(main)/questions/[id]/components/sidebar/index.tsxfront_end/src/app/(main)/questions/[id]/components/sidebar/sidebar_container.tsxfront_end/src/app/(main)/questions/[id]/components/sidebar/similar_questions/index.tsxfront_end/src/app/(main)/questions/[id]/components/sidebar/similar_questions/similar_question_card.tsxfront_end/src/app/(main)/questions/[id]/components/sidebar/similar_questions/similar_question_prediction_chip.tsxfront_end/src/app/(main)/questions/[id]/components/sidebar/similar_questions/similar_questions_drawer.tsxfront_end/src/app/(main)/questions/[id]/components/sidebar/similar_questions/similar_questions_list.tsxfront_end/src/components/consumer_post_card/group_forecast_card/index.tsxfront_end/src/components/post_card/basic_post_card/post_voter.tsxfront_end/src/components/post_card/question_tile/question_continuous_tile.tsxfront_end/src/services/api/posts/posts.shared.tsposts/serializers.pyposts/views.py
💤 Files with no reviewable changes (1)
- front_end/src/app/(main)/questions/[id]/components/sidebar/similar_questions/similar_questions_drawer.tsx
f118806
into
feat/question-page-redesign-1st-iteration


Related to #4640
This PR delivers the question page sidebar reflow and redesigns of the Similar Questions section.
Sidebar reflow (forecaster vs consumer):
SidebarQuestionInfo+SimilarQuestionsSimilarQuestionsonlyPostSubscribeButton,SharePostMenu,QuestionEmbedButton,PostDropdownMenu,SidebarQuestionProjectsSimilar Questions redesign:
QuestionTileandGroupOfQuestionsTileGroupForecastCard(the same charts from consumer post cards). FanGraph groups render TimeSeriesChart, numeric groups render NumericForecastCard, date groups render NumericForecastCard compact (horizontal bars)Consumer
consumer.mp4
Forecaster
forecaster.mp4
Summary by CodeRabbit
New Features
Style