diff --git a/client/src/components/Home/MyFiles.tsx b/client/src/components/Home/MyFiles.tsx index 7f40c32..640d95d 100644 --- a/client/src/components/Home/MyFiles.tsx +++ b/client/src/components/Home/MyFiles.tsx @@ -14,6 +14,8 @@ import { Upload, Trash2, Share2, + Check, + Link, Download, Copy, Search, @@ -122,6 +124,7 @@ const MyFiles: React.FC = () => { // Share modal state const [shareModalOpen, setShareModalOpen] = useState(false); + const [copiedFileId, setCopiedFileId] = useState(null); const [selectedFileForShare, setSelectedFileForShare] = useState<{ _id: string; fileName: string; @@ -854,6 +857,15 @@ const MyFiles: React.FC = () => { toast.success("Share link copied to clipboard!"); }; + // ✅ Copy link directly without opening modal + const handleCopyLink = async (fileId: string, fileName: string) => { + const shareLink = `${window.location.origin}/share/${fileId}`; + await navigator.clipboard.writeText(shareLink); + await trackLinkCopy(fileId, fileName, shareLink); + setCopiedFileId(fileId); + setTimeout(() => setCopiedFileId(null), 2000); + }; + // ✅ Download file with tracking const handleDownload = async ( fileId: string, @@ -1745,6 +1757,26 @@ formatFileSize > + + + + + +