feat(sidebar): make whole header row clickable and fix database sortIndex generation

This commit is contained in:
yiling
2026-06-01 16:57:35 +08:00
parent 4302dad7c3
commit aaade94ec0
2 changed files with 7 additions and 4 deletions
+3 -3
View File
@@ -156,7 +156,7 @@ export function FolderTree({
>
<header className="group flex items-center justify-between px-2 mb-1 flex-none">
<div
className="flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors"
className="flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors"
onClick={() => setIsAssetsExpanded(!isAssetsExpanded)}
>
<h3 className="text-xs font-semibold uppercase tracking-wider">Assets</h3>
@@ -224,7 +224,7 @@ export function FolderTree({
>
<header className="group flex items-center justify-between px-2 mb-1 flex-none">
<div
className="flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors"
className="flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors"
onClick={() => setIsCollectionsExpanded(!isCollectionsExpanded)}
>
<h3 className="text-xs font-semibold uppercase tracking-wider">Collections</h3>
@@ -275,7 +275,7 @@ export function FolderTree({
>
<header className="group flex items-center justify-between px-2 mb-1 flex-none">
<div
className="flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors"
className="flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors"
onClick={() => setIsSharesExpanded(!isSharesExpanded)}
>
<h3 className="text-xs font-semibold uppercase tracking-wider">Share Links</h3>
+4 -1
View File
@@ -921,7 +921,10 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
// Generate sort index for new version inside the stack (newest gets the lowest sortIndex)
const firstChild = await prisma.asset.findFirst({
where: { parentId: stackId },
where: {
parentId: stackId,
NOT: { id: newFile.id },
},
orderBy: { sortIndex: 'asc' },
})
const newSortIndex = generateKeyBetween(null, firstChild?.sortIndex || null)