From c4a9a6db437c0e4f3756f2bdf80ee9d2702e3624 Mon Sep 17 00:00:00 2001 From: Eric Doughty-Papassideris Date: Sun, 21 Apr 2024 22:10:40 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20front:=20moved=20copy=20li?= =?UTF-8?q?nk=20button=20to=20own=20file=20(#50)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modals/public-link/copy-link-button.tsx | 42 +++++++++++++++++++ .../modals/public-link/public-link-access.tsx | 32 ++------------ 2 files changed, 46 insertions(+), 28 deletions(-) create mode 100644 tdrive/frontend/src/app/views/client/body/drive/modals/public-link/copy-link-button.tsx diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/copy-link-button.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/copy-link-button.tsx new file mode 100644 index 000000000..78f2c6b69 --- /dev/null +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/copy-link-button.tsx @@ -0,0 +1,42 @@ +import { useState } from 'react'; + +import Languages from 'features/global/services/languages-service'; +import { copyToClipboard } from '@features/global/utils/CopyClipboard'; + +import { Button } from '@atoms/button/button'; +import { LinkIcon, CheckCircleIcon } from '@heroicons/react/outline'; + +export const CopyLinkButton = (props: { + textToCopy?: string | false; +}) => { + const [didJustCompleteACopy, setDidJustCompleteACopy] = useState(false); + const haveTextToCopy = props.textToCopy && props.textToCopy.length > 0 || false; + return ( + + ); +} \ No newline at end of file diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access.tsx index cd88a3b3d..635b2f350 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access.tsx @@ -9,6 +9,7 @@ import { Button } from '@atoms/button/button'; import { LinkIcon, UserGroupIcon, CheckCircleIcon } from '@heroicons/react/outline'; import type { DriveFileAccessLevelForPublicLink } from 'app/features/drive/types'; import { changePublicLink } from '@features/files/utils/access-info-helpers'; +import { CopyLinkButton } from './copy-link-button'; export const PublicLinkManager = ({ id, disabled }: { id: string; disabled?: boolean }) => { const { item, loading, update } = useDriveItem(id); @@ -42,34 +43,9 @@ export const PublicLinkManager = ({ id, disabled }: { id: string; disabled?: boo theme={havePublicLink ? "blue" : "outline"} value={havePublicLink ? publicLink : Languages.t('components.public-link-acess.public-link-placeholder')} /> - +