fix(webui): truncate long folder, collection, and share link names in sidebar

This commit is contained in:
yiling
2026-06-22 15:22:44 +08:00
parent 7aa347df92
commit 8eab02ab28
+15 -12
View File
@@ -469,7 +469,7 @@ export function FolderTree({
<ScrollArea <ScrollArea
className={cn( className={cn(
'flex-1 min-h-0 transition-all duration-300 ease-in-out', 'flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!',
isAssetsExpanded isAssetsExpanded
? 'opacity-100 visible pointer-events-auto' ? 'opacity-100 visible pointer-events-auto'
: 'opacity-0 invisible pointer-events-none h-0', : 'opacity-0 invisible pointer-events-none h-0',
@@ -569,7 +569,7 @@ export function FolderTree({
<ScrollArea <ScrollArea
className={cn( className={cn(
'flex-1 min-h-0 transition-all duration-300 ease-in-out', 'flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!',
isCollectionsExpanded isCollectionsExpanded
? 'opacity-100 visible pointer-events-auto' ? 'opacity-100 visible pointer-events-auto'
: 'opacity-0 invisible pointer-events-none h-0', : 'opacity-0 invisible pointer-events-none h-0',
@@ -599,7 +599,7 @@ export function FolderTree({
<div <div
key={collection.id} key={collection.id}
className={cn( className={cn(
'group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground', 'group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0',
isColActive && 'bg-sidebar-accent text-sidebar-accent-foreground font-medium', isColActive && 'bg-sidebar-accent text-sidebar-accent-foreground font-medium',
)} )}
onClick={() => onClick={() =>
@@ -620,7 +620,7 @@ export function FolderTree({
{canEdit && ( {canEdit && (
<div <div
className="opacity-0 group-hover:opacity-100 transition-opacity" className="opacity-0 group-hover:opacity-100 transition-opacity shrink-0"
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
> >
<DropdownMenu modal={false}> <DropdownMenu modal={false}>
@@ -705,7 +705,7 @@ export function FolderTree({
<ScrollArea <ScrollArea
className={cn( className={cn(
'flex-1 min-h-0 transition-all duration-300 ease-in-out', 'flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!',
isSharesExpanded isSharesExpanded
? 'opacity-100 visible pointer-events-auto' ? 'opacity-100 visible pointer-events-auto'
: 'opacity-0 invisible pointer-events-none h-0', : 'opacity-0 invisible pointer-events-none h-0',
@@ -958,7 +958,7 @@ function ShareLinkItem({
<div <div
ref={setDroppableRef} ref={setDroppableRef}
className={cn( className={cn(
'group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground', 'group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0',
isActive && 'bg-sidebar-accent text-sidebar-accent-foreground font-medium', isActive && 'bg-sidebar-accent text-sidebar-accent-foreground font-medium',
isOver && isValidDropTarget && 'bg-sidebar-accent ring-2 ring-primary ring-inset', isOver && isValidDropTarget && 'bg-sidebar-accent ring-2 ring-primary ring-inset',
)} )}
@@ -978,7 +978,7 @@ function ShareLinkItem({
{canEdit && ( {canEdit && (
<div <div
className="opacity-0 group-hover:opacity-100 transition-opacity" className="opacity-0 group-hover:opacity-100 transition-opacity shrink-0"
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
> >
<DropdownMenu modal={false}> <DropdownMenu modal={false}>
@@ -1176,7 +1176,7 @@ function FolderTreeItem({
<div <div
ref={setNodeRef} ref={setNodeRef}
className={cn( className={cn(
'group flex cursor-pointer items-center gap-1 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground', 'group flex cursor-pointer items-center gap-1 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0',
(isActive || isSelected) && (isActive || isSelected) &&
'bg-sidebar-accent text-sidebar-accent-foreground font-medium', 'bg-sidebar-accent text-sidebar-accent-foreground font-medium',
isDragging && 'opacity-50', isDragging && 'opacity-50',
@@ -1188,7 +1188,10 @@ function FolderTreeItem({
onClick={handleFolderClick} onClick={handleFolderClick}
> >
{!isRoot && ( {!isRoot && (
<button onClick={handleToggleExpand} className="flex h-4 w-4 items-center justify-center"> <button
onClick={handleToggleExpand}
className="flex h-4 w-4 items-center justify-center shrink-0"
>
{isExpanded ? ( {isExpanded ? (
<ChevronDown className="h-3 w-3" /> <ChevronDown className="h-3 w-3" />
) : ( ) : (
@@ -1197,15 +1200,15 @@ function FolderTreeItem({
</button> </button>
)} )}
{isRoot ? ( {isRoot ? (
<Clapperboard className="h-4 w-4 text-sidebar-primary" /> <Clapperboard className="h-4 w-4 text-sidebar-primary shrink-0" />
) : ( ) : (
<Folder className="h-4 w-4 text-sidebar-primary" /> <Folder className="h-4 w-4 text-sidebar-primary shrink-0" />
)} )}
<span className="flex-1 truncate text-sidebar-foreground">{folder.name}</span> <span className="flex-1 truncate text-sidebar-foreground">{folder.name}</span>
{canEdit && !isRoot && ( {canEdit && !isRoot && (
<div <div
className="opacity-0 group-hover:opacity-100 transition-opacity" className="opacity-0 group-hover:opacity-100 transition-opacity shrink-0"
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
> >
<DropdownMenu modal={false}> <DropdownMenu modal={false}>