From 4676a348acdb829ddb02cdc6466c81f144884bab Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 13:42:14 +0000 Subject: [PATCH] fix: Add project chips to notebooks including private projects Notebooks were missing project chips (tournaments, question series, etc.) while question-posts displayed them correctly. This fix adds all project types as chips to notebooks, matching the behavior of question-posts. This includes private project chips which were completely missing from notebooks but are now displayed consistently with how they appear on question-posts. Fixes #3924 Co-authored-by: Sylvain --- .../[id]/[[...slug]]/page_compotent.tsx | 54 ++++++++++++------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/front_end/src/app/(main)/notebooks/[id]/[[...slug]]/page_compotent.tsx b/front_end/src/app/(main)/notebooks/[id]/[[...slug]]/page_compotent.tsx index 69785b1e98..09228553d4 100644 --- a/front_end/src/app/(main)/notebooks/[id]/[[...slug]]/page_compotent.tsx +++ b/front_end/src/app/(main)/notebooks/[id]/[[...slug]]/page_compotent.tsx @@ -19,15 +19,17 @@ import CommentFeed from "@/components/comment_feed"; import { PostDropdownMenu, SharePostMenu } from "@/components/post_actions"; import PostVoter from "@/components/post_card/basic_post_card/post_voter"; import PostSubscribeButton from "@/components/post_subscribe/subscribe_button"; +import Chip from "@/components/ui/chip"; import CircleDivider from "@/components/ui/circle_divider"; import { POST_CATEGORIES_FILTER } from "@/constants/posts_feed"; import { PostSubscriptionProvider } from "@/contexts/post_subscription_context"; import ServerPostsApi from "@/services/api/posts/posts.server"; import ServerProjectsApi from "@/services/api/projects/projects.server"; import { PostStatus } from "@/types/post"; -import { TournamentType } from "@/types/projects"; +import { TaxonomyProjectType, TournamentType } from "@/types/projects"; import { formatDate } from "@/utils/formatters/date"; import { estimateReadingTime } from "@/utils/markdown"; +import { getProjectLink } from "@/utils/navigation"; import { getPostTitle, isNotebookPost } from "@/utils/questions/helpers"; const IndividualNotebookPage: FC<{ @@ -153,25 +155,39 @@ const IndividualNotebookPage: FC<{ contentId={NOTEBOOK_CONTENT_SECTION} />
- {!!postData.projects.category?.length && ( -
- {t("Categories") + ":"} - {postData.projects.category?.map((category, index) => ( - - {" "} - { + const allProjects = [ + ...(postData.projects.index ?? []), + ...(postData.projects.tournament ?? []), + ...(postData.projects.question_series ?? []), + ...(postData.projects.community ?? []), + ...(postData.projects.category ?? []), + ...(postData.projects.leaderboard_tag ?? []), + ]; + const getChipText = (name: string, type?: string) => + type === "leaderboard_tag" ? `🏆 ${name}` : name; + + return allProjects.length > 0 ? ( +
+ {allProjects.map((element) => ( + - {category.name} - - {index < (postData.projects.category?.length ?? 0) - 1 - ? "," - : "."} - - ))} -
- )} + {getChipText(element.name, element.type)} + + ))} +
+ ) : null; + })()}