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

Function ShareMobile

packages/shared/src/components/ShareMobile.tsx:28–71  ·  view source on GitHub ↗
({
  onCopyPostLink,
  post,
  link,
  origin,
}: ShareMobileProps)

Source from the content-addressed store, hash-verified

26}
27
28export function ShareMobile({
29 onCopyPostLink,
30 post,
31 link,
32 origin,
33}: ShareMobileProps): ReactElement {
34 const [copying] = useCopyPostLink(link);
35 const { openSharePost } = useSharePost(origin);
36 const { logEvent } = useLogContext();
37 const { logOpts } = useContext(ActiveFeedContext);
38
39 const onShare = () => {
40 logEvent(
41 postLogEvent(LogEvent.StartShareToSquad, post, {
42 ...(logOpts && logOpts),
43 }),
44 );
45 openSharePost({ post });
46 };
47
48 return (
49 <WidgetContainer className="flex flex-col items-start gap-2 p-3 laptop:hidden">
50 <Button
51 size={ButtonSize.Small}
52 onClick={onCopyPostLink}
53 pressed={copying}
54 icon={<LinkIcon />}
55 variant={ButtonVariant.Tertiary}
56 color={ButtonColor.Avocado}
57 >
58 {copying ? 'Copied!' : 'Copy link'}
59 </Button>
60 <Button
61 size={ButtonSize.Small}
62 onClick={onShare}
63 icon={<ShareIcon />}
64 variant={ButtonVariant.Tertiary}
65 color={ButtonColor.Cabbage}
66 >
67 Share with your friends
68 </Button>
69 </WidgetContainer>
70 );
71}

Callers

nothing calls this directly

Calls 3

useCopyPostLinkFunction · 0.90
useSharePostFunction · 0.90
useLogContextFunction · 0.90

Tested by

no test coverage detected