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

Function PostModal

packages/shared/src/components/modals/SharePostModal.tsx:22–92  ·  view source on GitHub ↗
({
  id,
  className,
  onRequestClose,
  onPreviousPost,
  onNextPost,
  postPosition,
  post,
  ...props
}: PostModalProps)

Source from the content-addressed store, hash-verified

20}
21
22export default function PostModal({
23 id,
24 className,
25 onRequestClose,
26 onPreviousPost,
27 onNextPost,
28 postPosition,
29 post,
30 ...props
31}: PostModalProps): ReactElement {
32 const { position, onLoad } = usePostNavigationPosition({
33 isDisplayed: props.isOpen,
34 offset: 0,
35 });
36 const { showRedesign } = usePostRedesign(post);
37
38 return (
39 <BasePostModal
40 {...props}
41 post={post}
42 onAfterOpen={onLoad}
43 size={showRedesign ? Modal.Size.Large : Modal.Size.XLarge}
44 className={showRedesign ? 'laptop:!overflow-clip' : undefined}
45 navigationRedesign={showRedesign}
46 onRequestClose={onRequestClose}
47 postType={PostType.Share}
48 source={post.source}
49 loadingClassName="!pb-2 tablet:pb-0"
50 postPosition={postPosition}
51 onPreviousPost={onPreviousPost}
52 onNextPost={onNextPost}
53 >
54 {/* The squad notification prompt is shown for share posts regardless of
55 which layout renders below it. */}
56 <EnableNotification
57 source={NotificationPromptSource.SquadPostModal}
58 label={
59 isSourceUserSource(post?.source)
60 ? post?.author?.username
61 : post?.source?.handle
62 }
63 />
64 {showRedesign ? (
65 <PostFocusCard
66 post={post}
67 origin={Origin.ArticleModal}
68 onClose={() => onRequestClose?.(undefined as never)}
69 />
70 ) : (
71 <SquadPostContent
72 position={position}
73 post={post}
74 onPreviousPost={onPreviousPost}
75 onNextPost={onNextPost}
76 postPosition={postPosition}
77 inlineActions
78 onClose={onRequestClose}
79 origin={Origin.ArticleModal}

Callers

nothing calls this directly

Calls 4

usePostRedesignFunction · 0.90
isSourceUserSourceFunction · 0.90
onRequestCloseFunction · 0.50

Tested by

no test coverage detected