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:
xintaofei
2026-04-20 21:22:36 +08:00
parent 10801bf393
commit d9323d7399
89 changed files with 3701 additions and 2743 deletions

View File

@@ -20,10 +20,14 @@ interface TabItemProps {
tab: TabItemData
isActive: boolean
isTileMode: boolean
folderName: string | null
folderBranch: string | null
onSwitch: (tabId: string) => void
onClose: (tabId: string) => void
onCloseOthers: (tabId: string) => void
onCloseAll: () => void
onCloseFolderTabs: (folderId: number) => void
onRevealInSidebar: (folderId: number) => void
onPin: (tabId: string) => void
onToggleTile: () => void
}
@@ -32,10 +36,14 @@ export const TabItem = memo(function TabItem({
tab,
isActive,
isTileMode,
folderName,
folderBranch,
onSwitch,
onClose,
onCloseOthers,
onCloseAll,
onCloseFolderTabs,
onRevealInSidebar,
onPin,
onToggleTile,
}: TabItemProps) {
@@ -43,6 +51,19 @@ export const TabItem = memo(function TabItem({
const isDragging = useRef(false)
const itemRef = useRef<HTMLDivElement>(null)
const resolvedFolderName = folderName ?? String(tab.folderId)
const tooltip = folderBranch
? `${resolvedFolderName} · ${folderBranch}${tab.title}`
: `${resolvedFolderName}${tab.title}`
const handleCloseFolderTabs = useCallback(() => {
onCloseFolderTabs(tab.folderId)
}, [onCloseFolderTabs, tab.folderId])
const handleRevealInSidebar = useCallback(() => {
onRevealInSidebar(tab.folderId)
}, [onRevealInSidebar, tab.folderId])
const clearResidualStyles = useCallback(() => {
const el = itemRef.current
if (!el) return
@@ -119,7 +140,7 @@ export const TabItem = memo(function TabItem({
"truncate max-w-[140px]",
!tab.isPinned && "[font-style:oblique]"
)}
title={tab.title}
title={tooltip}
>
{tab.title}
</span>
@@ -146,7 +167,13 @@ export const TabItem = memo(function TabItem({
<ContextMenuItem onSelect={handleCloseOthers}>
{t("closeOthers")}
</ContextMenuItem>
<ContextMenuItem onSelect={handleCloseFolderTabs}>
{t("closeFolderTabs", { folder: resolvedFolderName })}
</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem onSelect={handleRevealInSidebar}>
{t("revealInSidebar")}
</ContextMenuItem>
<ContextMenuItem onSelect={onToggleTile}>
{isTileMode ? t("untileDisplay") : t("tileDisplay")}
</ContextMenuItem>