Replace the legacy folder + welcome routes with a unified /workspace route that hosts all folders, conversations, tabs, and terminals in one window. - Persist opened tabs to the database (opened_tabs entity + migration) so tab layout survives restarts and deep-link bootstrap restores state - Replace FolderContext shim with AppWorkspaceProvider, ActiveFolderProvider, and TabProvider; expose both opened (folders) and full DB (allFolders) listings via list_all_folder_details - Return conversations across all non-deleted folders from list_all when no folder filter is given, so the sidebar can show every folder's history - Add ConversationContextBar above the chat input with folder picker (auto-opens unopened folders on select), branch picker, and commit / push / merge / stash entries to restore BranchDropdown functionality - Rework sidebar with stats header, search, flat / folder-grouped view modes (localStorage-persisted), reveal-in-sidebar event subscriber, and per-folder context menu (focus, close tabs, remove from workspace); indent conversations under folder headers in grouped mode - Gate terminal creation on active folder and show folder context - Remove deprecated BranchDropdown, FolderNameDropdown, welcome route, and per-folder window commands - Localize all new strings across 10 locales
69 lines
2.1 KiB
TypeScript
69 lines
2.1 KiB
TypeScript
"use client"
|
|
|
|
import { useMemo } from "react"
|
|
import { BarChart3 } from "lucide-react"
|
|
import { useTranslations } from "next-intl"
|
|
import { useAppWorkspace } from "@/contexts/app-workspace-context"
|
|
import { AGENT_LABELS } from "@/lib/types"
|
|
import { AgentIcon } from "@/components/agent-icon"
|
|
import {
|
|
Popover,
|
|
PopoverContent,
|
|
PopoverTrigger,
|
|
} from "@/components/ui/popover"
|
|
|
|
export function StatusBarStats() {
|
|
const t = useTranslations("Folder.statusBar.stats")
|
|
const { stats } = useAppWorkspace()
|
|
|
|
const activeAgents = useMemo(
|
|
() => stats?.by_agent.filter((a) => a.conversation_count > 0) ?? [],
|
|
[stats]
|
|
)
|
|
|
|
if (!stats) return null
|
|
|
|
return (
|
|
<Popover>
|
|
<PopoverTrigger asChild>
|
|
<button className="flex items-center gap-1.5 hover:text-foreground transition-colors">
|
|
<BarChart3 className="h-3 w-3" />
|
|
<span>
|
|
{t("conversations", { count: stats.total_conversations })}
|
|
</span>
|
|
<span className="flex items-center gap-1 ml-1">
|
|
{activeAgents.map((a) => (
|
|
<AgentIcon
|
|
key={a.agent_type}
|
|
agentType={a.agent_type}
|
|
className="w-3 h-3"
|
|
/>
|
|
))}
|
|
</span>
|
|
</button>
|
|
</PopoverTrigger>
|
|
<PopoverContent side="top" align="start" className="w-64 p-3">
|
|
<div className="text-xs font-medium mb-2">
|
|
{t("summary", {
|
|
conversations: stats.total_conversations,
|
|
messages: stats.total_messages,
|
|
})}
|
|
</div>
|
|
<div className="space-y-1.5">
|
|
{activeAgents.map((a) => (
|
|
<div key={a.agent_type} className="flex items-center gap-2 text-xs">
|
|
<AgentIcon agentType={a.agent_type} className="w-3.5 h-3.5" />
|
|
<span className="text-muted-foreground">
|
|
{AGENT_LABELS[a.agent_type]}
|
|
</span>
|
|
<span className="ml-auto text-muted-foreground">
|
|
{a.conversation_count}
|
|
</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</PopoverContent>
|
|
</Popover>
|
|
)
|
|
}
|