mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 15:14:10 +00:00
feat(file-browser): add context-aware copy submenu (#517)
* feat(file-browser): add context-aware copy submenu * refactor(file-browser): address code review feedback for copy submenu * fix(webui): align submenu trigger text and widen file context menu * test(e2e): guard clipboard permissions in copy-menu spec for cross-browser support
This commit is contained in:
@@ -12,6 +12,8 @@ import { useDraggable, useDroppable } from '@dnd-kit/react'
|
||||
import type { AssetInfo, ChildPreview } from '@shumai/dtos'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { getTrashDaysLeft } from '@/ui/lib/time'
|
||||
import { CopyDropdownMenuSub } from './copy-submenu'
|
||||
import type { CopyKind } from './copy-options'
|
||||
import {
|
||||
Archive,
|
||||
ArchiveRestore,
|
||||
@@ -68,6 +70,8 @@ interface FolderCardProps {
|
||||
allowDownload?: boolean
|
||||
hideCheckbox?: boolean
|
||||
hideActions?: boolean
|
||||
isTeamOwner?: boolean
|
||||
onCopy?: (kind: CopyKind, items: AssetInfo[]) => void
|
||||
}
|
||||
|
||||
const FolderPreviewGrid = ({ items }: { items: ChildPreview[] }) => {
|
||||
@@ -140,6 +144,8 @@ export function FolderCard({
|
||||
dragState,
|
||||
disabled,
|
||||
onAction,
|
||||
onCopy,
|
||||
isTeamOwner = false,
|
||||
isRecentlyDeleted,
|
||||
isRecents,
|
||||
selectedCount,
|
||||
@@ -473,6 +479,16 @@ export function FolderCard({
|
||||
<span>{m.download()}</span>
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{!isRecentlyDeleted && !isShareView && (
|
||||
<CopyDropdownMenuSub
|
||||
items={[item]}
|
||||
context={{
|
||||
isTeamOwner,
|
||||
allowDownload,
|
||||
}}
|
||||
onCopy={(kind, targetItems) => onCopy?.(kind, targetItems)}
|
||||
/>
|
||||
)}
|
||||
{canEdit && archiveStorageEnabled && (
|
||||
<>
|
||||
<DropdownMenuItem
|
||||
|
||||
Reference in New Issue
Block a user