mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 12:36:52 +00:00
feat(file-browser): rename menu item to Copy name and download link
This commit is contained in:
@@ -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({
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
<span>{m.download()}</span>
|
||||
</ContextMenuItem>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndPath}>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndDownloadLink}>
|
||||
<Copy className="mr-2 h-4 w-4" />
|
||||
<span>{m.copy_name_and_path()}</span>
|
||||
<span>{m.copy_name_and_download_link()}</span>
|
||||
</ContextMenuItem>
|
||||
{canEdit && (
|
||||
<ContextMenuItem
|
||||
@@ -191,9 +191,9 @@ export function FileBrowserContextMenu({
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
<span>{m.download()}</span>
|
||||
</ContextMenuItem>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndPath}>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndDownloadLink}>
|
||||
<Copy className="mr-2 h-4 w-4" />
|
||||
<span>{m.copy_name_and_path()}</span>
|
||||
<span>{m.copy_name_and_download_link()}</span>
|
||||
</ContextMenuItem>
|
||||
{canEdit && (
|
||||
<ContextMenuItem onSelect={() => onMoveTo(itemsToModify)}>
|
||||
@@ -265,9 +265,9 @@ export function FileBrowserContextMenu({
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
<span>{m.download()}</span>
|
||||
</ContextMenuItem>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndPath}>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndDownloadLink}>
|
||||
<Copy className="mr-2 h-4 w-4" />
|
||||
<span>{m.copy_name_and_path()}</span>
|
||||
<span>{m.copy_name_and_download_link()}</span>
|
||||
</ContextMenuItem>
|
||||
|
||||
{canEdit && (
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "提供商",
|
||||
|
||||
+2
-2
@@ -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";
|
||||
|
||||
+2
-2
@@ -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'
|
||||
|
||||
Generated
Vendored
+16
@@ -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<Copied_Name_And_Download_Link_To_ClipboardInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Copied_Name_And_Download_Link_To_ClipboardInputs = {};
|
||||
+29
@@ -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<Copied_Name_And_Download_Link_To_ClipboardInputs, { locale?: "en" | "zh" }, {}>} */ ((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)
|
||||
});
|
||||
-16
@@ -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<Copied_Name_And_Path_To_ClipboardInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Copied_Name_And_Path_To_ClipboardInputs = {};
|
||||
@@ -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<Copied_Name_And_Path_To_ClipboardInputs, { locale?: "en" | "zh" }, {}>} */ ((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)
|
||||
});
|
||||
Generated
Vendored
+5
-5
@@ -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<Copy_Name_And_PathInputs, {
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Copy_Name_And_Download_LinkInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Copy_Name_And_PathInputs = {};
|
||||
export type Copy_Name_And_Download_LinkInputs = {};
|
||||
@@ -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<Copy_Name_And_Download_LinkInputs, { locale?: "en" | "zh" }, {}>} */ ((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)
|
||||
});
|
||||
@@ -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<Copy_Name_And_PathInputs, { locale?: "en" | "zh" }, {}>} */ ((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)
|
||||
});
|
||||
Reference in New Issue
Block a user