feat: projects → workspaces → tabs

This commit is contained in:
Mohamed Boudra
2026-03-01 18:22:11 +07:00
parent 2e201cab09
commit 080fb74642
43 changed files with 4054 additions and 2654 deletions
@@ -9,7 +9,25 @@ describe("keyboard-shortcut-routing", () => {
it("allows the shortcut on selected-agent routes", () => {
const canToggle = canToggleFileExplorerShortcut({
selectedAgentId: "server-1:agent-1",
pathname: "/h/server-1/agent/agent-1",
pathname: "/h/server-1/workspace/workspace-1/agent/agent-1",
toggleFileExplorer,
});
expect(canToggle).toBe(true);
});
it("allows the shortcut on workspace routes", () => {
const canToggle = canToggleFileExplorerShortcut({
pathname: "/h/server-1/workspace/workspace-1",
toggleFileExplorer,
});
expect(canToggle).toBe(true);
});
it("allows the shortcut on workspace terminal routes", () => {
const canToggle = canToggleFileExplorerShortcut({
pathname: "/h/server-1/workspace/workspace-1/terminal/terminal-1",
toggleFileExplorer,
});
@@ -18,7 +36,7 @@ describe("keyboard-shortcut-routing", () => {
it("allows the shortcut on draft routes", () => {
const canToggle = canToggleFileExplorerShortcut({
pathname: "/h/server-1/agent",
pathname: "/h/server-1/new",
toggleFileExplorer,
});
@@ -27,7 +45,7 @@ describe("keyboard-shortcut-routing", () => {
it("blocks the shortcut when no toggle handler exists", () => {
const canToggle = canToggleFileExplorerShortcut({
pathname: "/h/server-1/agent",
pathname: "/h/server-1/new",
});
expect(canToggle).toBe(false);
@@ -1,6 +1,8 @@
import {
parseHostAgentDraftRouteFromPathname,
parseHostAgentRouteFromPathname,
parseHostWorkspaceAgentRouteFromPathname,
parseHostWorkspaceRouteFromPathname,
} from "@/utils/host-routes";
const DRAFT_AGENT_ID = "__new_agent__";
@@ -12,7 +14,9 @@ export function resolveSelectedOrRouteAgentKey(input: {
if (input.selectedAgentId) {
return input.selectedAgentId;
}
const route = parseHostAgentRouteFromPathname(input.pathname);
const route =
parseHostWorkspaceAgentRouteFromPathname(input.pathname) ??
parseHostAgentRouteFromPathname(input.pathname);
if (!route) {
const draftRoute = parseHostAgentDraftRouteFromPathname(input.pathname);
if (!draftRoute) {
@@ -31,10 +35,17 @@ export function canToggleFileExplorerShortcut(input: {
if (!input.toggleFileExplorer) {
return false;
}
return (
resolveSelectedOrRouteAgentKey({
selectedAgentId: input.selectedAgentId,
pathname: input.pathname,
}) !== null
);
if (parseHostWorkspaceRouteFromPathname(input.pathname)) {
return true;
}
if (parseHostAgentRouteFromPathname(input.pathname)) {
return true;
}
if (parseHostAgentDraftRouteFromPathname(input.pathname)) {
return true;
}
return false;
}