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

Function PostContentRaw

packages/shared/src/components/post/PostContent.tsx:68–311  ·  view source on GitHub ↗
({
  post,
  className = {},
  shouldOnboardAuthor,
  origin,
  position,
  inlineActions,
  hideSubscribeAction,
  onPreviousPost,
  onNextPost,
  onClose,
  postPosition,
  isFallback,
  customNavigation,
  backToSquad,
  isBannerVisible,
  isPostPage,
}: PostContentRawProps)

Source from the content-addressed store, hash-verified

66};
67
68export function PostContentRaw({
69 post,
70 className = {},
71 shouldOnboardAuthor,
72 origin,
73 position,
74 inlineActions,
75 hideSubscribeAction,
76 onPreviousPost,
77 onNextPost,
78 onClose,
79 postPosition,
80 isFallback,
81 customNavigation,
82 backToSquad,
83 isBannerVisible,
84 isPostPage,
85}: PostContentRawProps): ReactElement {
86 const { user } = useAuthContext();
87 const { subject } = useToastNotification();
88 const engagementActions = usePostContent({
89 origin,
90 post,
91 });
92 const { onCopyPostLink, onReadArticle } = engagementActions;
93 const { onReadClick: onReaderInstallGateClick } = useReaderInstallPromptGate(
94 post,
95 {
96 onCloseParent: onClose
97 ? () => (onClose as (event?: unknown) => void)()
98 : undefined,
99 },
100 );
101 const handleImageClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
102 if (onReaderInstallGateClick(event)) {
103 return;
104 }
105 onReadArticle();
106 };
107 const onSendViewPost = useViewPost();
108 const showCodeSnippets = useFeature(feature.showCodeSnippets);
109 const { title } = useSmartTitle(post);
110 const hasNavigation = !!onPreviousPost || !!onNextPost;
111 const isVideoType = isVideoPost(post);
112 const hasToc = (post.toc?.length ?? 0) > 0;
113 const isCompactModalSpacing = !isPostPage;
114 let metadataMarginClassName = 'mb-8';
115 if (isVideoType) {
116 metadataMarginClassName = isCompactModalSpacing ? 'mb-3' : 'mb-4';
117 } else if (isCompactModalSpacing) {
118 metadataMarginClassName = 'mb-6';
119 }
120 const metadataClassName = classNames(
121 isCompactModalSpacing ? 'mt-3 !typo-callout' : 'mt-4 !typo-callout',
122 metadataMarginClassName,
123 );
124 const containerClass = classNames(
125 'laptop:flex-row laptop:pb-0',

Callers

nothing calls this directly

Calls 8

useAuthContextFunction · 0.90
useToastNotificationFunction · 0.90
useViewPostFunction · 0.90
useFeatureFunction · 0.90
useSmartTitleFunction · 0.90
isVideoPostFunction · 0.90
usePostContentFunction · 0.85

Tested by

no test coverage detected