feat(sidebar-conversation-list): show empty-state hint inside expanded folders with no visible conversations
This commit is contained in:
@@ -335,6 +335,7 @@ interface FolderGroupItemProps {
|
|||||||
folderId: number
|
folderId: number
|
||||||
folderName: string
|
folderName: string
|
||||||
conversations: DbConversationSummary[]
|
conversations: DbConversationSummary[]
|
||||||
|
totalConversationCount: number
|
||||||
expanded: boolean
|
expanded: boolean
|
||||||
importing: boolean
|
importing: boolean
|
||||||
reordering: boolean
|
reordering: boolean
|
||||||
@@ -367,6 +368,7 @@ function FolderGroupItem({
|
|||||||
folderId,
|
folderId,
|
||||||
folderName,
|
folderName,
|
||||||
conversations,
|
conversations,
|
||||||
|
totalConversationCount,
|
||||||
expanded,
|
expanded,
|
||||||
importing,
|
importing,
|
||||||
reordering,
|
reordering,
|
||||||
@@ -456,6 +458,18 @@ function FolderGroupItem({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{expanded &&
|
{expanded &&
|
||||||
|
(conversations.length === 0 ? (
|
||||||
|
<div
|
||||||
|
className="py-[0.375rem] text-[0.75rem] text-muted-foreground/70"
|
||||||
|
style={{
|
||||||
|
paddingLeft: "calc(var(--conv-rail-axis) + 0.875rem)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{totalConversationCount === 0
|
||||||
|
? t("emptyFolderHint")
|
||||||
|
: t("noMatchingConversations")}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
conversations.map((conv) => (
|
conversations.map((conv) => (
|
||||||
<SidebarConversationCard
|
<SidebarConversationCard
|
||||||
key={`conv-${conv.agent_type}-${conv.id}`}
|
key={`conv-${conv.agent_type}-${conv.id}`}
|
||||||
@@ -477,6 +491,7 @@ function FolderGroupItem({
|
|||||||
onStatusChange={onStatusChange}
|
onStatusChange={onStatusChange}
|
||||||
onNewConversation={onNewConversation}
|
onNewConversation={onNewConversation}
|
||||||
/>
|
/>
|
||||||
|
))
|
||||||
))}
|
))}
|
||||||
</Reorder.Item>
|
</Reorder.Item>
|
||||||
</div>
|
</div>
|
||||||
@@ -619,6 +634,14 @@ export function SidebarConversationList({
|
|||||||
return map
|
return map
|
||||||
}, [filteredConversations, sortMode])
|
}, [filteredConversations, sortMode])
|
||||||
|
|
||||||
|
const folderTotalCounts = useMemo(() => {
|
||||||
|
const map = new Map<number, number>()
|
||||||
|
for (const conv of conversations) {
|
||||||
|
map.set(conv.folder_id, (map.get(conv.folder_id) ?? 0) + 1)
|
||||||
|
}
|
||||||
|
return map
|
||||||
|
}, [conversations])
|
||||||
|
|
||||||
const orderedFolderIds = useMemo(() => {
|
const orderedFolderIds = useMemo(() => {
|
||||||
const folderIdSet = new Set(folders.map((f) => f.id))
|
const folderIdSet = new Set(folders.map((f) => f.id))
|
||||||
// During drag we honour the optimistic order so sibling folders shift live
|
// During drag we honour the optimistic order so sibling folders shift live
|
||||||
@@ -1036,6 +1059,9 @@ export function SidebarConversationList({
|
|||||||
folderId={folderId}
|
folderId={folderId}
|
||||||
folderName={folderName}
|
folderName={folderName}
|
||||||
conversations={convsWithKey}
|
conversations={convsWithKey}
|
||||||
|
totalConversationCount={
|
||||||
|
folderTotalCounts.get(folderId) ?? 0
|
||||||
|
}
|
||||||
expanded={expanded}
|
expanded={expanded}
|
||||||
importing={importing}
|
importing={importing}
|
||||||
reordering={reordering}
|
reordering={reordering}
|
||||||
|
|||||||
Reference in New Issue
Block a user