MCPcopy Create free account
hub / github.com/dailydotdev/apps / BasePostContent

Function BasePostContent

packages/shared/src/components/post/BasePostContent.tsx:35–110  ·  view source on GitHub ↗
({
  post,
  isFallback,
  origin,
  children,
  className = {},
  navigationProps,
  engagementProps,
  shouldOnboardAuthor,
  aboveComments,
  commentAds,
  isPostPage,
  boostOrigin,
}: BasePostContentProps)

Source from the content-addressed store, hash-verified

33);
34
35export function BasePostContent({
36 post,
37 isFallback,
38 origin,
39 children,
40 className = {},
41 navigationProps,
42 engagementProps,
43 shouldOnboardAuthor,
44 aboveComments,
45 commentAds,
46 isPostPage,
47 boostOrigin,
48}: BasePostContentProps): ReactElement {
49 const { id } = post ?? {};
50 const { onCopyPostLink } = engagementProps ?? {};
51 const postPageNavigationProps = isPostPage ? navigationProps : undefined;
52 const onReadArticle = postPageNavigationProps?.onReadArticle;
53 const isMobileAppHeader = useMobileAppHeader();
54 const isPhone = useIsPhone();
55 const isIconOnlyRead = useMobileAppHeaderIconOnlyRead();
56 const hasCapsule = useHasPostCapsule(isPostPage ? post : undefined);
57
58 if (!id && !isFallback) {
59 return <Custom404 />;
60 }
61
62 if (isPostPage && !postPageNavigationProps) {
63 throw new Error('BasePostContent requires navigationProps on post pages');
64 }
65
66 return (
67 <BoostOriginContextProvider origin={boostOrigin}>
68 {isPostPage && (
69 <GoBackHeaderMobile
70 className={classNames(
71 className.header,
72 '-mx-4 bg-background-subtle tablet:-mx-6',
73 )}
74 >
75 <PostHeaderActions
76 post={post}
77 className={isMobileAppHeader ? undefined : 'ml-auto'}
78 contextMenuId="post-page-header-actions"
79 onReadArticle={onReadArticle}
80 buttonSize={ButtonSize.Small}
81 inBlock={isPhone}
82 hideOptions={isMobileAppHeader}
83 inlineActions={isIconOnlyRead}
84 hideSubscribeAction={isMobileAppHeader}
85 />
86 </GoBackHeaderMobile>
87 )}
88 {children}
89 {!!post?.id && <PostSignupWidget post={post} inline className="my-6" />}
90 {isPostPage && <PostAnsweredQuestions post={post} className="mt-6" />}
91 {aboveComments}
92 {!!engagementProps && !!post?.id && (

Callers

nothing calls this directly

Calls 4

useMobileAppHeaderFunction · 0.90
useIsPhoneFunction · 0.90
useHasPostCapsuleFunction · 0.90

Tested by

no test coverage detected