From f1874d0003b421021ee0c5c9f81d3cd08e1f19ae Mon Sep 17 00:00:00 2001 From: rebelchris Date: Fri, 21 Aug 2026 18:29:26 +0000 Subject: [PATCH] feat: show community take on the legacy post layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The community take only rendered inside PostFocusCard, which is gated by post_redesign — currently forced on for team accounts only. That made the surface invisible to everyone else even though community_sentiment is fully rolled out and the backend generates takes unconditionally. Render it in the legacy PostContent layout too, on the full post page only (matching the redesign, which hides it in the preview modal), with the same conditional enrollment so take-less posts don't dilute the split. --- .../src/components/post/PostContent.tsx | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/components/post/PostContent.tsx b/packages/shared/src/components/post/PostContent.tsx index 9baf47f8128..f35ba3a38cf 100644 --- a/packages/shared/src/components/post/PostContent.tsx +++ b/packages/shared/src/components/post/PostContent.tsx @@ -18,7 +18,12 @@ import YoutubeVideo from '../video/YoutubeVideo'; import { useTrackPostView } from '../../hooks/post/useTrackPostView'; import { TruncateText } from '../utilities'; import { useFeature } from '../GrowthBookProvider'; -import { feature } from '../../lib/featureManagement'; +import { useConditionalFeature } from '../../hooks/useConditionalFeature'; +import { + feature, + featureCommunitySentiment, +} from '../../lib/featureManagement'; +import { isDevelopment } from '../../lib/constants'; import { LazyImage } from '../LazyImage'; import { cloudinaryPostImageCoverPlaceholder } from '../../lib/image'; import { withPostById } from './withPostById'; @@ -27,6 +32,10 @@ import { useSmartTitle } from '../../hooks/post/useSmartTitle'; import { PostTagList } from './tags/PostTagList'; import PostSourceInfo from './PostSourceInfo'; import { useReaderInstallPromptGate } from '../../hooks/useReaderInstallPromptGate'; +import { + CommunitySentiment, + mapCommunitySentimentPost, +} from './focus/CommunitySentiment'; type PostContentRawProps = Omit & { post: Post }; @@ -104,6 +113,20 @@ export function PostContentRaw({ }; const showCodeSnippets = useFeature(feature.showCodeSnippets); const { title } = useSmartTitle(post); + const communitySentimentData = post.communitySentiment + ? mapCommunitySentimentPost(post.communitySentiment) + : undefined; + // Conditional enrollment: only evaluate (and log exposure for) the + // community_sentiment experiment on posts that actually have a take, so + // take-less posts don't dilute the treatment/control split. + const { value: communitySentimentEnabled } = useConditionalFeature({ + feature: featureCommunitySentiment, + shouldEvaluate: !!communitySentimentData, + }); + const showCommunitySentiment = + isPostPage && + !!communitySentimentData && + (communitySentimentEnabled || isDevelopment); const hasNavigation = !!onPreviousPost || !!onNextPost; const isVideoType = isVideoPost(post); const hasToc = (post.toc?.length ?? 0) > 0; @@ -258,6 +281,9 @@ export function PostContentRaw({ post={post} /> )} + {showCommunitySentiment && ( + + )} );