Skip to content

Commit cb69f95

Browse files
committed
fix(web): hide extension status entry
1 parent c976995 commit cb69f95

6 files changed

Lines changed: 49 additions & 44 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { describe, expect, it } from "vitest";
2+
import { sanitizeDesktopSidebarView } from "./layout";
3+
4+
describe("workspace layout atoms", () => {
5+
it("normalizes the hidden extensions sidebar view to explorer", () => {
6+
expect(sanitizeDesktopSidebarView("extensions")).toBe("explorer");
7+
});
8+
});

packages/web/src/features/workspace/atoms/layout.ts

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* workspace" while the underlying storage is keyed by workspace id.
77
*/
88

9-
import { atom, type Getter } from "jotai";
9+
import { atom, type Getter, type WritableAtom } from "jotai";
1010
import { atomWithStorage, createJSONStorage } from "jotai/utils";
11-
import { atomFamily } from "jotai-family";
11+
import { type AtomFamily, atomFamily } from "jotai-family";
1212
import type { SetStateAction } from "react";
1313
import { resolvedActiveWorkspaceIdAtom } from "../../../atoms/workspaces";
1414

@@ -17,8 +17,7 @@ export type DesktopSidebarView =
1717
| "search"
1818
| "source-control"
1919
| "agent-instructions"
20-
| "skills"
21-
| "extensions";
20+
| "skills";
2221

2322
export interface WorkspaceLayoutState {
2423
focusMode: boolean;
@@ -37,7 +36,6 @@ const DESKTOP_SIDEBAR_VIEW_VALUES = new Set<DesktopSidebarView>([
3736
"source-control",
3837
"agent-instructions",
3938
"skills",
40-
"extensions",
4139
]);
4240
const DEFAULT_WORKSPACE_LAYOUT_STATE: WorkspaceLayoutState = {
4341
focusMode: false,
@@ -144,7 +142,14 @@ function resolveNextValue<T>(current: T, update: SetStateAction<T>): T {
144142
return typeof update === "function" ? (update as (prevState: T) => T)(current) : update;
145143
}
146144

147-
function createWorkspaceLayoutFieldAtomFamily<Key extends keyof WorkspaceLayoutState>(field: Key) {
145+
type WorkspaceLayoutFieldAtomFamily<Key extends keyof WorkspaceLayoutState> = AtomFamily<
146+
string,
147+
WritableAtom<WorkspaceLayoutState[Key], [update: SetStateAction<WorkspaceLayoutState[Key]>], void>
148+
>;
149+
150+
function createWorkspaceLayoutFieldAtomFamily<Key extends keyof WorkspaceLayoutState>(
151+
field: Key
152+
): WorkspaceLayoutFieldAtomFamily<Key> {
148153
return atomFamily((workspaceId: string) =>
149154
atom(
150155
(get) => get(workspaceLayoutStateAtomFamily(workspaceId))[field],
@@ -165,8 +170,12 @@ function createWorkspaceLayoutFieldAtomFamily<Key extends keyof WorkspaceLayoutS
165170
}
166171

167172
function createActiveWorkspaceLayoutFieldAtom<Key extends keyof WorkspaceLayoutState>(
168-
family: ReturnType<typeof createWorkspaceLayoutFieldAtomFamily<Key>>
169-
) {
173+
family: WorkspaceLayoutFieldAtomFamily<Key>
174+
): WritableAtom<
175+
WorkspaceLayoutState[Key],
176+
[update: SetStateAction<WorkspaceLayoutState[Key]>],
177+
void
178+
> {
170179
return atom(
171180
(get) => get(family(resolveWorkspaceLayoutId(get))),
172181
(get, set, update: SetStateAction<WorkspaceLayoutState[Key]>) => {
@@ -196,17 +205,17 @@ export const desktopSidebarViewAtomFamily =
196205
export const terminalPanelVisibleAtomFamily =
197206
createWorkspaceLayoutFieldAtomFamily("terminalPanelVisible");
198207

199-
export const focusModeAtom = createActiveWorkspaceLayoutFieldAtom(focusModeAtomFamily);
200-
export const leftPanelWidthAtom = createActiveWorkspaceLayoutFieldAtom(leftPanelWidthAtomFamily);
201-
export const bottomPanelHeightAtom = createActiveWorkspaceLayoutFieldAtom(
208+
export const focusModeAtom = createActiveWorkspaceLayoutFieldAtom<"focusMode">(focusModeAtomFamily);
209+
export const leftPanelWidthAtom =
210+
createActiveWorkspaceLayoutFieldAtom<"leftPanelWidth">(leftPanelWidthAtomFamily);
211+
export const bottomPanelHeightAtom = createActiveWorkspaceLayoutFieldAtom<"bottomPanelHeight">(
202212
bottomPanelHeightAtomFamily
203213
);
204-
export const sidebarCollapsedAtom = createActiveWorkspaceLayoutFieldAtom(
214+
export const sidebarCollapsedAtom = createActiveWorkspaceLayoutFieldAtom<"sidebarCollapsed">(
205215
sidebarCollapsedAtomFamily
206216
);
207-
export const desktopSidebarViewAtom = createActiveWorkspaceLayoutFieldAtom(
217+
export const desktopSidebarViewAtom = createActiveWorkspaceLayoutFieldAtom<"desktopSidebarView">(
208218
desktopSidebarViewAtomFamily
209219
);
210-
export const terminalPanelVisibleAtom = createActiveWorkspaceLayoutFieldAtom(
211-
terminalPanelVisibleAtomFamily
212-
);
220+
export const terminalPanelVisibleAtom =
221+
createActiveWorkspaceLayoutFieldAtom<"terminalPanelVisible">(terminalPanelVisibleAtomFamily);

packages/web/src/features/workspace/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ describe("WorkspacePage", () => {
362362
expect(document.querySelector('[data-icon-semantic="nav.sourceControl"]')).toBeTruthy();
363363
expect(document.querySelector('[data-icon-semantic="nav.agent"]')).toBeTruthy();
364364
expect(document.querySelector('[data-icon-semantic="nav.skills"]')).toBeTruthy();
365-
expect(document.querySelector('[data-icon-semantic="nav.extensions"]')).toBeTruthy();
365+
expect(document.querySelector('[data-icon-semantic="nav.extensions"]')).toBeNull();
366366
expect(
367367
screen.getByRole("button", { name: /agent\.md|Agent Instructions|Agent /i })
368368
).toBeInTheDocument();

packages/web/src/features/workspace/views/desktop/workspace-desktop-view.test.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { afterEach, describe, expect, it, vi } from "vitest";
77
import { connectionStatusAtom, wsClientAtom } from "../../../../atoms/connection";
88
import { activeWorkspaceIdAtom } from "../../../../atoms/workspaces";
99
import { seedReadyWorkspaceState } from "../../../../test-utils/workspace-state";
10-
import { desktopSidebarViewAtomFamily } from "../../atoms/layout";
10+
import { type DesktopSidebarView, desktopSidebarViewAtomFamily } from "../../atoms/layout";
1111
import { WorkspaceDesktopView } from "./workspace-desktop-view";
1212

1313
vi.mock("../../../../lib/i18n", () => ({
@@ -123,9 +123,7 @@ vi.mock("../shared/workspace-extension-state-panel", () => ({
123123
),
124124
}));
125125

126-
function renderDesktopView(
127-
activeView: "explorer" | "search" | "source-control" | "agent-instructions" | "extensions"
128-
) {
126+
function renderDesktopView(activeView: DesktopSidebarView) {
129127
const store = createStore();
130128
store.set(connectionStatusAtom, "connected");
131129
store.set(wsClientAtom, {
@@ -226,12 +224,20 @@ describe("WorkspaceDesktopView", () => {
226224
expect(screen.getByTestId("workspace-bottom-panel")).toHaveTextContent("Terminal Tasks");
227225
});
228226

229-
it("opens the extension-state sidebar panel from the activity bar", () => {
227+
it("hides the extension-state activity bar entry", () => {
230228
renderDesktopView("explorer");
231229

232-
fireEvent.click(screen.getByRole("button", { name: "Extensions" }));
230+
expect(screen.queryByRole("button", { name: "Extensions" })).toBeNull();
231+
expect(screen.queryByRole("heading", { level: 2, name: "Extensions" })).toBeNull();
232+
expect(screen.queryByText("No extension state")).toBeNull();
233+
});
234+
235+
it("does not open the extension-state panel from the desktop numeric shortcuts", () => {
236+
renderDesktopView("explorer");
237+
238+
fireEvent.keyDown(window, { key: "6", ctrlKey: true });
233239

234-
expect(screen.getByRole("heading", { level: 2, name: "Extensions" })).toBeInTheDocument();
235-
expect(screen.getByText("No extension state")).toBeInTheDocument();
240+
expect(screen.queryByRole("heading", { level: 2, name: "Extensions" })).toBeNull();
241+
expect(screen.queryByText("No extension state")).toBeNull();
236242
});
237243
});

packages/web/src/features/workspace/views/desktop/workspace-desktop-view.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { SearchPanel } from "../shared/search-panel";
1919
import { SkillsPanel } from "../shared/skills-panel";
2020
import { WorkspaceActivityBar } from "../shared/workspace-activity-bar";
2121
import { WorkspaceBottomPanel } from "../shared/workspace-bottom-panel";
22-
import { WorkspaceExtensionStatePanel } from "../shared/workspace-extension-state-panel";
2322
import { WorkspaceStatusBar } from "../shared/workspace-status-bar";
2423

2524
function isEditableTarget(target: EventTarget | null): boolean {
@@ -111,11 +110,6 @@ const WorkspaceDesktopScene: FC = () => {
111110
setDesktopSidebarView("skills");
112111
return;
113112
}
114-
115-
if (event.key === "6") {
116-
event.preventDefault();
117-
setDesktopSidebarView("extensions");
118-
}
119113
};
120114

121115
window.addEventListener("keydown", handleKeyDown);
@@ -184,10 +178,6 @@ const WorkspaceDesktopScene: FC = () => {
184178
{activeSidebarView === "skills" ? (
185179
<SkillsPanel workspaceId={workspace.id} refreshToken={panelRefreshToken} />
186180
) : null}
187-
188-
{activeSidebarView === "extensions" ? (
189-
<WorkspaceExtensionStatePanel workspaceId={workspace.id} />
190-
) : null}
191181
</div>
192182
</div>
193183
</aside>
@@ -204,10 +194,7 @@ const WorkspaceDesktopScene: FC = () => {
204194

205195
<div className="workspace-main-area">
206196
<div className="workspace-main-stage">
207-
<div
208-
className="agent-panes"
209-
aria-hidden={mainAreaMode === "editor" ? true : undefined}
210-
>
197+
<div className="agent-panes" aria-hidden={mainAreaMode === "editor" ? true : undefined}>
211198
<AgentPanes hydrateSessions={false} />
212199
</div>
213200
{mainAreaMode === "editor" ? (

packages/web/src/features/workspace/views/shared/workspace-activity-bar.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ export const WorkspaceActivityBar: FC<WorkspaceActivityBarProps> = ({
3232
icon: "nav.agent",
3333
},
3434
{ view: "skills", label: t("workspace.sidebar.skills"), icon: "nav.skills" },
35-
{
36-
view: "extensions",
37-
label: t("workspace.sidebar.extensions"),
38-
icon: "nav.extensions",
39-
},
4035
];
4136

4237
return (

0 commit comments

Comments
 (0)