Skip to content

Commit

Permalink
[web] Allow copying the link
Browse files Browse the repository at this point in the history
Summary:
Call clipboard copy API just like in other places on web. The discussion about operation feedback is still in progress https://www.figma.com/file/a1nkbWgbgjRlrOY9LVurTz?node-id=11400:282507#473816740.

Depends on D8238

Test Plan: Click copy button and check if the link is in the clipboard.

Reviewers: bartek, kamil, inka

Reviewed By: kamil

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D8239
  • Loading branch information
palys-swm committed Jun 26, 2023
1 parent c1e60b2 commit a28409f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions web/invite-links/view-invite-link-modal.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ function ViewInviteLinkModal(props: Props): React.Node {
const resolvedThreadInfo = useResolvedThreadInfo(threadInfo);
const { popModal } = useModalContext();

const url = inviteLinkUrl(inviteLink.name);
const copyLink = React.useCallback(() => {
navigator.clipboard.writeText(url);
}, [url]);

return (
<Modal
name={`Invite people to ${resolvedThreadInfo.uiName}`}
Expand All @@ -38,8 +43,8 @@ function ViewInviteLinkModal(props: Props): React.Node {
</div>
<div className={css.sectionHeader}>Public link</div>
<div className={css.linkContainer}>
<div className={css.linkUrl}>{inviteLinkUrl(inviteLink.name)}</div>
<Button className={css.linkCopyButton}>
<div className={css.linkUrl}>{url}</div>
<Button className={css.linkCopyButton} onClick={copyLink}>
<SWMansionIcon icon="link" size={24} />
Copy
</Button>
Expand Down

0 comments on commit a28409f

Please sign in to comment.