refactor(workspace): migrate from per-folder windows to single-window workspace
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
This commit is contained in:
@@ -6,10 +6,11 @@ import { enUS, zhCN, zhTW } from "date-fns/locale"
|
||||
import { File, Folder } from "lucide-react"
|
||||
import { useLocale, useTranslations } from "next-intl"
|
||||
import { useAuxPanelContext } from "@/contexts/aux-panel-context"
|
||||
import { useFolderContext } from "@/contexts/folder-context"
|
||||
import { useActiveFolder } from "@/contexts/active-folder-context"
|
||||
import { useAppWorkspace } from "@/contexts/app-workspace-context"
|
||||
import { useTabContext } from "@/contexts/tab-context"
|
||||
import { useWorkspaceContext } from "@/contexts/workspace-context"
|
||||
import { listFolderConversations } from "@/lib/api"
|
||||
import { listAllConversations } from "@/lib/api"
|
||||
import type {
|
||||
AgentType,
|
||||
ConversationStatus,
|
||||
@@ -43,7 +44,16 @@ export function SearchCommandDialog({
|
||||
const locale = useLocale()
|
||||
const dateFnsLocale =
|
||||
locale === "zh-CN" ? zhCN : locale === "zh-TW" ? zhTW : enUS
|
||||
const { folderId, folder, conversations } = useFolderContext()
|
||||
const { activeFolder: folder, activeFolderId } = useActiveFolder()
|
||||
const { conversations: allConversations } = useAppWorkspace()
|
||||
const folderId = activeFolderId ?? 0
|
||||
const conversations = useMemo(
|
||||
() =>
|
||||
activeFolderId == null
|
||||
? []
|
||||
: allConversations.filter((c) => c.folder_id === activeFolderId),
|
||||
[allConversations, activeFolderId]
|
||||
)
|
||||
const { openTab } = useTabContext()
|
||||
const { openFilePreview } = useWorkspaceContext()
|
||||
const { revealInFileTree } = useAuxPanelContext()
|
||||
@@ -96,8 +106,8 @@ export function SearchCommandDialog({
|
||||
}
|
||||
setSearching(true)
|
||||
try {
|
||||
const data = await listFolderConversations({
|
||||
folder_id: folderId,
|
||||
const data = await listAllConversations({
|
||||
folder_ids: folderId > 0 ? [folderId] : null,
|
||||
search: q.trim() || null,
|
||||
agent_type: agent,
|
||||
})
|
||||
@@ -136,7 +146,7 @@ export function SearchCommandDialog({
|
||||
|
||||
const handleSelectConversation = useCallback(
|
||||
(conv: DbConversationSummary) => {
|
||||
openTab(conv.id, conv.agent_type, true)
|
||||
openTab(conv.folder_id, conv.id, conv.agent_type, true)
|
||||
onOpenChange(false)
|
||||
},
|
||||
[openTab, onOpenChange]
|
||||
|
||||
Reference in New Issue
Block a user