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

Function useOpenShareLink

packages/shared/src/hooks/useOpenShareLink.ts:19–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18/** Opens a network's share page for a link, shortened by default. */
19export const useOpenShareLink = (): OpenShareLink => {
20 const { getShortUrl } = useGetShortUrl();
21
22 return useCallback(
23 async ({ provider, link, text, emailSummary, cid, shorten = true }) => {
24 const shareLink = shorten ? await getShortUrl(link, cid) : link;
25
26 globalThis.window?.open(
27 getShareLink({ provider, link: shareLink, text, emailSummary }),
28 '_blank',
29 );
30 },
31 [getShortUrl],
32 );
33};

Callers 2

SocialShareListFunction · 0.90
DiscussionShareRowFunction · 0.90

Calls 2

useGetShortUrlFunction · 0.90
getShareLinkFunction · 0.90

Tested by

no test coverage detected