Skip to content

Commit 2a7889c

Browse files
[cherry-pick] fix styling of session header and chat content (microsoft#320457)
Co-authored-by: vs-code-engineering[bot] <vs-code-engineering[bot]@users.noreply.github.com>
1 parent b405704 commit 2a7889c

6 files changed

Lines changed: 26 additions & 23 deletions

File tree

‎src/vs/sessions/browser/media/style.css‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -502,19 +502,12 @@
502502
* surfaces that reuse `.interactive-item-container` — notably the terminal
503503
* and editor inline chat widgets and the agent-session hover widget. */
504504
.agent-sessions-workbench .part.sessionspart .interactive-session .interactive-item-container,
505-
.agent-sessions-workbench .chat-editor-relative .interactive-session .interactive-item-container {
506-
max-width: 950px;
507-
margin: 0 auto;
508-
padding-left: 12px;
509-
padding-right: 12px;
510-
box-sizing: border-box;
511-
}
512-
505+
.agent-sessions-workbench .chat-editor-relative .interactive-session .interactive-item-container,
513506
.agent-sessions-workbench .part.sessionspart .interactive-session > .chat-suggest-next-widget,
514507
.agent-sessions-workbench .chat-editor-relative .interactive-session > .chat-suggest-next-widget {
515508
max-width: 950px;
516509
margin: 0 auto;
517-
padding-left: 12px;
510+
padding-left: 32px;
518511
padding-right: 12px;
519512
box-sizing: border-box;
520513
}
@@ -579,8 +572,7 @@
579572
max-width: 950px;
580573
margin: 0 auto;
581574
display: inherit;
582-
/* Align with panel (terminal) card margin */
583-
padding: 4px 10px;
575+
padding: 4px 10px 4px 32px;
584576
box-sizing: border-box;
585577
}
586578

‎src/vs/sessions/browser/parts/media/chatCompositeBar.css‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,13 @@
1515
/* Header host: title row + meta row, with the top padding for the whole bar area */
1616
.chat-composite-bar.session-header-bar {
1717
padding: 6px 10px 0;
18-
max-width: 990px;
19-
margin: 0 auto;
2018
box-sizing: border-box;
2119
}
2220

2321
/* Tabs host: the chat tab strip, shown only when the session has multiple chats.
24-
Mirrors the header's max-width and centering so the tabs line up horizontally
25-
with the session header above them. */
22+
It lives in the same centered session-view content host as the header. */
2623
.chat-composite-bar.session-chat-tabs-bar {
2724
padding: 0 10px;
28-
max-width: 990px;
29-
margin: 0 auto;
3025
box-sizing: border-box;
3126
container-type: inline-size;
3227
}

‎src/vs/sessions/browser/parts/media/sessionView.css‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
* across the multi-session grid so attention stays on the active session.
1313
* ------------------------------------------------------------------------- */
1414

15+
/* Session header, tabs, and chat content are all hosted in this centered
16+
* inner container so alignment is controlled in one place. */
17+
.session-view .session-view-centered-content {
18+
height: 100%;
19+
margin: 0 auto;
20+
box-sizing: border-box;
21+
}
22+
1523
/* Transitions apply to both active and inactive states so controls fade
1624
* smoothly in either direction. Only declared when the user has not requested
1725
* reduced motion so we never need to unset them. */

‎src/vs/sessions/browser/parts/media/sessionsPart.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616

1717
.monaco-workbench .part.sessionspart .session-view,
18-
.monaco-workbench .part.sessionspart .session-view > .session-view-content {
18+
.monaco-workbench .part.sessionspart .session-view .session-view-content {
1919
background-color: var(--session-view-background);
2020
color: var(--session-view-foreground);
2121
position: relative;

‎src/vs/sessions/browser/parts/sessionView.ts‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { SessionStatus } from '../../services/sessions/common/session.js';
3535
export class SessionView extends Disposable implements ISerializableView {
3636

3737
static readonly TYPE = 'sessions.sessionView';
38+
private static readonly CENTERED_CONTENT_MAX_WIDTH = 950;
3839
private static readonly ACTIVE_BACKGROUND = asCssVariable(activeSessionViewBackground);
3940
private static readonly ACTIVE_FOREGROUND = asCssVariable(activeSessionViewForeground);
4041
private static readonly INACTIVE_BACKGROUND = asCssVariable(inactiveSessionViewBackground);
@@ -53,6 +54,7 @@ export class SessionView extends Disposable implements ISerializableView {
5354
private readonly _header: SessionHeader;
5455
private readonly _compositeBar: ChatCompositeBar;
5556
private readonly _floatingToolbar: SessionViewFloatingToolbar;
57+
private readonly _centeredContentContainer: HTMLElement;
5658
private readonly _contentContainer: HTMLElement;
5759

5860
private readonly _currentView = this._register(new MutableDisposable<AbstractChatView>());
@@ -95,14 +97,17 @@ export class SessionView extends Disposable implements ISerializableView {
9597

9698
const scopedInstantiationService = this._register(instantiationService.createChild(new ServiceCollection([IContextKeyService, scopedContextKeyService])));
9799

100+
this._centeredContentContainer = $('.session-view-centered-content');
101+
this.element.appendChild(this._centeredContentContainer);
102+
98103
this._header = this._register(scopedInstantiationService.createInstance(SessionHeader));
99-
this.element.appendChild(this._header.element);
104+
this._centeredContentContainer.appendChild(this._header.element);
100105

101106
this._compositeBar = this._register(scopedInstantiationService.createInstance(ChatCompositeBar));
102-
this.element.appendChild(this._compositeBar.element);
107+
this._centeredContentContainer.appendChild(this._compositeBar.element);
103108

104109
this._contentContainer = $('.session-view-content');
105-
this.element.appendChild(this._contentContainer);
110+
this._centeredContentContainer.appendChild(this._contentContainer);
106111

107112
this._floatingToolbar = this._register(scopedInstantiationService.createInstance(SessionViewFloatingToolbar));
108113
this.element.appendChild(this._floatingToolbar.element);
@@ -205,10 +210,13 @@ export class SessionView extends Disposable implements ISerializableView {
205210
return;
206211
}
207212
const { width, height, top, left } = this._lastLayout;
213+
const centeredWidth = Math.min(width, SessionView.CENTERED_CONTENT_MAX_WIDTH);
214+
const centeredLeft = left + (width - centeredWidth) / 2;
215+
size(this._centeredContentContainer, centeredWidth, height);
208216
const headerHeight = this._header.visible ? this._header.height : 0;
209217
const tabsHeight = this._compositeBar.visible ? this._compositeBar.height : 0;
210218
const barHeight = headerHeight + tabsHeight;
211-
this._currentView.value?.layout(width, height - barHeight, top + barHeight, left);
219+
this._currentView.value?.layout(centeredWidth, height - barHeight, top + barHeight, centeredLeft);
212220
}
213221

214222
toJSON(): object {

‎src/vs/sessions/contrib/aquarium/browser/media/aquarium.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* `--session-view-background` on top of the water layer and hide everything.
2626
* Clear those backgrounds so the fish are visible behind the chat content. */
2727
.monaco-workbench .part.sessionspart.aquarium-active .session-view,
28-
.monaco-workbench .part.sessionspart.aquarium-active .session-view > .session-view-content {
28+
.monaco-workbench .part.sessionspart.aquarium-active .session-view .session-view-content {
2929
background-color: transparent;
3030
}
3131

0 commit comments

Comments
 (0)