Fix composer context strip alignment and glass shell (#4404)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-07-23 18:32:14 -04:00
1 parent 193e3c62e6
commit 6ef7aa8399
4 files changed
+217 -132

No files matched your search

+1 -1
View File
@@ -248,7 +248,7 @@ export const BranchToolbar = memo(function BranchToolbar({
if (!hasActiveThread || !activeProject) return null;
return (
<div className="chat-composer-context-strip -mt-4 mx-auto flex w-[calc(100%-1.5rem)] max-w-[calc(48rem-1.5rem)] items-center gap-2 pt-5 pb-1 ps-1">
<div className="chat-composer-context-strip -mt-4 mx-auto flex w-[calc(100%-2.75rem)] max-w-[calc(48rem-2.75rem)] items-center gap-2 px-1 pt-5 pb-1">
{isMobile ? (
<MobileRunContextSelector
envLocked={envLocked}
@@ -731,7 +731,7 @@ export function BranchToolbarBranchSelector({
>
<ComboboxTrigger
render={<Button variant="ghost" size="xs" />}
className="min-w-0 text-muted-foreground/70 hover:text-foreground/80"
className="min-w-0 max-w-full text-muted-foreground/70 hover:text-foreground/80"
disabled={isInitialBranchesLoadPending || isBranchActionPending}
>
<GitBranchIcon className="size-3 shrink-0 opacity-70" />
+122 -112
View File
@@ -2352,6 +2352,7 @@ function ChatViewContent(props: ChatViewProps) {
terminalUiLaunchContext?.threadId === activeThreadId ? terminalUiLaunchContext : null;
// Default true while loading to avoid toolbar flicker.
const isGitRepo = gitStatusQuery.data?.isRepo ?? true;
const showComposerContextStrip = isGitRepo && activeProject !== null;
const initialDiffPanelGitScope =
gitStatusQuery.data?.hasWorkingTreeChanges === true ? "unstaged" : "branch";
const diffPanelGitStatusResolutionKey = gitStatusQuery.data ? "resolved" : "pending";
@@ -5592,119 +5593,128 @@ function ChatViewContent(props: ChatViewProps) {
: undefined
}
>
<div className="chat-composer-glass-host relative z-10 mx-auto w-full max-w-3xl rounded-[22px]">
<div ref={attachDraftHeroComposerAnchorRef} className="relative z-10">
<ChatComposer
composerRef={composerRef}
composerDraftTarget={composerDraftTarget}
environmentId={environmentId}
routeKind={routeKind}
routeThreadRef={routeThreadRef}
draftId={draftId}
activeThreadId={activeThreadId}
activeThreadEnvironmentId={activeThread?.environmentId}
activeThread={activeThread}
isServerThread={isServerThread}
isLocalDraftThread={isLocalDraftThread}
forceExpandedOnMobile={forceExpandedMobileComposer && isDraftHeroState}
projectSelectionRequired={isLocalDraftThread && activeProject === null}
phase={phase}
isConnecting={isConnecting}
isSendBusy={isSendBusy}
isPreparingWorktree={isPreparingWorktree}
environmentUnavailable={activeEnvironmentUnavailableState}
activePendingApproval={activePendingApproval}
pendingApprovals={pendingApprovals}
pendingUserInputs={pendingUserInputs}
activePendingProgress={activePendingProgress}
activePendingResolvedAnswers={activePendingResolvedAnswers}
activePendingIsResponding={activePendingIsResponding}
activePendingDraftAnswers={activePendingDraftAnswers}
activePendingQuestionIndex={activePendingQuestionIndex}
respondingRequestIds={respondingRequestIds}
showPlanFollowUpPrompt={showPlanFollowUpPrompt}
activeProposedPlan={activeProposedPlan}
activePlan={activePlan as { turnId?: TurnId } | null}
sidebarProposedPlan={sidebarProposedPlan as { turnId?: TurnId } | null}
planSidebarLabel={planSidebarLabel}
planSidebarOpen={planSidebarOpen}
runtimeMode={runtimeMode}
interactionMode={interactionMode}
lockedProvider={lockedProvider}
providerStatuses={providerStatuses as ServerProvider[]}
activeProjectDefaultModelSelection={activeProject?.defaultModelSelection}
activeThreadModelSelection={activeThread?.modelSelection}
activeThreadActivities={activeThread?.activities}
resolvedTheme={resolvedTheme}
settings={settings}
keybindings={keybindings}
terminalOpen={Boolean(terminalUiState.terminalOpen)}
gitCwd={gitCwd}
promptRef={promptRef}
composerImagesRef={composerImagesRef}
composerTerminalContextsRef={composerTerminalContextsRef}
composerElementContextsRef={composerElementContextsRef}
onSend={onSend}
onInterrupt={onInterrupt}
onImplementPlanInNewThread={onImplementPlanInNewThread}
onRespondToApproval={onRespondToApproval}
onSelectActivePendingUserInputOption={
onSelectActivePendingUserInputOption
}
onAdvanceActivePendingUserInput={onAdvanceActivePendingUserInput}
onPreviousActivePendingUserInputQuestion={
onPreviousActivePendingUserInputQuestion
}
onChangeActivePendingUserInputCustomAnswer={
onChangeActivePendingUserInputCustomAnswer
}
onProviderModelSelect={onProviderModelSelect}
getModelDisabledReason={getModelDisabledReason}
toggleInteractionMode={toggleInteractionMode}
handleRuntimeModeChange={handleRuntimeModeChange}
handleInteractionModeChange={handleInteractionModeChange}
togglePlanSidebar={togglePlanSidebar}
focusComposer={focusComposer}
scheduleComposerFocus={scheduleComposerFocus}
setThreadError={setThreadError}
onExpandImage={onExpandTimelineImage}
/>
<div
className={cn(
"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",
showComposerContextStrip && "chat-composer-glass-shell-with-context",
)}
>
<div className="chat-composer-glass-host relative z-10 w-full rounded-[22px]">
<div ref={attachDraftHeroComposerAnchorRef} className="relative z-10">
<ChatComposer
composerRef={composerRef}
composerDraftTarget={composerDraftTarget}
environmentId={environmentId}
routeKind={routeKind}
routeThreadRef={routeThreadRef}
draftId={draftId}
activeThreadId={activeThreadId}
activeThreadEnvironmentId={activeThread?.environmentId}
activeThread={activeThread}
isServerThread={isServerThread}
isLocalDraftThread={isLocalDraftThread}
forceExpandedOnMobile={forceExpandedMobileComposer && isDraftHeroState}
projectSelectionRequired={isLocalDraftThread && activeProject === null}
phase={phase}
isConnecting={isConnecting}
isSendBusy={isSendBusy}
isPreparingWorktree={isPreparingWorktree}
environmentUnavailable={activeEnvironmentUnavailableState}
activePendingApproval={activePendingApproval}
pendingApprovals={pendingApprovals}
pendingUserInputs={pendingUserInputs}
activePendingProgress={activePendingProgress}
activePendingResolvedAnswers={activePendingResolvedAnswers}
activePendingIsResponding={activePendingIsResponding}
activePendingDraftAnswers={activePendingDraftAnswers}
activePendingQuestionIndex={activePendingQuestionIndex}
respondingRequestIds={respondingRequestIds}
showPlanFollowUpPrompt={showPlanFollowUpPrompt}
activeProposedPlan={activeProposedPlan}
activePlan={activePlan as { turnId?: TurnId } | null}
sidebarProposedPlan={sidebarProposedPlan as { turnId?: TurnId } | null}
planSidebarLabel={planSidebarLabel}
planSidebarOpen={planSidebarOpen}
runtimeMode={runtimeMode}
interactionMode={interactionMode}
lockedProvider={lockedProvider}
providerStatuses={providerStatuses as ServerProvider[]}
activeProjectDefaultModelSelection={
activeProject?.defaultModelSelection
}
activeThreadModelSelection={activeThread?.modelSelection}
activeThreadActivities={activeThread?.activities}
resolvedTheme={resolvedTheme}
settings={settings}
keybindings={keybindings}
terminalOpen={Boolean(terminalUiState.terminalOpen)}
gitCwd={gitCwd}
promptRef={promptRef}
composerImagesRef={composerImagesRef}
composerTerminalContextsRef={composerTerminalContextsRef}
composerElementContextsRef={composerElementContextsRef}
onSend={onSend}
onInterrupt={onInterrupt}
onImplementPlanInNewThread={onImplementPlanInNewThread}
onRespondToApproval={onRespondToApproval}
onSelectActivePendingUserInputOption={
onSelectActivePendingUserInputOption
}
onAdvanceActivePendingUserInput={onAdvanceActivePendingUserInput}
onPreviousActivePendingUserInputQuestion={
onPreviousActivePendingUserInputQuestion
}
onChangeActivePendingUserInputCustomAnswer={
onChangeActivePendingUserInputCustomAnswer
}
onProviderModelSelect={onProviderModelSelect}
getModelDisabledReason={getModelDisabledReason}
toggleInteractionMode={toggleInteractionMode}
handleRuntimeModeChange={handleRuntimeModeChange}
handleInteractionModeChange={handleInteractionModeChange}
togglePlanSidebar={togglePlanSidebar}
focusComposer={focusComposer}
scheduleComposerFocus={scheduleComposerFocus}
setThreadError={setThreadError}
onExpandImage={onExpandTimelineImage}
/>
</div>
</div>
</div>
<div className="min-h-0">
<div
data-terminal-open={terminalUiState.terminalOpen ? "true" : undefined}
className="relative z-0"
>
{isGitRepo && (
<div className="pointer-events-auto">
<BranchToolbar
environmentId={activeThread.environmentId}
threadId={activeThread.id}
{...(routeKind === "draft" && draftId ? { draftId } : {})}
onEnvModeChange={onEnvModeChange}
startFromOrigin={startFromOrigin}
onStartFromOriginChange={onStartFromOriginChange}
{...(canOverrideServerThreadEnvMode
? { effectiveEnvModeOverride: envMode }
: {})}
{...(canOverrideServerThreadEnvMode
? {
activeThreadBranchOverride: activeThreadBranch,
onActiveThreadBranchOverrideChange:
setPendingServerThreadBranch,
}
: {})}
envLocked={envLocked}
onComposerFocusRequest={scheduleComposerFocus}
{...(canCheckoutPullRequestIntoThread
? { onCheckoutPullRequestRequest: openPullRequestDialog }
: {})}
{...(hasMultipleEnvironments ? { onEnvironmentChange } : {})}
availableEnvironments={logicalProjectEnvironments}
/>
</div>
)}
<div className="min-h-0">
<div
data-terminal-open={terminalUiState.terminalOpen ? "true" : undefined}
className="relative z-0"
>
{showComposerContextStrip && (
<div className="pointer-events-auto">
<BranchToolbar
environmentId={activeThread.environmentId}
threadId={activeThread.id}
{...(routeKind === "draft" && draftId ? { draftId } : {})}
onEnvModeChange={onEnvModeChange}
startFromOrigin={startFromOrigin}
onStartFromOriginChange={onStartFromOriginChange}
{...(canOverrideServerThreadEnvMode
? { effectiveEnvModeOverride: envMode }
: {})}
{...(canOverrideServerThreadEnvMode
? {
activeThreadBranchOverride: activeThreadBranch,
onActiveThreadBranchOverrideChange:
setPendingServerThreadBranch,
}
: {})}
envLocked={envLocked}
onComposerFocusRequest={scheduleComposerFocus}
{...(canCheckoutPullRequestIntoThread
? { onCheckoutPullRequestRequest: openPullRequestDialog }
: {})}
{...(hasMultipleEnvironments ? { onEnvironmentChange } : {})}
availableEnvironments={logicalProjectEnvironments}
/>
</div>
)}
</div>
</div>
</div>
<div
+93 -18
View File
@@ -377,21 +377,20 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
}
.chat-composer-glass-host {
.chat-composer-glass-shell {
--chat-composer-glass-surface: var(--card);
--chat-composer-outline: rgb(0 0 0 / 8%);
position: relative;
box-shadow:
0 0 0 1px rgb(0 0 0 / 8%),
0 12px 28px -18px rgb(0 0 0 / 40%);
isolation: isolate;
}
.chat-composer-glass-host::before {
.chat-composer-glass-shell::before {
pointer-events: none;
position: absolute;
z-index: 0;
inset: 0;
border-radius: inherit;
border-radius: 22px;
background: color-mix(
in srgb,
var(--chat-composer-glass-surface) var(--glass-opacity),
@@ -402,9 +401,73 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
content: "";
}
.chat-composer-context-strip {
--chat-composer-context-surface: var(--card);
.chat-composer-glass-shell-with-context {
--chat-composer-context-extension: 2.25rem;
}
.chat-composer-glass-shell-with-context::before {
border-radius: 0;
/*
* One continuous glass layer: a 22px composer joined to a 16px strip,
* whose visible sides align with the composer's bottom tangents.
*/
clip-path: shape(
from 0 22px,
curve to 22px 0 with 0 9.85px / 9.85px 0,
line to calc(100% - 22px) 0,
curve to 100% 22px with calc(100% - 9.85px) 0 / 100% 9.85px,
line to 100% calc(100% - var(--chat-composer-context-extension) - 22px),
curve to calc(100% - 22px) calc(100% - var(--chat-composer-context-extension)) with 100%
calc(100% - var(--chat-composer-context-extension) - 9.85px) / calc(100% - 9.85px)
calc(100% - var(--chat-composer-context-extension)),
line to calc(100% - 22px) calc(100% - 16px),
curve to calc(100% - 38px) 100% with calc(100% - 22px) calc(100% - 7.16px) /
calc(100% - 29.16px) 100%,
line to 38px 100%,
curve to 22px calc(100% - 16px) with 29.16px 100% / 22px calc(100% - 7.16px),
line to 22px calc(100% - var(--chat-composer-context-extension)),
curve to 0 calc(100% - var(--chat-composer-context-extension) - 22px) with 9.85px
calc(100% - var(--chat-composer-context-extension)) / 0
calc(100% - var(--chat-composer-context-extension) - 9.85px),
line to 0 22px,
close
);
}
@media (min-width: 40rem) {
.chat-composer-glass-shell-with-context {
/* The xs toolbar controls shrink by 4px at Tailwind's sm breakpoint. */
--chat-composer-context-extension: 2rem;
}
}
.chat-composer-glass-host {
position: relative;
box-shadow: 0 12px 28px -18px rgb(0 0 0 / 40%);
}
.chat-composer-glass-host::after {
pointer-events: none;
position: absolute;
z-index: 1;
inset: 0;
border: 1px solid var(--chat-composer-outline);
border-radius: inherit;
/* Keep the attachment seam open; the strip continues the outer outline below. */
clip-path: polygon(
0 0,
100% 0,
100% 100%,
calc(100% - 22px) 100%,
calc(100% - 22px) calc(100% - 2px),
22px calc(100% - 2px),
22px 100%,
0 100%
);
content: "";
}
.chat-composer-context-strip {
position: relative;
isolation: isolate;
}
@@ -413,27 +476,39 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
position: absolute;
z-index: -1;
inset: 0;
border: 1px solid var(--chat-composer-outline);
border-radius: 0 0 16px 16px;
background: color-mix(
in srgb,
var(--chat-composer-context-surface) var(--glass-opacity),
transparent
);
/* Start the strip outline exactly where the composer's 22px curve reaches its tangent. */
-webkit-mask-image: linear-gradient(to bottom, transparent 0 1rem, black 1rem);
mask-image: linear-gradient(to bottom, transparent 0 1rem, black 1rem);
box-shadow: 0 12px 28px -18px rgb(0 0 0 / 40%);
content: "";
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
}
.dark .chat-composer-glass-shell {
--chat-composer-glass-surface: color-mix(in srgb, var(--background) 96%, var(--color-white));
--chat-composer-outline: color-mix(in srgb, var(--color-white) 5%, transparent);
--chat-composer-highlight: rgb(255 255 255 / 3%);
}
.dark .chat-composer-glass-host {
--chat-composer-glass-surface: color-mix(in srgb, var(--background) 96%, var(--color-white));
box-shadow: none;
}
.dark .chat-composer-glass-host::after {
box-shadow: inset 0 1px var(--chat-composer-highlight);
}
.dark .chat-composer-context-strip::before {
border-color: rgb(255 255 255 / 7%);
background:
linear-gradient(
to bottom,
transparent 0 1rem,
rgb(0 0 0 / 18%) 1rem,
transparent calc(1rem + 10px)
),
rgb(255 255 255 / 2%);
box-shadow: 0 14px 32px -18px rgb(0 0 0 / 75%);
}
@@ -641,7 +716,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
background: var(--background) !important;
}
.chat-composer-glass-host::before {
.chat-composer-glass-shell::before {
background: var(--chat-composer-glass-surface);
}