fix: settings pane close affordance + sidebar toggle
The v1.9 settings pane had no way to dismiss once opened. ChatTabBar (which owns the per-pane close X for chat panes) is skipped for settings panes, and the pane header itself only rendered the maximize toggle (desktop-only). Mobile users had zero controls beyond the section tabs. Add three close paths: - X button in SettingsPane header, visible on mobile + desktop, sits next to the maximize toggle. Tap-target sized per the v1.6 mobile convention (max-md:min-h-[44px]). - Esc when the settings pane is the active pane and no input/textarea/ dialog has focus. Maximize-restore still wins when maximized. - Sidebar Settings button is now a strict toggle: opens on first click, closes on second. Renamed openOrFocusSettingsPane → toggleSettingsPane in the panes hook. Edge case: removing the settings pane when it's the only pane left falls back to an empty pane to preserve the "always one pane" invariant. In normal flow this is unreachable (the toggle only appends), but defensive against future entry points. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Archive, Maximize2, Minimize2 } from 'lucide-react';
|
||||
import { Archive, Maximize2, Minimize2, X } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { api } from '@/api/client';
|
||||
import type { Project, Session } from '@/api/types';
|
||||
@@ -24,6 +24,7 @@ interface Props {
|
||||
project: Project;
|
||||
maximized: boolean;
|
||||
onToggleMaximize: () => void;
|
||||
onClose: () => void;
|
||||
isMobile: boolean;
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ function Switch({
|
||||
);
|
||||
}
|
||||
|
||||
export function SettingsPane({ session, project, maximized, onToggleMaximize, isMobile }: Props) {
|
||||
export function SettingsPane({ session, project, maximized, onToggleMaximize, onClose, isMobile }: Props) {
|
||||
const [activeSection, setActiveSection] = useState<Section>('session');
|
||||
|
||||
return (
|
||||
@@ -99,6 +100,15 @@ export function SettingsPane({ session, project, maximized, onToggleMaximize, is
|
||||
{maximized ? <Minimize2 size={14} /> : <Maximize2 size={14} />}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="inline-flex items-center justify-center p-1 rounded text-muted-foreground hover:bg-muted hover:text-foreground max-md:min-h-[44px] max-md:min-w-[44px]"
|
||||
aria-label="Close settings"
|
||||
title="Close (Esc)"
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
|
||||
Reference in New Issue
Block a user