diff --git a/frontend/src/components/account/showShareLinkModal.tsx b/frontend/src/components/account/showShareLinkModal.tsx new file mode 100644 index 000000000..e4dc94047 --- /dev/null +++ b/frontend/src/components/account/showShareLinkModal.tsx @@ -0,0 +1,16 @@ +import { Stack, TextInput } from "@mantine/core"; +import { ModalsContextProps } from "@mantine/modals/lib/context"; + +const showShareLinkModal = (modals: ModalsContextProps, shareId: string) => { + const link = `${window.location.origin}/share/${shareId}`; + return modals.openModal({ + title: "Share link", + children: ( + + + + ), + }); +}; + +export default showShareLinkModal; diff --git a/frontend/src/components/upload/modals/showCompletedUploadModal.tsx b/frontend/src/components/upload/modals/showCompletedUploadModal.tsx index b66bb0052..afbf2f32b 100644 --- a/frontend/src/components/upload/modals/showCompletedUploadModal.tsx +++ b/frontend/src/components/upload/modals/showCompletedUploadModal.tsx @@ -40,14 +40,16 @@ const Body = ({ share }: { share: Share }) => { variant="filled" value={link} rightSection={ - { - clipboard.copy(link); - toast.success("Your link was copied to the keyboard."); - }} - > - - + window.isSecureContext && ( + { + clipboard.copy(link); + toast.success("Your link was copied to the keyboard."); + }} + > + + + ) } /> { variant="light" size={25} onClick={() => { - clipboard.copy( - `${window.location.origin}/share/${share.id}` - ); - toast.success( - "Your link was copied to the keyboard." - ); + if (window.isSecureContext) { + clipboard.copy( + `${window.location.origin}/share/${share.id}` + ); + toast.success( + "Your link was copied to the keyboard." + ); + } else { + showShareLinkModal(modals, share.id); + } }} >