From b876af464e8cb0eb16701aa2c3597a6781e13afe Mon Sep 17 00:00:00 2001 From: yiling Date: Mon, 27 Jul 2026 22:17:07 +0800 Subject: [PATCH] feat(file-browser): rename menu item to Copy name and download link --- .../components/file-browser/context-menu.tsx | 22 +++++++------- .../components/file-browser/file-browser.tsx | 4 +-- .../file-browser/use-file-actions.ts | 14 ++++----- packages/webui/messages/en.json | 4 +-- packages/webui/messages/zh.json | 4 +-- packages/webui/paraglide/messages/_index.d.ts | 4 +-- packages/webui/paraglide/messages/_index.js | 4 +-- ...d_name_and_download_link_to_clipboard.d.ts | 16 ++++++++++ ...ied_name_and_download_link_to_clipboard.js | 29 +++++++++++++++++++ .../copied_name_and_path_to_clipboard.d.ts | 16 ---------- .../copied_name_and_path_to_clipboard.js | 29 ------------------- ....d.ts => copy_name_and_download_link.d.ts} | 10 +++---- .../messages/copy_name_and_download_link.js | 29 +++++++++++++++++++ .../paraglide/messages/copy_name_and_path.js | 29 ------------------- 14 files changed, 107 insertions(+), 107 deletions(-) create mode 100644 packages/webui/paraglide/messages/copied_name_and_download_link_to_clipboard.d.ts create mode 100644 packages/webui/paraglide/messages/copied_name_and_download_link_to_clipboard.js delete mode 100644 packages/webui/paraglide/messages/copied_name_and_path_to_clipboard.d.ts delete mode 100644 packages/webui/paraglide/messages/copied_name_and_path_to_clipboard.js rename packages/webui/paraglide/messages/{copy_name_and_path.d.ts => copy_name_and_download_link.d.ts} (51%) create mode 100644 packages/webui/paraglide/messages/copy_name_and_download_link.js delete mode 100644 packages/webui/paraglide/messages/copy_name_and_path.js diff --git a/packages/webui/components/file-browser/context-menu.tsx b/packages/webui/components/file-browser/context-menu.tsx index 0eac5080..7b74ed35 100644 --- a/packages/webui/components/file-browser/context-menu.tsx +++ b/packages/webui/components/file-browser/context-menu.tsx @@ -30,7 +30,7 @@ interface FileBrowserContextMenuProps { onRename: (item: AssetInfo) => void onDelete: (items: AssetInfo[]) => void onDownload: (items: AssetInfo[]) => void - onCopyNameAndPath?: (items: AssetInfo[]) => void + onCopyNameAndDownloadLink?: (items: AssetInfo[]) => void onRestore: (items: AssetInfo[]) => void onNewFolder: (name: string) => void onUploadFile: () => void @@ -56,7 +56,7 @@ export function FileBrowserContextMenu({ onRename, onDelete, onDownload, - onCopyNameAndPath, + onCopyNameAndDownloadLink, onRestore, onNewFolder, onUploadFile, @@ -100,11 +100,11 @@ export function FileBrowserContextMenu({ } } - const handleCopyNameAndPath = () => { + const handleCopyNameAndDownloadLink = () => { if (isItemSelected) { - onCopyNameAndPath?.(selectedItems) + onCopyNameAndDownloadLink?.(selectedItems) } else if (item) { - onCopyNameAndPath?.([item]) + onCopyNameAndDownloadLink?.([item]) } } @@ -120,9 +120,9 @@ export function FileBrowserContextMenu({ {m.download()} - + - {m.copy_name_and_path()} + {m.copy_name_and_download_link()} {canEdit && ( {m.download()} - + - {m.copy_name_and_path()} + {m.copy_name_and_download_link()} {canEdit && ( onMoveTo(itemsToModify)}> @@ -265,9 +265,9 @@ export function FileBrowserContextMenu({ {m.download()} - + - {m.copy_name_and_path()} + {m.copy_name_and_download_link()} {canEdit && ( diff --git a/packages/webui/components/file-browser/file-browser.tsx b/packages/webui/components/file-browser/file-browser.tsx index 580f1c7a..07d4a3ca 100644 --- a/packages/webui/components/file-browser/file-browser.tsx +++ b/packages/webui/components/file-browser/file-browser.tsx @@ -400,7 +400,7 @@ export function FileBrowser({ handleRename, handleRestore, handleDownload, - handleCopyNameAndPath, + handleCopyNameAndDownloadLink, handleAction, onRenameSubmit, isDeleteDialogOpen, @@ -1162,7 +1162,7 @@ export function FileBrowser({ onRename={handleRename} onDelete={handleDelete} onDownload={handleDownload} - onCopyNameAndPath={handleCopyNameAndPath} + onCopyNameAndDownloadLink={handleCopyNameAndDownloadLink} onNewFolder={handleNewFolder} onUploadFile={handleUploadFilesClick} onUploadFolder={handleUploadFolderClick} diff --git a/packages/webui/components/file-browser/use-file-actions.ts b/packages/webui/components/file-browser/use-file-actions.ts index 8a936cf2..5ffedb69 100644 --- a/packages/webui/components/file-browser/use-file-actions.ts +++ b/packages/webui/components/file-browser/use-file-actions.ts @@ -228,7 +228,7 @@ export function useFileActions({ } } - const handleCopyNameAndPath = async (items: AssetInfo[]) => { + const handleCopyNameAndDownloadLink = async (items: AssetInfo[]) => { if (items.length === 0) return try { const res = await getDownloadLinks({ @@ -246,10 +246,10 @@ export function useFileActions({ const ok = await copyToClipboard(text) if (ok) { - toast.success(m.copied_name_and_path_to_clipboard()) + toast.success(m.copied_name_and_download_link_to_clipboard()) } } catch (error) { - toast.error('Failed to copy name and path') + toast.error('Failed to copy name and download link') console.error(error) } } @@ -350,7 +350,7 @@ export function useFileActions({ } const handleAction = ( - action: 'rename' | 'delete' | 'download' | 'restore' | 'copy-name-and-path', + action: 'rename' | 'delete' | 'download' | 'restore' | 'copy-name-and-download-link', item: AssetInfo, ) => { const isSelected = selectedIds.has(item.id!) @@ -371,8 +371,8 @@ export function useFileActions({ case 'restore': handleRestore(targetItems) break - case 'copy-name-and-path': - handleCopyNameAndPath(targetItems) + case 'copy-name-and-download-link': + handleCopyNameAndDownloadLink(targetItems) break } } @@ -384,7 +384,7 @@ export function useFileActions({ handleDelete, handleRestore, handleDownload, - handleCopyNameAndPath, + handleCopyNameAndDownloadLink, handleNewFolder, handleAction, onRenameSubmit, diff --git a/packages/webui/messages/en.json b/packages/webui/messages/en.json index 517ba13a..ac1a28f8 100644 --- a/packages/webui/messages/en.json +++ b/packages/webui/messages/en.json @@ -269,8 +269,8 @@ "failed_to_revoke_token": "Failed to revoke token", "copied_to_clipboard": "Copied to clipboard", "copied_api_token_to_clipboard": "Copied API token to clipboard", - "copy_name_and_path": "Copy name and path", - "copied_name_and_path_to_clipboard": "Copied name and path to clipboard", + "copy_name_and_download_link": "Copy name and download link", + "copied_name_and_download_link_to_clipboard": "Copied name and download link to clipboard", "ai": "AI", "providers": "Providers", diff --git a/packages/webui/messages/zh.json b/packages/webui/messages/zh.json index 9afa185d..04031fc7 100644 --- a/packages/webui/messages/zh.json +++ b/packages/webui/messages/zh.json @@ -269,8 +269,8 @@ "failed_to_revoke_token": "撤销令牌失败", "copied_to_clipboard": "已复制到剪贴板", "copied_api_token_to_clipboard": "已将 API 令牌复制到剪贴板", - "copy_name_and_path": "复制名称和路径", - "copied_name_and_path_to_clipboard": "已复制名称和路径到剪贴板", + "copy_name_and_download_link": "复制名称和下载链接", + "copied_name_and_download_link_to_clipboard": "已复制名称和下载链接到剪贴板", "ai": "AI", "providers": "提供商", diff --git a/packages/webui/paraglide/messages/_index.d.ts b/packages/webui/paraglide/messages/_index.d.ts index 3cc45ffd..cc08937b 100644 --- a/packages/webui/paraglide/messages/_index.d.ts +++ b/packages/webui/paraglide/messages/_index.d.ts @@ -254,8 +254,8 @@ export * from "./api_token_revoked_successfully.js"; export * from "./failed_to_revoke_token.js"; export * from "./copied_to_clipboard.js"; export * from "./copied_api_token_to_clipboard.js"; -export * from "./copy_name_and_path.js"; -export * from "./copied_name_and_path_to_clipboard.js"; +export * from "./copy_name_and_download_link.js"; +export * from "./copied_name_and_download_link_to_clipboard.js"; export * from "./ai.js"; export * from "./providers.js"; export * from "./providers_description.js"; diff --git a/packages/webui/paraglide/messages/_index.js b/packages/webui/paraglide/messages/_index.js index 3892f7cf..e2178a50 100644 --- a/packages/webui/paraglide/messages/_index.js +++ b/packages/webui/paraglide/messages/_index.js @@ -256,8 +256,8 @@ export * from './api_token_revoked_successfully.js' export * from './failed_to_revoke_token.js' export * from './copied_to_clipboard.js' export * from './copied_api_token_to_clipboard.js' -export * from './copy_name_and_path.js' -export * from './copied_name_and_path_to_clipboard.js' +export * from './copy_name_and_download_link.js' +export * from './copied_name_and_download_link_to_clipboard.js' export * from './ai.js' export * from './providers.js' export * from './providers_description.js' diff --git a/packages/webui/paraglide/messages/copied_name_and_download_link_to_clipboard.d.ts b/packages/webui/paraglide/messages/copied_name_and_download_link_to_clipboard.d.ts new file mode 100644 index 00000000..32b4bc84 --- /dev/null +++ b/packages/webui/paraglide/messages/copied_name_and_download_link_to_clipboard.d.ts @@ -0,0 +1,16 @@ +/** +* | output | +* | --- | +* | "Copied name and download link to clipboard" | +* +* @param {Copied_Name_And_Download_Link_To_ClipboardInputs} inputs +* @param {{ locale?: "en" | "zh" }} options +* @returns {LocalizedString} +*/ +export const copied_name_and_download_link_to_clipboard: ((inputs?: Copied_Name_And_Download_Link_To_ClipboardInputs, options?: { + locale?: "en" | "zh"; +}) => LocalizedString) & import("../runtime.js").MessageMetadata; +export type LocalizedString = import("../runtime.js").LocalizedString; +export type Copied_Name_And_Download_Link_To_ClipboardInputs = {}; diff --git a/packages/webui/paraglide/messages/copied_name_and_download_link_to_clipboard.js b/packages/webui/paraglide/messages/copied_name_and_download_link_to_clipboard.js new file mode 100644 index 00000000..63124040 --- /dev/null +++ b/packages/webui/paraglide/messages/copied_name_and_download_link_to_clipboard.js @@ -0,0 +1,29 @@ +/* eslint-disable */ +import { getLocale, experimentalStaticLocale } from '../runtime.js'; + +/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ + +/** @typedef {{}} Copied_Name_And_Download_Link_To_ClipboardInputs */ + +const en_copied_name_and_download_link_to_clipboard = /** @type {(inputs: Copied_Name_And_Download_Link_To_ClipboardInputs) => LocalizedString} */ () => { + return /** @type {LocalizedString} */ (`Copied name and download link to clipboard`) +}; + +const zh_copied_name_and_download_link_to_clipboard = /** @type {(inputs: Copied_Name_And_Download_Link_To_ClipboardInputs) => LocalizedString} */ () => { + return /** @type {LocalizedString} */ (`已复制名称和下载链接到剪贴板`) +}; + +/** +* | output | +* | --- | +* | "Copied name and download link to clipboard" | +* +* @param {Copied_Name_And_Download_Link_To_ClipboardInputs} inputs +* @param {{ locale?: "en" | "zh" }} options +* @returns {LocalizedString} +*/ +export const copied_name_and_download_link_to_clipboard = /** @type {((inputs?: Copied_Name_And_Download_Link_To_ClipboardInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata} */ ((inputs = {}, options = {}) => { + const locale = experimentalStaticLocale ?? options.locale ?? getLocale() + if (locale === "en") return en_copied_name_and_download_link_to_clipboard(inputs) + return zh_copied_name_and_download_link_to_clipboard(inputs) +}); \ No newline at end of file diff --git a/packages/webui/paraglide/messages/copied_name_and_path_to_clipboard.d.ts b/packages/webui/paraglide/messages/copied_name_and_path_to_clipboard.d.ts deleted file mode 100644 index 3727db58..00000000 --- a/packages/webui/paraglide/messages/copied_name_and_path_to_clipboard.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** -* | output | -* | --- | -* | "Copied name and path to clipboard" | -* -* @param {Copied_Name_And_Path_To_ClipboardInputs} inputs -* @param {{ locale?: "en" | "zh" }} options -* @returns {LocalizedString} -*/ -export const copied_name_and_path_to_clipboard: ((inputs?: Copied_Name_And_Path_To_ClipboardInputs, options?: { - locale?: "en" | "zh"; -}) => LocalizedString) & import("../runtime.js").MessageMetadata; -export type LocalizedString = import("../runtime.js").LocalizedString; -export type Copied_Name_And_Path_To_ClipboardInputs = {}; diff --git a/packages/webui/paraglide/messages/copied_name_and_path_to_clipboard.js b/packages/webui/paraglide/messages/copied_name_and_path_to_clipboard.js deleted file mode 100644 index 1d8060c9..00000000 --- a/packages/webui/paraglide/messages/copied_name_and_path_to_clipboard.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable */ -import { getLocale, experimentalStaticLocale } from '../runtime.js'; - -/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ - -/** @typedef {{}} Copied_Name_And_Path_To_ClipboardInputs */ - -const en_copied_name_and_path_to_clipboard = /** @type {(inputs: Copied_Name_And_Path_To_ClipboardInputs) => LocalizedString} */ () => { - return /** @type {LocalizedString} */ (`Copied name and path to clipboard`) -}; - -const zh_copied_name_and_path_to_clipboard = /** @type {(inputs: Copied_Name_And_Path_To_ClipboardInputs) => LocalizedString} */ () => { - return /** @type {LocalizedString} */ (`已复制名称和路径到剪贴板`) -}; - -/** -* | output | -* | --- | -* | "Copied name and path to clipboard" | -* -* @param {Copied_Name_And_Path_To_ClipboardInputs} inputs -* @param {{ locale?: "en" | "zh" }} options -* @returns {LocalizedString} -*/ -export const copied_name_and_path_to_clipboard = /** @type {((inputs?: Copied_Name_And_Path_To_ClipboardInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata} */ ((inputs = {}, options = {}) => { - const locale = experimentalStaticLocale ?? options.locale ?? getLocale() - if (locale === "en") return en_copied_name_and_path_to_clipboard(inputs) - return zh_copied_name_and_path_to_clipboard(inputs) -}); \ No newline at end of file diff --git a/packages/webui/paraglide/messages/copy_name_and_path.d.ts b/packages/webui/paraglide/messages/copy_name_and_download_link.d.ts similarity index 51% rename from packages/webui/paraglide/messages/copy_name_and_path.d.ts rename to packages/webui/paraglide/messages/copy_name_and_download_link.d.ts index 03605394..72960f15 100644 --- a/packages/webui/paraglide/messages/copy_name_and_path.d.ts +++ b/packages/webui/paraglide/messages/copy_name_and_download_link.d.ts @@ -1,16 +1,16 @@ /** * | output | * | --- | -* | "Copy name and path" | +* | "Copy name and download link" | * -* @param {Copy_Name_And_PathInputs} inputs +* @param {Copy_Name_And_Download_LinkInputs} inputs * @param {{ locale?: "en" | "zh" }} options * @returns {LocalizedString} */ -export const copy_name_and_path: ((inputs?: Copy_Name_And_PathInputs, options?: { +export const copy_name_and_download_link: ((inputs?: Copy_Name_And_Download_LinkInputs, options?: { locale?: "en" | "zh"; -}) => LocalizedString) & import("../runtime.js").MessageMetadata LocalizedString) & import("../runtime.js").MessageMetadata; export type LocalizedString = import("../runtime.js").LocalizedString; -export type Copy_Name_And_PathInputs = {}; +export type Copy_Name_And_Download_LinkInputs = {}; diff --git a/packages/webui/paraglide/messages/copy_name_and_download_link.js b/packages/webui/paraglide/messages/copy_name_and_download_link.js new file mode 100644 index 00000000..a712c305 --- /dev/null +++ b/packages/webui/paraglide/messages/copy_name_and_download_link.js @@ -0,0 +1,29 @@ +/* eslint-disable */ +import { getLocale, experimentalStaticLocale } from '../runtime.js'; + +/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ + +/** @typedef {{}} Copy_Name_And_Download_LinkInputs */ + +const en_copy_name_and_download_link = /** @type {(inputs: Copy_Name_And_Download_LinkInputs) => LocalizedString} */ () => { + return /** @type {LocalizedString} */ (`Copy name and download link`) +}; + +const zh_copy_name_and_download_link = /** @type {(inputs: Copy_Name_And_Download_LinkInputs) => LocalizedString} */ () => { + return /** @type {LocalizedString} */ (`复制名称和下载链接`) +}; + +/** +* | output | +* | --- | +* | "Copy name and download link" | +* +* @param {Copy_Name_And_Download_LinkInputs} inputs +* @param {{ locale?: "en" | "zh" }} options +* @returns {LocalizedString} +*/ +export const copy_name_and_download_link = /** @type {((inputs?: Copy_Name_And_Download_LinkInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata} */ ((inputs = {}, options = {}) => { + const locale = experimentalStaticLocale ?? options.locale ?? getLocale() + if (locale === "en") return en_copy_name_and_download_link(inputs) + return zh_copy_name_and_download_link(inputs) +}); \ No newline at end of file diff --git a/packages/webui/paraglide/messages/copy_name_and_path.js b/packages/webui/paraglide/messages/copy_name_and_path.js deleted file mode 100644 index 5a7bf697..00000000 --- a/packages/webui/paraglide/messages/copy_name_and_path.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable */ -import { getLocale, experimentalStaticLocale } from '../runtime.js'; - -/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ - -/** @typedef {{}} Copy_Name_And_PathInputs */ - -const en_copy_name_and_path = /** @type {(inputs: Copy_Name_And_PathInputs) => LocalizedString} */ () => { - return /** @type {LocalizedString} */ (`Copy name and path`) -}; - -const zh_copy_name_and_path = /** @type {(inputs: Copy_Name_And_PathInputs) => LocalizedString} */ () => { - return /** @type {LocalizedString} */ (`复制名称和路径`) -}; - -/** -* | output | -* | --- | -* | "Copy name and path" | -* -* @param {Copy_Name_And_PathInputs} inputs -* @param {{ locale?: "en" | "zh" }} options -* @returns {LocalizedString} -*/ -export const copy_name_and_path = /** @type {((inputs?: Copy_Name_And_PathInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata} */ ((inputs = {}, options = {}) => { - const locale = experimentalStaticLocale ?? options.locale ?? getLocale() - if (locale === "en") return en_copy_name_and_path(inputs) - return zh_copy_name_and_path(inputs) -}); \ No newline at end of file