From 7024f9772de602ddbf100c7cbbb79eeffcc85124 Mon Sep 17 00:00:00 2001 From: Nikita Date: Thu, 7 May 2026 20:27:09 +0300 Subject: [PATCH 1/6] fix: handle hideCP, cpRevealsOn, and isEmpty in the side-by-side left card for binary and continuous questions --- .../components/question_page_shell/index.tsx | 26 ++- .../question_header_cp_status.tsx | 182 +++++++++--------- .../src/components/charts/numeric_chart.tsx | 2 +- .../consumer_post_card/binary_cp_bar.tsx | 2 +- .../continuous_chart_card.tsx | 2 +- .../detailed_question_card/index.tsx | 2 +- .../components/post_card/chart_overflow.tsx | 15 -- 7 files changed, 120 insertions(+), 111 deletions(-) diff --git a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/index.tsx b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/index.tsx index 7da588d633..294b10abc2 100644 --- a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/index.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/index.tsx @@ -5,10 +5,12 @@ import { FC, Fragment, ReactNode, useEffect } from "react"; import useCoherenceLinksContext from "@/app/(main)/components/coherence_links_provider"; import { PostStatusBox } from "@/app/(main)/questions/[id]/components/post_status_box"; +import UpcomingCP from "@/components/consumer_post_card/upcoming_cp"; import DetailedGroupCard from "@/components/detailed_question_card/detailed_group_card"; import DetailedQuestionCard from "@/components/detailed_question_card/detailed_question_card"; import ForecastMaker from "@/components/forecast_maker"; import CommunityDisclaimer from "@/components/post_card/community_disclaimer"; +import { useHideCP } from "@/contexts/cp_context"; import { useContentTranslatedBannerContext } from "@/contexts/translations_banner_context"; import { GroupOfQuestionsGraphType, @@ -19,6 +21,7 @@ import { import { TournamentType } from "@/types/projects"; import { QuestionType } from "@/types/question"; import cn from "@/utils/core/cn"; +import { getQuestionForecastAvailability } from "@/utils/questions/forecastAvailability"; import { checkGroupOfQuestionsPostType, isContinuousQuestion, @@ -39,6 +42,7 @@ import ActionRow from "../question_view/action_row"; import ConsumerQuestionPrediction from "../question_view/consumer_question_view/prediction"; import QuestionTimeline from "../question_view/consumer_question_view/timeline"; import QuestionHeaderCPStatus from "../question_view/forecaster_question_view/question_header/question_header_cp_status"; +import RevealCPButton from "../reveal_cp_button"; const baseSectionClassName = "relative z-10 flex w-[59rem] max-w-full flex-col gap-6 overflow-x-clip rounded border border-blue-400 p-4 text-gray-900 dark:border-blue-200-dark dark:text-gray-900-dark lg:p-8"; @@ -129,6 +133,7 @@ export const ConsumerShell: FC<{ }> = ({ postData, preselectedGroupQuestionId, mobileSidebar }) => { const t = useTranslations(); const { aggregateCoherenceLinks } = useCoherenceLinksContext(); + const { hideCP } = useHideCP(); const isFanGraph = postData.group_of_questions?.graph_type === @@ -152,6 +157,11 @@ export const ConsumerShell: FC<{ !isContinuousSingleQuestion && !isMultipleChoice; + const binaryForecastAvailability = + isBinarySingleQuestion && isQuestionPost(postData) + ? getQuestionForecastAvailability(postData.question) + : null; + const showSideBySide = isMultipleChoice || isNonFanGroup || @@ -216,10 +226,18 @@ export const ConsumerShell: FC<{ > {isBinarySingleQuestion && isQuestionPost(postData) ? (
- + {hideCP ? ( + + ) : binaryForecastAvailability?.cpRevealsOn ? ( + + ) : ( + + )}
) : (
= ({ : "border-[0.5px] border-olive-500 p-3 dark:border-olive-500-dark md:p-3"; if (isContinuous) { + const containerClassName = cn( + "flex min-w-[110px] flex-col rounded-md border border-olive-800/20 p-2 dark:border-olive-800 md:px-3 md:py-2.5", + { + "min-h-full w-[200px]": size === "lg" && hideLabel, + "w-max max-w-[200px]": size === "lg" && !hideLabel, + "max-w-[130px]": + size === "md" || (isEmbed && !isEmbedBelow376 && !isEmbedWide), + "gap-1": !hideLabel && size === "lg", + "gap-0": size === "md", + "-gap-2": size === "md" && hideLabel, + [embedBorderClass]: isEmbed, + "max-w-[195px]": isEmbedWide, + "min-w-[200px] border-none p-0": isEmbedBelow376, + } + ); + + // No forecasts and no upcoming reveal — render empty outline box to preserve column width + if (forecastAvailability.isEmpty && !forecastAvailability.cpRevealsOn) { + return
; + } + return ( - !forecastAvailability.isEmpty && ( -
-
- {!hideLabel && ( - - )} - {isEmbedBelow376 && ( -

- {t("currentEstimate")} -

- )} - {!hideCP && ( - - )} -
- {!!continuousAreaChartData && ( +
+
+ {!hideLabel && ( )} - {!hideCP && ( - span]:whitespace-normal", - { - "-mt-2 text-center": size === "md" && hideLabel, - "text-center": size === "md" && !hideLabel, - "mt-0 md:[&>span]:whitespace-nowrap": isEmbed, - } - )} - size={"sm"} - unit={size === "md" ? "" : undefined} - boldValueUnit={true} + {isEmbedBelow376 && ( +

+ {t("currentEstimate")} +

+ )} + {!hideCP && !forecastAvailability.cpRevealsOn && ( + )}
- ) + {!!continuousAreaChartData && !forecastAvailability.cpRevealsOn && ( +
+ +
+ )} + {!!forecastAvailability.cpRevealsOn && ( + + )} + {!hideCP && !forecastAvailability.cpRevealsOn && ( + span]:whitespace-normal", + { + "-mt-2 text-center": size === "md" && hideLabel, + "text-center": size === "md" && !hideLabel, + "mt-0 md:[&>span]:whitespace-nowrap": isEmbed, + } + )} + size={"sm"} + unit={size === "md" ? "" : undefined} + boldValueUnit={true} + /> + )} +
); } else if (question.type === QuestionType.Binary) { return ( diff --git a/front_end/src/components/charts/numeric_chart.tsx b/front_end/src/components/charts/numeric_chart.tsx index 0268d32d5f..c947bd0b37 100644 --- a/front_end/src/components/charts/numeric_chart.tsx +++ b/front_end/src/components/charts/numeric_chart.tsx @@ -221,7 +221,7 @@ const NumericChart: FC = ({ }, [rightPadding, MIN_RIGHT_PADDING]); const containerComponent = useMemo(() => { - if (nonInteractive) { + if (nonInteractive || forecastAvailability?.isEmpty) { return ( = ({ question.aggregations[question.default_aggregation_method]?.latest ?.centers?.[0]; - if (question.type !== QuestionType.Binary || !questionCP) { + if (question.type !== QuestionType.Binary) { return null; } diff --git a/front_end/src/components/detailed_question_card/detailed_question_card/continuous_chart_card.tsx b/front_end/src/components/detailed_question_card/detailed_question_card/continuous_chart_card.tsx index 739c3061ee..1a850110bb 100644 --- a/front_end/src/components/detailed_question_card/detailed_question_card/continuous_chart_card.tsx +++ b/front_end/src/components/detailed_question_card/detailed_question_card/continuous_chart_card.tsx @@ -280,7 +280,7 @@ const DetailedContinuousChartCard: FC = ({ simplifiedCursor={false} title={timelineTitle} forecastAvailability={forecastAvailability} - cursorTooltip={cursorTooltip} + cursorTooltip={forecastAvailability?.isEmpty ? undefined : cursorTooltip} isConsumerView={isConsumerView} isEmbedded={isEmbed} height={chartHeight} diff --git a/front_end/src/components/detailed_question_card/detailed_question_card/index.tsx b/front_end/src/components/detailed_question_card/detailed_question_card/index.tsx index d0da1e1fdd..084718fe8c 100644 --- a/front_end/src/components/detailed_question_card/detailed_question_card/index.tsx +++ b/front_end/src/components/detailed_question_card/detailed_question_card/index.tsx @@ -85,7 +85,7 @@ const DetailedQuestionCard: FC = ({ embedChartType={embedChartType} keyFactors={keyFactors} /> - {hideCP && } + {hideCP && !isConsumerView && } ); case QuestionType.MultipleChoice: diff --git a/front_end/src/components/post_card/chart_overflow.tsx b/front_end/src/components/post_card/chart_overflow.tsx index a2efce242e..d242614a25 100644 --- a/front_end/src/components/post_card/chart_overflow.tsx +++ b/front_end/src/components/post_card/chart_overflow.tsx @@ -1,4 +1,3 @@ -import { useTranslations } from "next-intl"; import React, { FC } from "react"; import ChartOverflowContainer from "@/components/charts/cp_reveal_time_overflow"; @@ -18,8 +17,6 @@ const ForecastAvailabilityChartOverflow: FC = ({ textClassName, style, }) => { - const t = useTranslations(); - if (!forecastAvailability) { return null; } @@ -36,18 +33,6 @@ const ForecastAvailabilityChartOverflow: FC = ({ ); } - if (forecastAvailability.isEmpty) { - return ( - - {t("noForecastsYet")} - - ); - } - return null; }; From a5918f5c3c78dcad7bf3558245c0221ef3e8a908 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 8 May 2026 13:57:37 +0300 Subject: [PATCH 2/6] fix: handle isEmpty, cpRevealsOn, and hideCP states in the side-by-side layout left panel and fix title overflow onto the CP block --- .../question_page_shell/title_row.tsx | 6 +-- .../continuous_question_prediction.tsx | 12 ++++- .../question_header_cp_status.tsx | 53 +++++++++++++++++-- .../src/components/charts/numeric_chart.tsx | 7 ++- .../continuous_chart_card.tsx | 5 +- .../detailed_question_card/index.tsx | 1 - 6 files changed, 70 insertions(+), 14 deletions(-) diff --git a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx index 69b40e9597..d7cc10785d 100644 --- a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx @@ -39,9 +39,9 @@ const TitleRow: FC = ({ post, variant, className }) => { className )} > -
+
- + {post.title}
@@ -54,7 +54,7 @@ const TitleRow: FC = ({ post, variant, className }) => {
{!isContinuousQuestion(post.question) && ( -
+
= ({ chartHeight, }) => { const forecastAvailability = getQuestionForecastAvailability(question); + const { hideCP } = useHideCP(); - // Hide chart if no forecasts or CP not yet revealed const shouldHideChart = forecastAvailability.isEmpty || !!forecastAvailability.cpRevealsOn; @@ -27,6 +29,14 @@ const ContinuousQuestionPrediction: React.FC = ({ isClosed: question.status === QuestionStatus.CLOSED, }); + if (hideCP) { + return ( +
+ +
+ ); + } + return (
= ({ // No forecasts and no upcoming reveal — render empty outline box to preserve column width if (forecastAvailability.isEmpty && !forecastAvailability.cpRevealsOn) { - return
; + return ( +
+ {size === "lg" && ( +

+ {t("currentEstimate")} +

+ )} +
+ ); + } + + // CP reveals in the future — center the countdown, skip the mini chart + if (forecastAvailability.cpRevealsOn && size === "lg") { + return ( +
+ +
+ ); + } + + // CP hidden by user preference — center the reveal button, skip the mini chart + if (hideCP && !isEmbed) { + return ( +
+ +
+ ); } return ( @@ -187,9 +223,6 @@ const QuestionHeaderCPStatus: FC = ({ />
)} - {!!forecastAvailability.cpRevealsOn && ( - - )} {!hideCP && !forecastAvailability.cpRevealsOn && ( = ({
); } else if (question.type === QuestionType.Binary) { + if (hideCP && !isEmbed) { + return ( +
+ +
+ ); + } + return (
= ({ }, [rightPadding, MIN_RIGHT_PADDING]); const containerComponent = useMemo(() => { - if (nonInteractive || forecastAvailability?.isEmpty) { + if ( + nonInteractive || + forecastAvailability?.isEmpty || + hideCP || + !!forecastAvailability?.cpRevealsOn + ) { return ( = ({ className="flex w-full flex-col justify-center" style={{ height: chartHeight }} > - {hideCP || isCpHidden ? ( - - ) : ( + {!hideCP && !isCpHidden && ( = ({ embedChartType={embedChartType} keyFactors={keyFactors} /> - {hideCP && !isConsumerView && } ); case QuestionType.MultipleChoice: From 82c938e8eb220bcaed657f3323ed0c4a05523247 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 8 May 2026 13:57:45 +0300 Subject: [PATCH 3/6] fix: refine mobile hidden-CP states for binary and continuous in the forecaster title row and left panel --- .../question_page_shell/title_row.tsx | 12 +++++++-- .../question_header_cp_status.tsx | 25 +++++++++++++------ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx index d7cc10785d..e29936ab58 100644 --- a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx @@ -5,6 +5,7 @@ import { FC } from "react"; import QuestionHeaderCPStatus from "@/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_cp_status"; import QuestionTitle from "@/app/(main)/questions/[id]/components/question_view/shared/question_title"; import ConditionalTile from "@/components/conditional_tile"; +import { useHideCP } from "@/contexts/cp_context"; import { PostWithForecasts } from "@/types/post"; import { QuestionWithForecasts } from "@/types/question"; import cn from "@/utils/core/cn"; @@ -23,6 +24,8 @@ type Props = { }; const TitleRow: FC = ({ post, variant, className }) => { + const { hideCP } = useHideCP(); + if (isConditionalPost(post)) { return (
@@ -40,11 +43,16 @@ const TitleRow: FC = ({ post, variant, className }) => { )} >
-
+
{post.title} -
+
= ({ style={borderStyle} className={cn(containerClassName, "items-center justify-center")} > - {size === "lg" && ( -

- {t("currentEstimate")} -

- )} +

+ {t("currentEstimate")} +

); } // CP reveals in the future — center the countdown, skip the mini chart - if (forecastAvailability.cpRevealsOn && size === "lg") { + if (forecastAvailability.cpRevealsOn) { return (
= ({ // CP hidden by user preference — center the reveal button, skip the mini chart if (hideCP && !isEmbed) { + if (size === "md") { + return ( +
+ +
+ ); + } return (
= ({ colorOverride={colorOverride} /> )} - {!hideCP && ( + {!hideCP && !forecastAvailability.cpRevealsOn && ( = ({ boldValueUnit={true} /> )} + {!!forecastAvailability.cpRevealsOn && !isEmbed && ( + + )}
); } From 1baa10e79d15423fbcc857978d1136863c836572 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 8 May 2026 13:57:55 +0300 Subject: [PATCH 4/6] fix: prevent CP status from being squeezed off-screen in the mobile title row --- .../[id]/components/question_page_shell/title_row.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx index e29936ab58..005403f0b5 100644 --- a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx @@ -49,10 +49,10 @@ const TitleRow: FC = ({ post, variant, className }) => { hideCP ? "flex-col" : "items-center" )} > - + {post.title} -
+
Date: Fri, 8 May 2026 13:58:03 +0300 Subject: [PATCH 5/6] fix: restore "No forecasts yet" overlay in feed cards and suppress it on the question detail page --- front_end/src/components/charts/numeric_chart.tsx | 6 +++++- .../continuous_chart_card.tsx | 4 ---- .../src/components/post_card/chart_overflow.tsx | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/front_end/src/components/charts/numeric_chart.tsx b/front_end/src/components/charts/numeric_chart.tsx index b2fdd3bc7e..a8da8bf077 100644 --- a/front_end/src/components/charts/numeric_chart.tsx +++ b/front_end/src/components/charts/numeric_chart.tsx @@ -556,7 +556,11 @@ const NumericChart: FC = ({ {...getReferenceProps()} > = ({ const discreteValueOptions = getDiscreteValueOptions(question); const cpCursorElement = useMemo(() => { - if (forecastAvailability?.isEmpty) { - return t("noForecastsYet"); - } - if (hideCP) { return "..."; } diff --git a/front_end/src/components/post_card/chart_overflow.tsx b/front_end/src/components/post_card/chart_overflow.tsx index d242614a25..a2efce242e 100644 --- a/front_end/src/components/post_card/chart_overflow.tsx +++ b/front_end/src/components/post_card/chart_overflow.tsx @@ -1,3 +1,4 @@ +import { useTranslations } from "next-intl"; import React, { FC } from "react"; import ChartOverflowContainer from "@/components/charts/cp_reveal_time_overflow"; @@ -17,6 +18,8 @@ const ForecastAvailabilityChartOverflow: FC = ({ textClassName, style, }) => { + const t = useTranslations(); + if (!forecastAvailability) { return null; } @@ -33,6 +36,18 @@ const ForecastAvailabilityChartOverflow: FC = ({ ); } + if (forecastAvailability.isEmpty) { + return ( + + {t("noForecastsYet")} + + ); + } + return null; }; From ad9b7c12ca48ae45233259cb129d5aaf962e8f62 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 8 May 2026 18:19:23 +0300 Subject: [PATCH 6/6] fix: wire hideCP, cpRevealsOn, and isEmpty states into all question-type left panels for the side-by-side layout --- .../key_factors_question_consumer_section.tsx | 49 +++++++--- .../multiple_choices_chart_view/index.tsx | 3 +- .../components/question_page_shell/index.tsx | 25 ++++- .../question_page_shell/title_row.tsx | 65 +++++++++++-- .../question_header_cp_status.tsx | 10 +- front_end/src/components/charts/fan_chart.tsx | 2 +- .../src/components/charts/group_chart.tsx | 4 +- .../charts/multiple_choice_chart.tsx | 25 ++--- .../detailed_group_card/index.tsx | 96 +++++++++---------- .../detailed_question_card/index.tsx | 2 - 10 files changed, 185 insertions(+), 96 deletions(-) diff --git a/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_consumer_section.tsx b/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_consumer_section.tsx index 0c29532cd1..8140cc7829 100644 --- a/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_consumer_section.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_consumer_section.tsx @@ -7,12 +7,15 @@ import { useCommentsFeed } from "@/app/(main)/components/comments_feed_provider" import { openKeyFactorsSectionAndScrollTo } from "@/app/(main)/questions/[id]/components/key_factors/utils"; import { PostStatus, PostWithForecasts } from "@/types/post"; import { sendAnalyticsEvent } from "@/utils/analytics"; +import { getQuestionForecastAvailability } from "@/utils/questions/forecastAvailability"; +import { isQuestionPost } from "@/utils/questions/helpers"; import { MAX_TOP_KEY_FACTORS, useTopKeyFactorsCarouselItems, } from "./hooks/use_top_key_factors_carousel_items"; import KeyFactorDetailOverlay from "./key_factor_detail_overlay"; +import KeyFactorsCarousel from "./key_factors_carousel"; import KeyFactorsConsumerCarousel from "./key_factors_consumer_carousel"; import { useShouldHideKeyFactors } from "./use_should_hide_key_factors"; import { useQuestionLayout } from "../question_layout/question_layout_context"; @@ -41,14 +44,21 @@ const KeyFactorsQuestionConsumerSection: FC = ({ post }) => { if (post.status === PostStatus.RESOLVED) return null; + const postForecastAvailability = isQuestionPost(post) + ? getQuestionForecastAvailability(post.question) + : null; + const forecastIsEmpty = + !!postForecastAvailability?.isEmpty && + !postForecastAvailability?.cpRevealsOn; + + if (topItems.length === 0 && !forecastIsEmpty) return null; + const openKeyFactorsElement = (selector: string) => { requestKeyFactorsExpand?.(); openKeyFactorsSectionAndScrollTo({ selector, mobileOnly: false }); sendAnalyticsEvent("KeyFactorClick", { event_label: "fromTopList" }); }; - if (topItems.length === 0) return null; - return (
= ({ post }) => {
{t("topKeyFactors")}
- + {!forecastIsEmpty && ( + + )}
- + {forecastIsEmpty ? ( + ( +
+ )} + /> + ) : ( + + )} {keyFactorOverlay?.kind === "keyFactor" && ( = ({ )} {isTooltipActive && + !hideCP && + !forecastAvailability?.cpRevealsOn && !activeTimelineMarkerId && (tooltipChoices.length > 0 || !!tooltipUserChoices?.length || - !!forecastAvailability?.cpRevealsOn || !!forecastAvailability?.isEmpty) && (
0; const hasQuestionLinks = questionLinkAggregates.length > 0; - const shouldShowKeyFactorsSection = hasKeyFactors || hasQuestionLinks; + const questionForecastAvailability = isQuestionPost(postData) + ? getQuestionForecastAvailability(postData.question) + : null; + const isForecastEmpty = + !!questionForecastAvailability?.isEmpty && + !questionForecastAvailability?.cpRevealsOn; + const shouldShowKeyFactorsSection = + hasKeyFactors || hasQuestionLinks || isForecastEmpty; return (
@@ -243,10 +250,22 @@ export const ConsumerShell: FC<{
- + {hideCP && !isContinuousSingleQuestion ? ( + + ) : ( + + )}
)} {!isFanGraph && !isDateGroup && ( diff --git a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx index 005403f0b5..0433151a5d 100644 --- a/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/question_page_shell/title_row.tsx @@ -4,14 +4,16 @@ import { FC } from "react"; import QuestionHeaderCPStatus from "@/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_cp_status"; import QuestionTitle from "@/app/(main)/questions/[id]/components/question_view/shared/question_title"; +import RevealCPButton from "@/app/(main)/questions/[id]/components/reveal_cp_button"; import ConditionalTile from "@/components/conditional_tile"; import { useHideCP } from "@/contexts/cp_context"; import { PostWithForecasts } from "@/types/post"; -import { QuestionWithForecasts } from "@/types/question"; +import { QuestionType, QuestionWithForecasts } from "@/types/question"; import cn from "@/utils/core/cn"; import { isConditionalPost, isContinuousQuestion, + isGroupOfQuestionsPost, isQuestionPost, } from "@/utils/questions/helpers"; @@ -35,6 +37,9 @@ const TitleRow: FC = ({ post, variant, className }) => { } if (variant === "forecaster" && isQuestionPost(post)) { + const isMultipleChoice = post.question.type === QuestionType.MultipleChoice; + const isContinuous = isContinuousQuestion(post.question); + return (
= ({ post, variant, className }) => { {post.title}
+ {isMultipleChoice ? ( + hideCP && + ) : ( + + )} +
+
+
+ {!isContinuous && ( +
+ {isMultipleChoice && hideCP ? ( + + ) : ( -
+ )} +
+ )} +
+ ); + } + + if (variant === "forecaster" && isGroupOfQuestionsPost(post)) { + return ( +
+
+
+ + {post.title} + + {hideCP && ( +
+ +
+ )}
- {!isContinuousQuestion(post.question) && ( + {hideCP && (
- +
)}
diff --git a/front_end/src/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_cp_status.tsx b/front_end/src/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_cp_status.tsx index 74c870b8b7..451c17a3ee 100644 --- a/front_end/src/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_cp_status.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_cp_status.tsx @@ -113,7 +113,8 @@ const QuestionHeaderCPStatus: FC = ({ "min-h-full w-[200px]": size === "lg" && hideLabel, "w-max max-w-[200px]": size === "lg" && !hideLabel, "max-w-[130px]": - size === "md" || (isEmbed && !isEmbedBelow376 && !isEmbedWide), + !forecastAvailability.cpRevealsOn && + (size === "md" || (isEmbed && !isEmbedBelow376 && !isEmbedWide)), "gap-1": !hideLabel && size === "lg", "gap-0": size === "md", "-gap-2": size === "md" && hideLabel, @@ -144,7 +145,10 @@ const QuestionHeaderCPStatus: FC = ({ style={borderStyle} className={cn(containerClassName, "items-center justify-center")} > - +
); } @@ -293,7 +297,7 @@ const QuestionHeaderCPStatus: FC = ({ {!!forecastAvailability.cpRevealsOn && !isEmbed && ( )}
diff --git a/front_end/src/components/charts/fan_chart.tsx b/front_end/src/components/charts/fan_chart.tsx index 633af04d31..3c6cb661f7 100644 --- a/front_end/src/components/charts/fan_chart.tsx +++ b/front_end/src/components/charts/fan_chart.tsx @@ -452,7 +452,7 @@ const FanChart: FC = ({ domainPadding={v.domainPadding(variantArgs)} padding={chartPadding} containerComponent={ - withTooltip ? ( + withTooltip && !hideCP && !forecastAvailability?.cpRevealsOn ? ( containerWithTooltip ) : ( = ({ }, ]} containerComponent={ - onCursorChange ? ( + onCursorChange && + !hideCP && + !forecastAvailability?.cpRevealsOn ? ( CursorContainer ) : ( = ({ }, ]} containerComponent={ - onCursorChange ? ( + onCursorChange && + !hideCP && + !forecastAvailability?.cpRevealsOn ? ( CursorContainer ) : ( = ({ axis: { stroke: "transparent", }, - grid: isEmptyDomain - ? { - stroke: getThemeColor(METAC_COLORS.gray["300"]), - strokeWidth: 1, - strokeDasharray: "2, 5", - } - : { - stroke: "transparent", - }, + grid: + isEmptyDomain || hideCP + ? { + stroke: getThemeColor(METAC_COLORS.gray["300"]), + strokeWidth: 1, + strokeDasharray: "2, 5", + } + : { + stroke: "transparent", + }, }} label={yLabel} offsetX={ diff --git a/front_end/src/components/detailed_question_card/detailed_group_card/index.tsx b/front_end/src/components/detailed_question_card/detailed_group_card/index.tsx index 9be6aed4b5..d64adce9f1 100644 --- a/front_end/src/components/detailed_question_card/detailed_group_card/index.tsx +++ b/front_end/src/components/detailed_question_card/detailed_group_card/index.tsx @@ -5,7 +5,6 @@ import { VictoryThemeDefinition } from "victory"; import { useIsEmbedMode } from "@/app/(embed)/questions/components/question_view_mode_context"; import GroupTimeline from "@/app/(main)/questions/[id]/components/group_timeline"; -import RevealCPButton from "@/app/(main)/questions/[id]/components/reveal_cp_button"; import FanChart from "@/components/charts/fan_chart"; import { MultipleChoiceTile } from "@/components/post_card/multiple_choice_tile"; import { @@ -147,68 +146,59 @@ const DetailedGroupCard: FC = ({ ); return ( - <> - - {hideCP && } - - ); - } - - return ( - <> - - {hideCP && } - + ); + } + + return ( + ); } case GroupOfQuestionsGraphType.FanGraph: return ( - <> - - {hideCP && } - + ); default: return null; diff --git a/front_end/src/components/detailed_question_card/detailed_question_card/index.tsx b/front_end/src/components/detailed_question_card/detailed_question_card/index.tsx index 963d480eaa..95c8353717 100644 --- a/front_end/src/components/detailed_question_card/detailed_question_card/index.tsx +++ b/front_end/src/components/detailed_question_card/detailed_question_card/index.tsx @@ -3,7 +3,6 @@ import { FC, useEffect } from "react"; import { VictoryThemeDefinition } from "victory"; import { useIsEmbedMode } from "@/app/(embed)/questions/components/question_view_mode_context"; -import RevealCPButton from "@/app/(main)/questions/[id]/components/reveal_cp_button"; import { useHideCP } from "@/contexts/cp_context"; import { EmbedChartType, TimelineChartZoomOption } from "@/types/charts"; import { KeyFactor } from "@/types/comment"; @@ -101,7 +100,6 @@ const DetailedQuestionCard: FC = ({ chartTheme={chartTheme} defaultZoom={defaultZoom} /> - {hideCP && } ); default: