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

@@ -34,13 +34,21 @@ pub fn build_router(state: Arc<AppState>, token: String, static_dir: std::path::
post(handlers::conversations::get_conversation),
)
.route(
"/list_folder_conversations",
post(handlers::conversations::list_folder_conversations),
"/list_all_conversations",
post(handlers::conversations::list_all_conversations),
)
.route(
"/get_folder_conversation",
post(handlers::conversations::get_folder_conversation),
)
.route(
"/list_opened_tabs",
post(handlers::conversations::list_opened_tabs),
)
.route(
"/save_opened_tabs",
post(handlers::conversations::save_opened_tabs),
)
.route(
"/import_local_conversations",
post(handlers::conversations::import_local_conversations),
@@ -81,13 +89,22 @@ pub fn build_router(state: Arc<AppState>, token: String, static_dir: std::path::
post(handlers::folders::list_open_folders),
)
.route(
"/close_folder_window",
post(handlers::folders::close_folder_window),
"/list_open_folder_details",
post(handlers::folders::list_open_folder_details),
)
.route(
"/list_all_folder_details",
post(handlers::folders::list_all_folder_details),
)
.route("/get_folder", post(handlers::folders::get_folder))
.route("/open_folder", post(handlers::folders::open_folder))
.route(
"/open_folder_window",
post(handlers::folders::open_folder_window),
"/open_folder_by_id",
post(handlers::folders::open_folder_by_id),
)
.route(
"/remove_folder_from_workspace",
post(handlers::folders::remove_folder_from_workspace),
)
.route(
"/add_folder_to_history",
@@ -105,10 +122,6 @@ pub fn build_router(state: Arc<AppState>, token: String, static_dir: std::path::
"/create_folder_directory",
post(handlers::folders::create_folder_directory),
)
.route(
"/save_folder_opened_conversations",
post(handlers::folders::save_folder_opened_conversations),
)
.route("/get_git_branch", post(handlers::folders::get_git_branch))
.route(
"/get_home_directory",