Map thread panel into title bar and sidebar

- Add thread-panel presentation logic for inline vs popover layouts
- Move thread details controls into the chat header/sidebar flow
- Add shared wait-for-atom helper and workspace display name parsing

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex committed 2026-08-15 16:49:46 +02:00
1 parent 4d64e80184
commit c8aea5db0b
40 files changed
+1926 -869

No files matched your search

+67 -26
View File
@@ -8,6 +8,8 @@ import {
selectActiveRightPanel,
selectActiveRightPanelSurface,
selectSelectedRightPanelSurface,
selectThreadPanelOpen,
selectThreadPanelVisibility,
selectThreadRightPanelState,
updatePullRequestTabStatus,
useRightPanelStore,
@@ -17,7 +19,7 @@ const refA = scopeThreadRef("env-1" as EnvironmentId, ThreadId.make("thread-A"))
const refB = scopeThreadRef("env-1" as EnvironmentId, ThreadId.make("thread-B"));
beforeEach(() => {
useRightPanelStore.setState({ byThreadKey: {} });
useRightPanelStore.setState({ byThreadKey: {}, threadPanelVisibilityByThreadKey: {} });
});
describe("rightPanelStore", () => {
@@ -42,6 +44,7 @@ describe("rightPanelStore", () => {
surfaces: [{ id: "browser:tab-a", kind: "preview", resourceId: "tab-a" }],
},
},
threadPanelVisibilityByThreadKey: {},
});
});
@@ -72,6 +75,7 @@ describe("rightPanelStore", () => {
],
},
},
threadPanelVisibilityByThreadKey: {},
});
});
@@ -102,6 +106,7 @@ describe("rightPanelStore", () => {
],
},
},
threadPanelVisibilityByThreadKey: {},
});
});
@@ -178,40 +183,76 @@ describe("rightPanelStore", () => {
});
it("drops persisted plan surfaces and does not reopen an empty panel", () => {
it("persists inline preference without restoring an open popover", () => {
expect(
migratePersistedRightPanelState({
byThreadKey: {
"env-1:thread-A": {
isOpen: true,
activeSurfaceId: "plan",
surfaces: [{ id: "plan", kind: "plan" }],
},
"env-1:thread-B": {
isOpen: true,
activeSurfaceId: "plan",
surfaces: [
{ id: "plan", kind: "plan" },
{ id: "diff", kind: "diff" },
],
},
threadPanelVisibilityByThreadKey: {
"env-1:thread-A": { inlineOpen: false, popoverOpen: true },
"env-1:thread-B": { inlineOpen: true, popoverOpen: true },
},
}),
).toEqual({
byThreadKey: {
"env-1:thread-A": {
isOpen: false,
activeSurfaceId: null,
surfaces: [],
},
"env-1:thread-B": {
isOpen: true,
activeSurfaceId: "diff",
surfaces: [{ id: "diff", kind: "diff" }],
},
byThreadKey: {},
threadPanelVisibilityByThreadKey: {
"env-1:thread-A": { inlineOpen: false, popoverOpen: false },
},
});
});
it("tracks inline and popover visibility independently", () => {
const store = useRightPanelStore.getState();
expect(selectThreadPanelOpen(store.threadPanelVisibilityByThreadKey, refA, "inline")).toBe(
true,
);
expect(selectThreadPanelOpen(store.threadPanelVisibilityByThreadKey, refA, "popover")).toBe(
false,
);
store.setThreadPanelOpen(refA, "inline", false);
store.toggleThreadPanel(refA, "popover");
expect(
selectThreadPanelVisibility(
useRightPanelStore.getState().threadPanelVisibilityByThreadKey,
refA,
),
).toEqual({ inlineOpen: false, popoverOpen: true });
expect(
selectThreadPanelVisibility(
useRightPanelStore.getState().threadPanelVisibilityByThreadKey,
refB,
),
).toEqual({ inlineOpen: true, popoverOpen: false });
});
it("closes the popover atomically when the real right panel opens", () => {
useRightPanelStore.getState().setThreadPanelOpen(refA, "popover", true);
useRightPanelStore.getState().open(refA, "plan");
expect(
selectThreadPanelVisibility(
useRightPanelStore.getState().threadPanelVisibilityByThreadKey,
refA,
),
).toEqual({ inlineOpen: true, popoverOpen: false });
});
it("keeps an open popover visible by promoting it to inline when the real panel closes", () => {
const store = useRightPanelStore.getState();
store.open(refA, "plan");
store.setThreadPanelOpen(refA, "inline", false);
store.setThreadPanelOpen(refA, "popover", true);
store.close(refA);
expect(
selectThreadPanelVisibility(
useRightPanelStore.getState().threadPanelVisibilityByThreadKey,
refA,
),
).toEqual({ inlineOpen: true, popoverOpen: true });
});
it("open sets the active panel for a thread", () => {
useRightPanelStore.getState().open(refA, "preview");
expect(selectActiveRightPanel(useRightPanelStore.getState().byThreadKey, refA)).toBe("preview");