diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index 6a1eaf079a77f86e14c2468f10926187988a09dd..e83602a47549138642f8698b8af7f9088c4c478a 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -53,6 +53,14 @@ function DialogContent({ }: React.ComponentProps & { showCloseButton?: boolean }) { + // 检查 children 中是否已经包含 DialogDescription + const hasDescription = React.Children.toArray(children).some((child) => { + if (React.isValidElement(child)) { + return child.type === DialogDescription || child.type === DialogPrimitive.Description + } + return false + }) + return ( @@ -65,6 +73,12 @@ function DialogContent({ {...props} > {children} + {/* 如果没有 DialogDescription,添加一个隐藏的空描述以满足无障碍要求 */} + {!hasDescription && ( + + Dialog content + + )} {showCloseButton && ( ({ ...p, pageIndex: 0 })) - toast.success('回收站已清空') void fetchRecyclePage() } catch { // 失败时重新拉取,恢复真实数据 diff --git a/src/pages/files/components/UploadModal.tsx b/src/pages/files/components/UploadModal.tsx index d42aae0f075f00a52f06d97b5da94a0dcbab3b26..dd2fdf2443b6db612432f1b93e825e813287ce72 100644 --- a/src/pages/files/components/UploadModal.tsx +++ b/src/pages/files/components/UploadModal.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react' +import { useState, useEffect, useCallback, memo } from 'react' import { useTranslation } from 'react-i18next' import { useTransferStore } from '@/store/transfer' import { Upload, X, FileIcon, FolderUp } from 'lucide-react' @@ -159,13 +159,10 @@ export default function UploadModal({ .map((item) => item.webkitGetAsEntry?.()) .filter(Boolean) - if (files.length > 0) { - setFileList([...fileList, ...files]) - } else { - // 如果没有通过 webkitGetAsEntry 获取到文件,使用传统方式 - const fallbackFiles = Array.from(e.dataTransfer.files) as FileWithPath[] - if (!isDirectoryMode && fallbackFiles.length + fileList.length > 10) { - toast.warning(t('upload.toastMax')) + if (entries.length > 0) { + await Promise.all(entries.map((entry) => readEntry(entry))) + if (files.length > 0) { + setFileList((prev) => [...prev, ...files]) return } } @@ -175,13 +172,13 @@ export default function UploadModal({ if (!isDirectoryMode && fallbackFiles.length > 0) { setFileList((prev) => { if (!isDirectoryMode && fallbackFiles.length + prev.length > 10) { - toast.warning('单次最多上传 10 个文件') + toast.warning(t('upload.toastMax')) return prev } return [...prev, ...fallbackFiles] }) } - }, [isDirectoryMode]) + }, [isDirectoryMode, t]) const handleSubmit = async () => { if (fileList.length === 0) { @@ -202,8 +199,18 @@ export default function UploadModal({ await Promise.all(fileList.map((file) => createTask(file, parentId))) } - // 关闭弹窗(进度见右下角 UploadPanel,不再弹 toast,避免挡住进度条) + // 关闭弹窗 onOpenChange(false) + + // 显示通知 + toast.success( + isDirectoryMode + ? t('operations.uploadFolderAdded') + : t('operations.uploadFileAdded'), + { + description: t('operations.uploadCheckProgress'), + } + ) } // 获取显示的文件名 @@ -216,7 +223,7 @@ export default function UploadModal({ return ( - + {isDirectoryMode ? t('upload.titleFolder') : t('upload.titleFile')} diff --git a/src/pages/settings/members/index.tsx b/src/pages/settings/members/index.tsx index 63929dd9fb3fa964f0f8abd9ddf30d8616582aa5..13f78d8859a78508bf49251f1ed7573517cefd48 100644 --- a/src/pages/settings/members/index.tsx +++ b/src/pages/settings/members/index.tsx @@ -70,6 +70,9 @@ export function SettingsMembers() { const { t } = useTranslation('settings') const { hasPermission } = usePermission() const { user: currentUser, activateWorkspace } = useAuth() + const workspaces = useWorkspaceStore((s) => s.workspaces) + const currentWorkspaceId = useWorkspaceStore((s) => s.currentWorkspaceId) + const currentWorkspace = workspaces.find((w) => w.id === currentWorkspaceId) const canManageMembers = hasPermission('member:manage') const canInvite = canManageMembers const canCancelInvitation = canManageMembers @@ -195,6 +198,7 @@ export function SettingsMembers() { const totalPages = Math.ceil(members.total / PAGE_SIZE) const isSelf = (userId: string) => userId === currentUser?.id + const isOwner = (userId: string) => userId === currentWorkspace?.ownerId return (
@@ -296,7 +300,7 @@ export function SettingsMembers() {
- {canUpdateRole && !isSelf(m.userId) ? ( + {canUpdateRole && !isSelf(m.userId) && !isOwner(m.userId) ? ( ) : ( - - {m.roleName} - +
+ + {m.roleName} + + {isOwner(m.userId) && ( + + 所有者 + + )} +
)}
@@ -333,7 +346,7 @@ export function SettingsMembers() { {canShowActions && ( - {!isSelf(m.userId) && ( + {!isSelf(m.userId) && !isOwner(m.userId) && ( - - -

{setting.enabled === 1 ? '禁用' : '启用'}

-
- - - - - - - -

查看配置

-
-
- - - - - - -

编辑配置

-
-
- - - - - - -

删除配置

-
-
- +
+ +
+ + +