refactor(sidebar): always render folder groups regardless of conversation count

This commit is contained in:
xintaofei
2026-04-22 10:53:22 +08:00
parent f0b3ec20a8
commit 78caf4d827

View File

@@ -651,11 +651,6 @@ export function SidebarConversationList({
[importing, addTask, updateTask, refreshConversations, t] [importing, addTask, updateTask, refreshConversations, t]
) )
const handleImport = useCallback(async () => {
if (!activeFolder) return
await handleImportForFolder(activeFolder.id)
}, [activeFolder, handleImportForFolder])
const handleOpenFolderAction = useCallback(async () => { const handleOpenFolderAction = useCallback(async () => {
if (isDesktop()) { if (isDesktop()) {
try { try {
@@ -695,9 +690,6 @@ export function SidebarConversationList({
const showEmptyWorkspaceActions = const showEmptyWorkspaceActions =
folders.length === 0 && conversations.length === 0 folders.length === 0 && conversations.length === 0
const emptyAfterFilter =
filteredConversations.length === 0 && conversations.length > 0
return ( return (
<div className="relative flex flex-col flex-1 min-h-0"> <div className="relative flex flex-col flex-1 min-h-0">
{(loading || refreshing) && ( {(loading || refreshing) && (
@@ -748,44 +740,6 @@ export function SidebarConversationList({
{tFolderDropdown("projectBoot")} {tFolderDropdown("projectBoot")}
</Button> </Button>
</div> </div>
) : conversations.length === 0 ? (
<ContextMenu>
<ContextMenuTrigger asChild>
<div className="flex-1 flex flex-col items-center justify-center px-3 gap-3">
<p className="text-muted-foreground text-xs text-center">
{t("noConversationsFound")}
</p>
<Button
variant="outline"
size="sm"
disabled={importing || !activeFolder}
onClick={handleImport}
>
{importing ? (
<Loader2 className="h-3.5 w-3.5 animate-spin mr-1.5" />
) : (
<Download className="h-3.5 w-3.5 mr-1.5" />
)}
{importing ? t("importing") : t("importLocalSessions")}
</Button>
</div>
</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem
onSelect={handleNewConversation}
disabled={!activeFolder}
>
<Plus className="h-4 w-4" />
{t("newConversation")}
</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
) : emptyAfterFilter ? (
<div className="flex-1 flex items-center justify-center px-3">
<p className="text-muted-foreground text-xs text-center">
{t("noMatchingConversations")}
</p>
</div>
) : ( ) : (
<ContextMenu> <ContextMenu>
<ContextMenuTrigger asChild> <ContextMenuTrigger asChild>