From 92bbb4468a9bdbe914463c81d2bc52b4c790f627 Mon Sep 17 00:00:00 2001 From: oiov Date: Mon, 7 Jul 2025 19:49:41 +0800 Subject: [PATCH] chore: add file links cpm --- components/file/file-list.tsx | 115 +++++++++++++++++----------------- components/file/uploader.tsx | 1 - components/shared/icons.tsx | 4 ++ public/sw.js.map | 2 +- 4 files changed, 62 insertions(+), 60 deletions(-) diff --git a/components/file/file-list.tsx b/components/file/file-list.tsx index 06dcac4..268b802 100644 --- a/components/file/file-list.tsx +++ b/components/file/file-list.tsx @@ -213,6 +213,55 @@ export default function UserFileList({ ); } + const renderFileLinks = (file: UserFileData, index: number) => ( + <> + {file.shortUrlId && ( +
+ + + https://{shortLinks[index]} + + +
+ )} +
+ + + {getFileUrl(file.path)} + + +
+
+ +

+ {`${file.name}${getFileUrl(file.path)}`} +

+ ${getFileUrl(file.path)}`} + /> +
+
+ +

+ {`[${file.name}](${getFileUrl(file.path)})`} +

+ +
+ + ); + const renderListView = () => (
@@ -291,36 +340,7 @@ export default function UserFileList({ alt={`${file.path}`} /> )} - {file.shortUrlId && ( -
- Shorten: - - https://{shortLinks[index]} - - -
- )} -
- Origin: - - {getFileUrl(file.path)} - - -
+ {renderFileLinks(file, index)} @@ -457,6 +477,7 @@ export default function UserFileList({ selectedFiles.find((f) => f.id === file.id) !== undefined && "bg-blue-50", )} + onClick={() => handleSelectFile(file)} >
{showMutiCheckBox && ( @@ -464,7 +485,7 @@ export default function UserFileList({ checked={ selectedFiles.find((f) => f.id === file.id) !== undefined } - onCheckedChange={() => handleSelectFile(file)} + // onCheckedChange={() => handleSelectFile(file)} className="absolute left-1 top-1 size-4 border-neutral-300 bg-neutral-100 data-[state=checked]:border-neutral-900 data-[state=checked]:bg-neutral-600 data-[state=checked]:text-neutral-100 dark:border-neutral-700 dark:bg-neutral-800 dark:data-[state=checked]:border-neutral-300 dark:data-[state=checked]:bg-neutral-300" /> )} @@ -493,32 +514,9 @@ export default function UserFileList({ alt={`${file.path}`} /> )} - {file.shortUrlId && ( -
- Shorten: - - https://{shortLinks[index]} - - -
- )} -
- Origin: - - {getFileUrl(file.path)} - -
+

+ {file.path} +

Size: {formatFileSize(file.size || 0)}

@@ -529,9 +527,10 @@ export default function UserFileList({ Modified:{" "} {formatDate(file.lastModified?.toString() || "")}

+ {renderFileLinks(file, index)}