refactor(surface): remove the main-area surface concept entirely

activeSurface was permanently 'chat' after the legacy mobile layout
removal, so the whole concept is gone: the store field, surfaceGuard,
setActiveSurface/setSurfaceGuard, the per-runtime surface memory in
prepare/restoreForRuntimeSwitch, and WorkspaceSurface itself. All ~30
setActiveSurface('chat') call sites were no-ops and are deleted;
always-true 'is the chat active' checks in keyboard shortcuts, Header
and ChatContainer are unconditional now. FilesView's dirty-file guard
kept its file-switch and close protection but drops the surface-switch
branch nothing could trigger. TerminalView visibility comes only from
its callers. The router keeps parsing legacy ?tab= links (they open the
matching context-panel surface) via its own RouteTab type and no longer
serializes a tab or diff file into URLs — desktop URLs never carried
them anyway.
This commit is contained in:
Bohdan Triapitsyn
2026-08-24 16:36:41 +03:00
parent c6e39f15fe
commit c82f188fc8
31 changed files with 49 additions and 276 deletions
+1 -11
View File
@@ -434,7 +434,6 @@ export const Header: React.FC = () => {
const openContextOverview = useUIStore((state) => state.openContextOverview);
const openContextPlan = useUIStore((state) => state.openContextPlan);
const closeContextPanel = useUIStore((state) => state.closeContextPanel);
const activeSurface = useUIStore((state) => state.activeSurface);
const shortcutOverrides = useUIStore((state) => state.shortcutOverrides);
const getCurrentModel = useConfigStore((state) => state.getCurrentModel);
@@ -612,7 +611,6 @@ export const Header: React.FC = () => {
}, [setWorkStatusOverlayOpen, setWorkStatusPanelEnabled, workStatusOverlayOpen, workStatusPanelEnabled, workStatusPanelFits]);
const showDesktopHeaderContextUsage = !isVSCode
&& !workStatusPanelVisible
&& activeSurface === 'chat'
&& !!stableDesktopContextUsage
&& stableDesktopContextUsage.totalTokens > 0;
const desktopHeaderDisplayPercentage = stableDesktopContextUsage && stableDesktopContextUsage.contextLimit > 0
@@ -1153,9 +1151,6 @@ export const Header: React.FC = () => {
// Reset plan tab availability when session changes
React.useEffect(() => {
if (!planModeEnabled) {
if (useUIStore.getState().activeSurface === 'plan') {
useUIStore.getState().setActiveSurface('chat');
}
return;
}
@@ -1165,11 +1160,6 @@ export const Header: React.FC = () => {
if (lastPlanSessionKeyRef.current !== sessionKey) {
lastPlanSessionKeyRef.current = sessionKey;
}
// If plan is not available but user is on plan tab, switch them back to chat
if (!planTabAvailable && useUIStore.getState().activeSurface === 'plan') {
useUIStore.getState().setActiveSurface('chat');
}
}, [
planModeEnabled,
planTabAvailable,
@@ -1759,7 +1749,7 @@ export const Header: React.FC = () => {
className={cn(desktopHeaderIconButtonClass, 'mr-1')}
Icon={'picture-in-picture-2'}
/>
{activeSurface === 'chat' && !isVSCode ? (
{!isVSCode ? (
<Tooltip>
<TooltipTrigger asChild>
<button