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

Function PostModal

packages/shared/src/components/modals/SharePostModal.tsx:22–93  ·  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 navigationContentOwnsActions={!showRedesign}
47 onRequestClose={onRequestClose}
48 postType={PostType.Share}
49 source={post.source}
50 loadingClassName="!pb-2 tablet:pb-0"
51 postPosition={postPosition}
52 onPreviousPost={onPreviousPost}
53 onNextPost={onNextPost}
54 >
55 {/* The squad notification prompt is shown for share posts regardless of
56 which layout renders below it. */}
57 <EnableNotification
58 source={NotificationPromptSource.SquadPostModal}
59 label={
60 isSourceUserSource(post?.source)
61 ? post?.author?.username
62 : post?.source?.handle
63 }
64 />
65 {showRedesign ? (
66 <PostFocusCard
67 post={post}
68 origin={Origin.ArticleModal}
69 onClose={() => onRequestClose?.(undefined as never)}
70 />
71 ) : (
72 <SquadPostContent
73 position={position}
74 post={post}
75 onPreviousPost={onPreviousPost}
76 onNextPost={onNextPost}
77 postPosition={postPosition}
78 inlineActions
79 onClose={onRequestClose}

Callers

nothing calls this directly

Calls 4

usePostRedesignFunction · 0.90
isSourceUserSourceFunction · 0.90
onRequestCloseFunction · 0.50

Tested by

no test coverage detected