fix(backend,ui): fix version stack overcounting and ShareManager navigation issues

This commit is contained in:
yiling
2026-05-24 16:55:08 +08:00
parent 07f72c8c26
commit caf99650b9
4 changed files with 148 additions and 31 deletions
+25 -20
View File
@@ -7,6 +7,7 @@ import {
ContextMenuSub,
ContextMenuSubContent,
ContextMenuSubTrigger,
ContextMenuPortal,
} from '@/ui/components/ui/context-menu'
import {
Download,
@@ -177,16 +178,18 @@ export function FileBrowserContextMenu({
<Link className="mr-2 h-4 w-4" />
<span>Add to Share Links</span>
</ContextMenuSubTrigger>
<ContextMenuSubContent className="w-48">
{shareLinks.map((share) => (
<ContextMenuItem
key={share.id}
onSelect={() => onAddToShareLink?.(share.id, itemsToModify)}
>
<span className="truncate">{share.name}</span>
</ContextMenuItem>
))}
</ContextMenuSubContent>
<ContextMenuPortal>
<ContextMenuSubContent className="w-48">
{shareLinks.map((share) => (
<ContextMenuItem
key={share.id}
onSelect={() => onAddToShareLink?.(share.id, itemsToModify)}
>
<span className="truncate">{share.name}</span>
</ContextMenuItem>
))}
</ContextMenuSubContent>
</ContextMenuPortal>
</ContextMenuSub>
)}
</ContextMenuContent>
@@ -241,16 +244,18 @@ export function FileBrowserContextMenu({
<Link className="mr-2 h-4 w-4" />
<span>Add to Share Links</span>
</ContextMenuSubTrigger>
<ContextMenuSubContent className="w-48">
{shareLinks.map((share) => (
<ContextMenuItem
key={share.id}
onSelect={() => onAddToShareLink?.(share.id, itemsToModify)}
>
<span className="truncate">{share.name}</span>
</ContextMenuItem>
))}
</ContextMenuSubContent>
<ContextMenuPortal>
<ContextMenuSubContent className="w-48">
{shareLinks.map((share) => (
<ContextMenuItem
key={share.id}
onSelect={() => onAddToShareLink?.(share.id, itemsToModify)}
>
<span className="truncate">{share.name}</span>
</ContextMenuItem>
))}
</ContextMenuSubContent>
</ContextMenuPortal>
</ContextMenuSub>
)}
</ContextMenuContent>
+5 -3
View File
@@ -56,10 +56,12 @@ export default function ShareManager({
const [ancestorFolders, setAncestorFolders] = useState<AncestorFolder[]>([])
useEffect(() => {
if (shareRootId && !currentFolderId) {
if (shareRootId) {
setCurrentFolderId(shareRootId)
setAncestorFolders([])
setSelectedIds(new Set())
}
}, [shareRootId, currentFolderId])
}, [shareRootId, shareId])
const setProjectState = useTopNavStore((s) => s.setProjectState)
const clearProjectState = useTopNavStore((s) => s.clearProjectState)
@@ -157,7 +159,7 @@ export default function ShareManager({
: folders.find((f) => f.id === currentFolderId)?.name || shareLink.name,
type: 'folder',
},
isRootFolder: currentFolderId === shareRootId,
isRootFolder: false, // Ensure share link name or subfolder is always shown in TopNav
shareId,
onFolderClick: handleBreadcrumbClick,
})