diff --git a/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/index.tsx b/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/index.tsx index a0cb9abb55..9d115ca944 100644 --- a/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/index.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/index.tsx @@ -9,7 +9,6 @@ interface Props { } const fetchArticles = async (postId: number) => { - await new Promise((resolve) => setTimeout(resolve, 300)); return await PostsApi.getRelatedNews(postId); }; diff --git a/front_end/src/components/post_card/question_chart_tile/question_numeric_tile.tsx b/front_end/src/components/post_card/question_chart_tile/question_numeric_tile.tsx index 287e4411fb..ba3e32a57a 100644 --- a/front_end/src/components/post_card/question_chart_tile/question_numeric_tile.tsx +++ b/front_end/src/components/post_card/question_chart_tile/question_numeric_tile.tsx @@ -68,6 +68,7 @@ const QuestionNumericTile: FC = ({ question={question} prediction={prediction} status={curationStatus} + showUserForecast />
diff --git a/front_end/src/components/prediction_chip.tsx b/front_end/src/components/prediction_chip.tsx index 37d50682a4..6db61def70 100644 --- a/front_end/src/components/prediction_chip.tsx +++ b/front_end/src/components/prediction_chip.tsx @@ -1,12 +1,13 @@ import { faUserGroup } from "@fortawesome/free-solid-svg-icons"; +import { faUser } from "@fortawesome/free-regular-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import classNames from "classnames"; import { useLocale, useTranslations } from "next-intl"; import { FC, PropsWithChildren } from "react"; -import { PostStatus, Resolution } from "@/types/post"; +import { PostStatus } from "@/types/post"; import { Question } from "@/types/question"; -import { getDisplayValue } from "@/utils/charts"; +import { getDisplayUserValue, getDisplayValue } from "@/utils/charts"; import { formatResolution } from "@/utils/questions"; type Size = "compact" | "large"; @@ -18,6 +19,7 @@ type Props = { size?: Size; className?: string; chipClassName?: string; + showUserForecast?: boolean; }; const PredictionChip: FC = ({ @@ -27,6 +29,7 @@ const PredictionChip: FC = ({ className, chipClassName, size, + showUserForecast, }) => { const t = useTranslations(); const locale = useLocale(); @@ -39,7 +42,8 @@ const PredictionChip: FC = ({ locale ); - const fmted_prediction = formatResolution(prediction, question.type, locale); + const aggregate = question.aggregations.recency_weighted; + const lastUserForecast = aggregate.history[aggregate.history.length - 1]; switch (status) { case PostStatus.PENDING: @@ -72,6 +76,18 @@ const PredictionChip: FC = ({ > {formattedResolution} + {showUserForecast && question.my_forecasts?.history.length && ( +

+ + {getDisplayUserValue( + question.my_forecasts, + lastUserForecast.centers![0], + lastUserForecast.start_time, + question.type, + question.scaling + )} +

+ )} {size !== "compact" && !!nr_forecasters && (

{nr_forecasters} {t("forecasters")} @@ -118,6 +134,18 @@ const PredictionChip: FC = ({ {nr_forecasters} {t("forecasters")}

)} + {showUserForecast && !!question.my_forecasts?.history.length && ( +

+ + {getDisplayUserValue( + question.my_forecasts, + lastUserForecast.centers![0], + lastUserForecast.start_time, + question.type, + question.scaling + )} +

+ )} ); }