Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions packages/web-shell/client/components/ChatPane.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
overflow: hidden;
}

.paneCurrent {
border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
}

.header {
display: flex;
align-items: center;
Expand Down Expand Up @@ -52,16 +48,6 @@
color: var(--foreground);
}

.currentBadge {
flex: 0 0 auto;
padding: 1px 7px;
border-radius: 999px;
font-size: 11px;
font-weight: 600;
color: var(--primary);
background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.closeButton {
flex: 0 0 auto;
display: inline-flex;
Expand Down
17 changes: 5 additions & 12 deletions packages/web-shell/client/components/ChatPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ const EMPTY_TOOLBAR: never[] = [];
export interface ChatPaneProps {
/** Header label; falls back to the session's own display name / id. */
title?: string;
/** Marks the pane bound to the window's primary (sidebar-selected) session. */
isCurrent?: boolean;
onClose?: () => void;
onError?: (error: unknown, fallback: string) => void;
}
Expand All @@ -43,7 +41,7 @@ export interface ChatPaneProps {
* state, approvals, and composer, and the browser scopes keyboard focus to the
* pane the user clicks into — so there is no cross-pane approval arbitration.
*/
export function ChatPane({ title, isCurrent, onClose, onError }: ChatPaneProps) {
export function ChatPane({ title, onClose, onError }: ChatPaneProps) {
const { t } = useI18n();
const connection = useConnection();
const actions = useActions();
Expand Down Expand Up @@ -119,29 +117,24 @@ export function ChatPane({ title, isCurrent, onClose, onError }: ChatPaneProps)
const handleCancel = useCallback(() => {
actions
.cancel()
.catch((error: unknown) => reportError(error, 'Failed to cancel request'));
.catch((error: unknown) =>
reportError(error, 'Failed to cancel request'),
);
}, [actions, reportError]);

const headerLabel =
title || connection.displayName || connection.sessionId?.slice(0, 8) || '';

return (
<section
className={[styles.pane, isCurrent ? styles.paneCurrent : '']
.filter(Boolean)
.join(' ')}
className={styles.pane}
data-testid="chat-pane"
aria-label={headerLabel}
>
<header className={styles.header}>
<span className={styles.title} title={headerLabel}>
{headerLabel}
</span>
{isCurrent && (
<span className={styles.currentBadge}>
{t('sessionsOverview.current')}
</span>
)}
{onClose && (
<button
type="button"
Expand Down
23 changes: 9 additions & 14 deletions packages/web-shell/client/components/SplitView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ vi.mock('./ChatPane', () => ({
// Let a test force a render crash to exercise the per-pane ErrorBoundary.
if (props.title === 'BOOM') throw new Error('pane exploded');
return (
<div data-testid="chat-pane" data-current={props.isCurrent ? 'yes' : 'no'}>
<div data-testid="chat-pane">
<span data-testid="pane-title">{props.title}</span>
{props.onClose && (
<button data-testid="pane-close" onClick={props.onClose}>
Expand Down Expand Up @@ -102,14 +102,14 @@ function panes(): HTMLElement[] {
return Array.from(container!.querySelectorAll('[data-testid="chat-pane"]'));
}
function titles(): string[] {
return Array.from(container!.querySelectorAll('[data-testid="pane-title"]')).map(
(el) => el.textContent ?? '',
);
return Array.from(
container!.querySelectorAll('[data-testid="pane-title"]'),
).map((el) => el.textContent ?? '');
}
function pickerOptions(): string[] {
return Array.from(
container!.querySelectorAll('[role="option"] button'),
).map((el) => (el.textContent ?? '').trim());
return Array.from(container!.querySelectorAll('[role="option"] button')).map(
(el) => (el.textContent ?? '').trim(),
);
}
function openPicker(): void {
const addButton = container!.querySelector(
Expand Down Expand Up @@ -140,7 +140,6 @@ describe('SplitView', () => {
it('seeds with the current session when no initial sessions are given', () => {
render({ initialSessionIds: [] });
expect(titles()).toEqual(['Three']);
expect(panes()[0].getAttribute('data-current')).toBe('yes');
});

it('dedupes initial sessions', () => {
Expand Down Expand Up @@ -235,9 +234,7 @@ describe('SplitView', () => {
render({ initialSessionIds: ['s1'], onExit });
expect(onExit).not.toHaveBeenCalled();
const close = container!.querySelector('[data-testid="pane-close"]');
act(() =>
close!.dispatchEvent(new MouseEvent('click', { bubbles: true })),
);
act(() => close!.dispatchEvent(new MouseEvent('click', { bubbles: true })));
expect(onExit).toHaveBeenCalledTimes(1);
});

Expand Down Expand Up @@ -344,9 +341,7 @@ describe('SplitView', () => {
expect(onPanesChange).toHaveBeenLastCalledWith(['s1', 's2']);
// …and after every remove.
const close = container!.querySelector('[data-testid="pane-close"]');
act(() =>
close!.dispatchEvent(new MouseEvent('click', { bubbles: true })),
);
act(() => close!.dispatchEvent(new MouseEvent('click', { bubbles: true })));
expect(onPanesChange).toHaveBeenLastCalledWith(['s2']);
});
});
6 changes: 2 additions & 4 deletions packages/web-shell/client/components/SplitView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ export function SplitView({
const connection = useConnection();
const currentSessionId = connection.sessionId;
const organizationEnabled =
connection.capabilities?.features?.includes(
SESSION_ORGANIZATION_FEATURE,
) ?? false;
connection.capabilities?.features?.includes(SESSION_ORGANIZATION_FEATURE) ??
false;
const { sessions, reload } = useSessions({
autoLoad: true,
pageSize: SESSION_LIST_PAGE_SIZE,
Expand Down Expand Up @@ -282,7 +281,6 @@ export function SplitView({
>
<ChatPane
title={titleById.get(sessionId)}
isCurrent={sessionId === currentSessionId}
onClose={() => removePane(sessionId)}
onError={onError}
/>
Expand Down
Loading