From 01343bbe0a93129c3037d7af0ff3a32166e50a7d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 8 Mar 2023 14:46:24 -0600 Subject: [PATCH] Add copy and share links to group confirmation step --- .../steps/confirmation-step.tsx | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/soapbox/features/ui/components/modals/manage-group-modal/steps/confirmation-step.tsx b/app/soapbox/features/ui/components/modals/manage-group-modal/steps/confirmation-step.tsx index 158b68ffd..1b71e36c9 100644 --- a/app/soapbox/features/ui/components/modals/manage-group-modal/steps/confirmation-step.tsx +++ b/app/soapbox/features/ui/components/modals/manage-group-modal/steps/confirmation-step.tsx @@ -1,13 +1,28 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Avatar, Divider, HStack, Stack, Text } from 'soapbox/components/ui'; +import { Avatar, Divider, HStack, Stack, Text, Button } from 'soapbox/components/ui'; interface IConfirmationStep { group: any } const ConfirmationStep: React.FC = ({ group }) => { + const handleCopyLink = () => { + if (navigator.clipboard) { + navigator.clipboard.writeText(group.uri); + } + }; + + const handleShare = () => { + navigator.share({ + text: group.display_name, + url: group.uri, + }).catch((e) => { + if (e.name !== 'AbortError') console.error(e); + }); + }; + return ( @@ -59,6 +74,18 @@ const ConfirmationStep: React.FC = ({ group }) => { + + + {('share' in navigator) && ( + + )} + + + ); };