Skip to content
TypeScript

fix(desktop): let the window shrink to 400x360 so it fits half-screen tiles (#28223)

shivamccde655b8f3d
diff --git a/apps/desktop/src/settings/DesktopAppSettings.test.ts b/apps/desktop/src/settings/DesktopAppSettings.test.ts
index 7e4b5300830..868e1c139fb 100644
--- a/apps/desktop/src/settings/DesktopAppSettings.test.ts
+++ b/apps/desktop/src/settings/DesktopAppSettings.test.ts
@@ -200,16 +200,22 @@ describe("DesktopSettings", () => {
withSettings(
Effect.gen(function* () {
const settings = yield* DesktopAppSettings.DesktopAppSettings;
- yield* writeSettingsPatch({
- mainWindowBounds: { x: 10.5, y: 20, width: 839, height: 620 },
- mainWindowMaximized: true,
- serverExposureMode: "network-accessible",
- });
-
- const loaded = yield* settings.load;
- assert.isNull(loaded.mainWindowBounds);
- assert.isFalse(loaded.mainWindowMaximized);
- assert.equal(loaded.serverExposureMode, "network-accessible");
+ for (const bounds of [
+ { x: 10.5, y: 20, width: 400, height: 360 },
+ { x: 10, y: 20, width: 399, height: 360 },
+ { x: 10, y: 20, width: 400, height: 359 },
+ ]) {
+ yield* writeSettingsPatch({
+ mainWindowBounds: bounds,
+ mainWindowMaximized: true,
+ serverExposureMode: "network-accessible",
+ });
+
+ const loaded = yield* settings.load;
+ assert.isNull(loaded.mainWindowBounds);
+ assert.isFalse(loaded.mainWindowMaximized);
+ assert.equal(loaded.serverExposureMode, "network-accessible");
+ }
}),
),
);
@@ -221,17 +227,24 @@ describe("DesktopSettings", () => {
const fileSystem = yield* FileSystem.FileSystem;
const settings = yield* DesktopAppSettings.DesktopAppSettings;
- yield* settings.setMainWindowBounds({ x: -1200, y: 40, width: 1440, height: 960 }, true);
+ yield* settings.setMainWindowBounds({ x: -1200, y: 40, width: 400, height: 360 }, true);
yield* settings.setServerExposureMode("network-accessible");
const persisted = yield* decodeDesktopSettingsPatch(
yield* fileSystem.readFileString(environment.desktopSettingsPath),
);
assert.deepEqual(persisted, {
- mainWindowBounds: { x: -1200, y: 40, width: 1440, height: 960 },
+ mainWindowBounds: { x: -1200, y: 40, width: 400, height: 360 },
mainWindowMaximized: true,
serverExposureMode: "network-accessible",
} satisfies typeof DesktopSettingsPatch.Type);
+
+ const restored = yield* Effect.gen(function* () {
+ const freshSettings = yield* DesktopAppSettings.DesktopAppSettings;
+ return yield* freshSettings.load;
+ }).pipe(Effect.provide(DesktopAppSettings.layer));
+ assert.deepEqual(restored.mainWindowBounds, persisted.mainWindowBounds);
+ assert.isTrue(restored.mainWindowMaximized);
}),
),
);
diff --git a/apps/desktop/src/settings/DesktopAppSettings.ts b/apps/desktop/src/settings/DesktopAppSettings.ts
index 6cd34322d98..4c2ae8d1d13 100644
--- a/apps/desktop/src/settings/DesktopAppSettings.ts
+++ b/apps/desktop/src/settings/DesktopAppSettings.ts
@@ -47,9 +47,12 @@ export interface DesktopSettingsChange {
}
const DEFAULT_TAILSCALE_SERVE_PORT = 443;
-const MIN_MAIN_WINDOW_SIZE = {
- width: 840,
- height: 620,
+// Fits half and third tiles of common scaled displays (down to 480x432 DIP) on
+// Wayland, where Electron's client-side frame adds 32x42 DIP to the enforced
+// minimum. The web layout already handles phone widths.
+export const MIN_MAIN_WINDOW_SIZE = {
+ width: 400,
+ height: 360,
} as const;
export const DesktopWindowBoundsSchema = Schema.Struct({
x: Schema.Int,
diff --git a/apps/desktop/src/window/DesktopWindow.ts b/apps/desktop/src/window/DesktopWindow.ts
index b2f643e55fb..292a3540d18 100644
--- a/apps/desktop/src/window/DesktopWindow.ts
+++ b/apps/desktop/src/window/DesktopWindow.ts
@@ -399,8 +399,8 @@ export const make = Effect.gen(function* () {
if (yield* Ref.get(desktopState.quitting)) return Option.none();
const window = yield* electronWindow.create({
...initialBounds,
- minWidth: 840,
- minHeight: 620,
+ minWidth: DesktopAppSettings.MIN_MAIN_WINDOW_SIZE.width,
+ minHeight: DesktopAppSettings.MIN_MAIN_WINDOW_SIZE.height,
show: false,
autoHideMenuBar: true,
...(environment.platform === "darwin" ? { disableAutoHideCursor: true } : {}),
diff --git a/apps/web/src/components/AppRouteModal.tsx b/apps/web/src/components/AppRouteModal.tsx
index 55d7c4112f9..79e5510265f 100644
--- a/apps/web/src/components/AppRouteModal.tsx
+++ b/apps/web/src/components/AppRouteModal.tsx
@@ -1,7 +1,8 @@
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
import { XIcon } from "lucide-react";
-import { useRef, useState, type ReactNode } from "react";
+import { useRef, useState, type CSSProperties, type ReactNode } from "react";
+import { useNativeTitlebarHeight } from "../lib/windowControlsOverlay";
import { useCloseAppModal } from "./sidebar/mainAppLocation";
import { Button } from "./ui/button";
import { DialogBackdrop } from "./ui/dialog";
@@ -20,6 +21,10 @@ export function AppRouteModal({ label, children }: { label: string; children: Re
// Focus the surface, not its first control: no stray focus ring, no phone keyboard.
// On close, leave focus alone; returning it to the opener paints a focus ring.
const popupRef = useRef<HTMLDivElement>(null);
+ // Clear the native window controls (macOS traffic lights, the Windows and Linux caption
+ // buttons). Below sm the modal fills the window and leaves that strip empty; up to lg its
+ // 1.5rem inset is shorter than the strip.
+ const nativeTitlebarHeight = useNativeTitlebarHeight();
return (
<DialogPrimitive.Root
@@ -41,7 +46,14 @@ export function AppRouteModal({ label, children }: { label: string; children: Re
<DialogPrimitive.Portal>
<DialogBackdrop />
<DialogPrimitive.Viewport
- className="fixed inset-0 z-50 flex items-center justify-center sm:p-6 lg:p-10"
+ style={
+ {
+ "--app-modal-titlebar-height": `${nativeTitlebarHeight}px`,
+ "--app-modal-top-inset": `max(env(safe-area-inset-top), ${nativeTitlebarHeight}px)`,
+ "--app-modal-sm-top": `max(1.5rem, ${nativeTitlebarHeight}px)`,
+ } as CSSProperties
+ }
+ className="fixed inset-0 z-50 flex items-center justify-center sm:p-6 sm:pt-(--app-modal-sm-top) lg:p-10"
onPointerDown={(event) => {
backdropPressRef.current = event.target === event.currentTarget;
}}
@@ -57,8 +69,13 @@ export function AppRouteModal({ label, children }: { label: string; children: Re
aria-label={label}
data-slot="dialog-popup"
data-app-modal=""
- className="relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-background max-sm:pt-safe max-sm:pb-safe text-foreground outline-none transition-[opacity,scale] duration-150 ease-out [-webkit-app-region:no-drag] data-ending-style:scale-[0.985] data-ending-style:opacity-0 data-starting-style:scale-[0.985] data-starting-style:opacity-0 sm:max-h-[60rem] sm:max-w-[80rem] sm:rounded-2xl sm:border sm:shadow-2xl/40"
+ className="relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-background max-sm:pt-(--app-modal-top-inset) max-sm:pb-safe text-foreground outline-none transition-[opacity,scale] duration-150 ease-out [-webkit-app-region:no-drag] data-ending-style:scale-[0.985] data-ending-style:opacity-0 data-starting-style:scale-[0.985] data-starting-style:opacity-0 sm:max-h-[60rem] sm:max-w-[80rem] sm:rounded-2xl sm:border sm:shadow-2xl/40"
>
+ {/* The emptied strip still moves the window, as the titlebar it replaces does. */}
+ <div
+ aria-hidden
+ className="absolute inset-x-0 top-0 hidden h-(--app-modal-titlebar-height) [-webkit-app-region:drag] max-sm:block"
+ />
{children}
</DialogPrimitive.Popup>
</DialogPrimitive.Viewport>
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 251c0c63603..76ad543630f 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -3540,7 +3540,7 @@ export default function ChatView(props: ChatViewProps) {
data-chat-composer-overlay="true"
className={
isDraftHeroState
- ? "pointer-events-none absolute inset-0 z-20 flex items-center"
+ ? "pointer-events-none absolute inset-0 z-20 flex items-center [@media(max-height:34rem)]:items-end"
: "pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2"
}
>
@@ -3577,278 +3577,286 @@ export default function ChatView(props: ChatViewProps) {
}
>
<ChildThreadApprovals threadRef={activeThreadRef} />
- <ComposerSurface.Shell contextRow={showComposerContextStrip}>
- <ComposerSurface.Host
- inert={queuedRunEdit.isSaving}
- aria-busy={queuedRunEdit.isSaving}
- >
- <div className="relative z-10">
- {showProviderSubagentBar ? (
- <ProviderSubagentBar
- provider={selectedProviderEntry ?? null}
- showInstanceBadge={
- selectedProviderEntry !== undefined &&
- shouldShowInstanceBadge(
- selectedProviderEntry,
- providerInstanceEntries,
- )
- }
- modelLabel={providerSubagentModelLabel}
- effortLabel={providerSubagentEffortLabel}
- status={providerSubagentStatus}
- onOpenParent={parentThreadLink?.open ?? null}
- actions={
- selectedProviderEntry?.driverKind === "antigravity" ? (
- <NativeChildWorkDialog
- environmentId={environmentId}
- threadId={threadId}
- />
- ) : null
- }
- />
- ) : null}
- {!composerMounted ? null : (
- <ChatComposer
- canOperateThread={canOperateThread}
- reportedModelSelection={reportedModelSelection}
- multipleModelSelections={multipleModelSelections}
- supportsMultipleModels={
- serverConfig?.environment.capabilities.requiredWorktreeBootstrap ===
- true
- }
- onMultipleModelSelectionsChange={setMultipleModelSelectionsStable}
- composerRef={composerRef}
- composerDraftTarget={composerDraftTarget}
- environmentId={environmentId}
- attachmentUploadsCapabilityKnown={attachmentUploadsCapabilityKnown}
- supportsAttachmentUploads={supportsAttachmentUploads}
- supportsQuestionAttachments={supportsQuestionAttachments}
- maxFileAttachmentBytes={maxFileAttachmentBytes}
- routeKind={routeKind}
- routeThreadRef={routeThreadRef}
- draftId={draftId}
- activeThreadId={activeThreadId}
- activeThread={activeThread}
- activeThreadShell={activeThreadShell}
- promptHistoryEntries={timelineEntries}
- forceExpandedOnMobile={
- forceExpandedMobileComposer && isDraftHeroState
- }
- projectSelectionRequired={
- isLocalDraftThread && activeProject === null
- }
- phase={phase}
- isCompacting={isCompacting}
- canInterrupt={canInterruptRunningThread}
- isSendBusy={
- (isSendBusy && !sendQueuesBehindSetup) ||
- (setupQueueSendThreadKey !== null &&
- setupQueueSendThreadKey === activeThreadKey) ||
- queuedRunEdit.isSaving ||
- isResuming
- }
- canResume={resumableRunId !== null || hasHeldQueuedRuns}
- isRevertingCheckpoint={isRevertingCheckpoint}
- sendDisabledReason={
- !canOperateThread
- ? "This connection cannot change threads."
- : isEnvironmentChanging
- ? "Preparing machine"
- : isRevertingCheckpoint
- ? "Rewinding conversation"
- : feedbackUploading
- ? "Sending feedback"
- : threadDetailLoading
- ? "Messages loading"
- : worktreeSetupBlocksSend
- ? "Preparing worktree"
- : projectCloneSendBlockReason
- }
- isPreparingWorktree={isPreparingWorktree && !sendQueuesBehindSetup}
- bannerItems={
- isDraftHeroState || composerBannerItems.length === 0
- ? EMPTY_COMPOSER_BANNER_ITEMS
- : composerBannerItems
- }
- resumeCompactionTokens={resumeCompactionTokens}
- keepFullHistory={keepFullHistory}
- onToggleKeepFullHistory={toggleKeepFullHistoryStable}
- sideChatAvailable={sideChat.available}
- sideChatDisabledReason={sideChatDisabledReason}
- onFreshSession={
- freshSessionCommandAvailable ? armFreshSessionStable : undefined
- }
- onUsageLimitsCommand={
- usageLimitsOffered &&
- usageLimitsKey !== null &&
- !composerHasNonPromptContent
- ? openUsageLimits
- : undefined
- }
- environmentUnavailable={activeEnvironmentUnavailableState}
- activePendingApproval={activePendingApproval}
- pendingApprovals={pendingApprovals}
- onHeldRequestIdsChange={onHeldRequestIdsChange}
- pendingUserInputs={pendingUserInputs}
- activePendingProgress={activePendingProgress}
- activePendingResolvedAnswers={activePendingResolvedAnswers}
- activePendingIsResponding={activePendingIsResponding}
- activePendingDraftAnswers={activePendingDraftAnswers}
- activePendingQuestionIndex={activePendingQuestionIndex}
- respondingRequestIds={respondingRequestIds}
- showPlanFollowUpPrompt={showPlanFollowUpPrompt}
- activeProposedPlan={activeProposedPlan}
- threadSyncPhase={
- activeEnvironmentUnavailable ? null : threadSyncPhase
- }
- runtimeMode={runtimeMode}
- defaultRuntimeMode={defaultRuntimeMode}
- interactionMode={interactionMode}
- lockedProvider={modelPickerLockedProvider}
- providerStatuses={providerStatuses as ServerProvider[]}
- providerCatalogKnown={serverConfig !== null}
- activeProjectDefaultModelSelection={
- activeProjectDefaultModelSelection
- }
- activeThreadModelSelection={activeThread?.modelSelection}
- activeProjectId={activeProject?.id ?? null}
- projectName={activeProject?.title}
- contextWindowEntries={serverVisibleTurnItems}
- contextWindowLiveUsage={activeThreadLiveTokenUsage}
- contextWindowProviderThread={activeProviderThread}
- compactThreadUnavailable={compactThreadUnavailable}
- compactDisabled={compactDisabled}
- compactDisabledReason={compactDisabledReason}
- resolvedTheme={resolvedTheme}
- settings={settings}
- keybindings={keybindings}
- terminalOpen={Boolean(terminalUiState.terminalOpen)}
- gitCwd={gitCwd}
- pullRequestProjectId={
- supportsPullRequests ? (activeProject?.id ?? null) : null
- }
- pullRequestRepository={
- supportsPullRequests ? activeProjectRepository : null
- }
- threadPullRequests={(activeThreadShell ?? activeThread)?.pullRequests}
- onComposerOverlayHeightChange={publishComposerOverlayHeightStable}
- permissionsShownInStrip={showComposerContextStrip && !isServerThread}
- promptRef={promptRef}
- composerImagesRef={composerImagesRef}
- composerFilesRef={composerFilesRef}
- composerTerminalContextsRef={composerTerminalContextsRef}
- onPageScrollKeyDown={onComposerPageScrollKeyDownStable}
- onPageScrollKeyUp={onComposerPageScrollKeyUpStable}
- onPageScrollRelease={onComposerPageScrollReleaseStable}
- onCompactContext={onComposerCompactContextStable}
- onSend={onComposerSendStable}
- onResume={onComposerResumeStable}
- onInterrupt={onInterruptStable}
- onImplementPlanInNewThread={onImplementPlanInNewThreadStable}
- onSelectActivePendingUserInputOption={
- onSelectActivePendingUserInputOptionStable
- }
- onAdvanceActivePendingUserInput={
- onAdvanceActivePendingUserInputStable
- }
- onDismissActivePendingUserInput={onDismissUserInputStable}
- onPreviousActivePendingUserInputQuestion={
- onPreviousActivePendingUserInputQuestionStable
- }
- onChangeActivePendingUserInputCustomAnswer={
- onChangeActivePendingUserInputCustomAnswer
- }
- onProviderModelSelect={onProviderModelSelectStable}
- onOpenProviderSetup={openProviderSetupStable}
- getModelDisabledReason={getModelDisabledReason}
- toggleInteractionMode={toggleInteractionModeStable}
- handleRuntimeModeChange={handleRuntimeModeChangeStable}
- handleInteractionModeChange={handleInteractionModeChangeStable}
- focusComposer={focusComposerStable}
- scheduleComposerFocus={scheduleComposerFocusStable}
- setThreadError={setThreadError}
- onExpandImage={onExpandTimelineImageStable}
- onFileOpen={openFileAttachmentStable}
- editingQueuedAttachments={queuedRunEdit.editingAttachments}
- onRemoveEditingQueuedAttachment={
- queuedRunEdit.removeEditingAttachment
- }
- />
- )}
- </div>
- </ComposerSurface.Host>
- <div className="min-h-0">
- <div
- data-terminal-open={terminalUiState.terminalOpen ? "true" : undefined}
- className="relative z-0"
+ <div className="relative">
+ <ComposerSurface.Shell contextRow={showComposerContextStrip}>
+ <ComposerSurface.Host
+ inert={queuedRunEdit.isSaving}
+ aria-busy={queuedRunEdit.isSaving}
>
- {showComposerContextStrip && (
- <div className="pointer-events-auto">
- <BranchToolbar
- forceNewWorktree={multipleModelSelections !== null}
- ref={branchToolbarRef}
- environmentId={activeThread.environmentId}
- threadId={activeThread.id}
- projectId={activeThread.projectId}
- worktreePath={activeThread.worktreePath}
- isServerThread={isServerThread}
- showGitControls={isGitRepo}
- {...(routeKind === "draft" && draftId ? { draftId } : {})}
- onEnvModeChange={onEnvModeChangeStable}
- startFromOrigin={startFromOrigin}
- onStartFromOriginChange={onStartFromOriginChange}
- envMode={envMode}
- {...(canOverrideServerThreadEnvMode
- ? {
- activeThreadBranchOverride: activeThreadBranch,
- onActiveThreadBranchOverrideChange:
- setPendingServerThreadBranch,
- }
- : {})}
- envLocked={envLocked}
- onComposerFocusRequest={scheduleComposerFocusStable}
- {...(canCheckoutPullRequestIntoThread
- ? { onCheckoutPullRequestRequest: openPullRequestDialogStable }
- : {})}
- {...(canChangeEnvironment
- ? { onEnvironmentChange: onEnvironmentChangeStable }
- : {})}
- autoEnvironmentLabel={autoEnvironmentLabel}
- onAutoEnvironment={
- draftId &&
- !envLocked &&
- canAutoBalanceEnvironments &&
- loadBalancingSettings.loadBalancingEnabled
- ? onAutoEnvironmentStable
+ <div className="relative z-10">
+ {showProviderSubagentBar ? (
+ <ProviderSubagentBar
+ provider={selectedProviderEntry ?? null}
+ showInstanceBadge={
+ selectedProviderEntry !== undefined &&
+ shouldShowInstanceBadge(
+ selectedProviderEntry,
+ providerInstanceEntries,
+ )
+ }
+ modelLabel={providerSubagentModelLabel}
+ effortLabel={providerSubagentEffortLabel}
+ status={providerSubagentStatus}
+ onOpenParent={parentThreadLink?.open ?? null}
+ actions={
+ selectedProviderEntry?.driverKind === "antigravity" ? (
+ <NativeChildWorkDialog
+ environmentId={environmentId}
+ threadId={threadId}
+ />
+ ) : null
+ }
+ />
+ ) : null}
+ {!composerMounted ? null : (
+ <ChatComposer
+ canOperateThread={canOperateThread}
+ reportedModelSelection={reportedModelSelection}
+ multipleModelSelections={multipleModelSelections}
+ supportsMultipleModels={
+ serverConfig?.environment.capabilities
+ .requiredWorktreeBootstrap === true
+ }
+ onMultipleModelSelectionsChange={setMultipleModelSelectionsStable}
+ composerRef={composerRef}
+ composerDraftTarget={composerDraftTarget}
+ environmentId={environmentId}
+ attachmentUploadsCapabilityKnown={attachmentUploadsCapabilityKnown}
+ supportsAttachmentUploads={supportsAttachmentUploads}
+ supportsQuestionAttachments={supportsQuestionAttachments}
+ maxFileAttachmentBytes={maxFileAttachmentBytes}
+ routeKind={routeKind}
+ routeThreadRef={routeThreadRef}
+ draftId={draftId}
+ activeThreadId={activeThreadId}
+ activeThread={activeThread}
+ activeThreadShell={activeThreadShell}
+ promptHistoryEntries={timelineEntries}
+ forceExpandedOnMobile={
+ forceExpandedMobileComposer && isDraftHeroState
+ }
+ projectSelectionRequired={
+ isLocalDraftThread && activeProject === null
+ }
+ phase={phase}
+ isCompacting={isCompacting}
+ canInterrupt={canInterruptRunningThread}
+ isSendBusy={
+ (isSendBusy && !sendQueuesBehindSetup) ||
+ (setupQueueSendThreadKey !== null &&
+ setupQueueSendThreadKey === activeThreadKey) ||
+ queuedRunEdit.isSaving ||
+ isResuming
+ }
+ canResume={resumableRunId !== null || hasHeldQueuedRuns}
+ isRevertingCheckpoint={isRevertingCheckpoint}
+ sendDisabledReason={
+ !canOperateThread
+ ? "This connection cannot change threads."
+ : isEnvironmentChanging
+ ? "Preparing machine"
+ : isRevertingCheckpoint
+ ? "Rewinding conversation"
+ : feedbackUploading
+ ? "Sending feedback"
+ : threadDetailLoading
+ ? "Messages loading"
+ : worktreeSetupBlocksSend
+ ? "Preparing worktree"
+ : projectCloneSendBlockReason
+ }
+ isPreparingWorktree={isPreparingWorktree && !sendQueuesBehindSetup}
+ bannerItems={
+ isDraftHeroState || composerBannerItems.length === 0
+ ? EMPTY_COMPOSER_BANNER_ITEMS
+ : composerBannerItems
+ }
+ resumeCompactionTokens={resumeCompactionTokens}
+ keepFullHistory={keepFullHistory}
+ onToggleKeepFullHistory={toggleKeepFullHistoryStable}
+ sideChatAvailable={sideChat.available}
+ sideChatDisabledReason={sideChatDisabledReason}
+ onFreshSession={
+ freshSessionCommandAvailable ? armFreshSessionStable : undefined
+ }
+ onUsageLimitsCommand={
+ usageLimitsOffered &&
+ usageLimitsKey !== null &&
+ !composerHasNonPromptContent
+ ? openUsageLimits
: undefined
}
- availableEnvironments={logicalProjectEnvironments}
- {...(isServerThread
- ? {}
- : {
- trailing: (
- <ComposerContextPermissions
- environmentId={environmentId}
- runtimeMode={runtimeMode}
- supportedRuntimeModes={
- activeProviderStatus?.supportedRuntimeModes
- }
- onRuntimeModeChange={handleRuntimeModeChangeStable}
- />
- ),
- })}
+ environmentUnavailable={activeEnvironmentUnavailableState}
+ activePendingApproval={activePendingApproval}
+ pendingApprovals={pendingApprovals}
+ onHeldRequestIdsChange={onHeldRequestIdsChange}
+ pendingUserInputs={pendingUserInputs}
+ activePendingProgress={activePendingProgress}
+ activePendingResolvedAnswers={activePendingResolvedAnswers}
+ activePendingIsResponding={activePendingIsResponding}
+ activePendingDraftAnswers={activePendingDraftAnswers}
+ activePendingQuestionIndex={activePendingQuestionIndex}
+ respondingRequestIds={respondingRequestIds}
+ showPlanFollowUpPrompt={showPlanFollowUpPrompt}
+ activeProposedPlan={activeProposedPlan}
+ threadSyncPhase={
+ activeEnvironmentUnavailable ? null : threadSyncPhase
+ }
+ runtimeMode={runtimeMode}
+ defaultRuntimeMode={defaultRuntimeMode}
+ interactionMode={interactionMode}
+ lockedProvider={modelPickerLockedProvider}
+ providerStatuses={providerStatuses as ServerProvider[]}
+ providerCatalogKnown={serverConfig !== null}
+ activeProjectDefaultModelSelection={
+ activeProjectDefaultModelSelection
+ }
+ activeThreadModelSelection={activeThread?.modelSelection}
+ activeProjectId={activeProject?.id ?? null}
+ projectName={activeProject?.title}
+ contextWindowEntries={serverVisibleTurnItems}
+ contextWindowLiveUsage={activeThreadLiveTokenUsage}
+ contextWindowProviderThread={activeProviderThread}
+ compactThreadUnavailable={compactThreadUnavailable}
+ compactDisabled={compactDisabled}
+ compactDisabledReason={compactDisabledReason}
+ resolvedTheme={resolvedTheme}
+ settings={settings}
+ keybindings={keybindings}
+ terminalOpen={Boolean(terminalUiState.terminalOpen)}
+ gitCwd={gitCwd}
+ pullRequestProjectId={
+ supportsPullRequests ? (activeProject?.id ?? null) : null
+ }
+ pullRequestRepository={
+ supportsPullRequests ? activeProjectRepository : null
+ }
+ threadPullRequests={
+ (activeThreadShell ?? activeThread)?.pullRequests
+ }
+ onComposerOverlayHeightChange={publishComposerOverlayHeightStable}
+ permissionsShownInStrip={
+ showComposerContextStrip && !isServerThread
+ }
+ promptRef={promptRef}
+ composerImagesRef={composerImagesRef}
+ composerFilesRef={composerFilesRef}
+ composerTerminalContextsRef={composerTerminalContextsRef}
+ onPageScrollKeyDown={onComposerPageScrollKeyDownStable}
+ onPageScrollKeyUp={onComposerPageScrollKeyUpStable}
+ onPageScrollRelease={onComposerPageScrollReleaseStable}
+ onCompactContext={onComposerCompactContextStable}
+ onSend={onComposerSendStable}
+ onResume={onComposerResumeStable}
+ onInterrupt={onInterruptStable}
+ onImplementPlanInNewThread={onImplementPlanInNewThreadStable}
+ onSelectActivePendingUserInputOption={
+ onSelectActivePendingUserInputOptionStable
+ }
+ onAdvanceActivePendingUserInput={
+ onAdvanceActivePendingUserInputStable
+ }
+ onDismissActivePendingUserInput={onDismissUserInputStable}
+ onPreviousActivePendingUserInputQuestion={
+ onPreviousActivePendingUserInputQuestionStable
+ }
+ onChangeActivePendingUserInputCustomAnswer={
+ onChangeActivePendingUserInputCustomAnswer
+ }
+ onProviderModelSelect={onProviderModelSelectStable}
+ onOpenProviderSetup={openProviderSetupStable}
+ getModelDisabledReason={getModelDisabledReason}
+ toggleInteractionMode={toggleInteractionModeStable}
+ handleRuntimeModeChange={handleRuntimeModeChangeStable}
+ handleInteractionModeChange={handleInteractionModeChangeStable}
+ focusComposer={focusComposerStable}
+ scheduleComposerFocus={scheduleComposerFocusStable}
+ setThreadError={setThreadError}
+ onExpandImage={onExpandTimelineImageStable}
+ onFileOpen={openFileAttachmentStable}
+ editingQueuedAttachments={queuedRunEdit.editingAttachments}
+ onRemoveEditingQueuedAttachment={
+ queuedRunEdit.removeEditingAttachment
+ }
/>
- </div>
- )}
+ )}
+ </div>
+ </ComposerSurface.Host>
+ <div className="min-h-0">
+ <div
+ data-terminal-open={terminalUiState.terminalOpen ? "true" : undefined}
+ className="relative z-0"
+ >
+ {showComposerContextStrip && (
+ <div className="pointer-events-auto">
+ <BranchToolbar
+ forceNewWorktree={multipleModelSelections !== null}
+ ref={branchToolbarRef}
+ environmentId={activeThread.environmentId}
+ threadId={activeThread.id}
+ projectId={activeThread.projectId}
+ worktreePath={activeThread.worktreePath}
+ isServerThread={isServerThread}
+ showGitControls={isGitRepo}
+ {...(routeKind === "draft" && draftId ? { draftId } : {})}
+ onEnvModeChange={onEnvModeChangeStable}
+ startFromOrigin={startFromOrigin}
+ onStartFromOriginChange={onStartFromOriginChange}
+ envMode={envMode}
+ {...(canOverrideServerThreadEnvMode
+ ? {
+ activeThreadBranchOverride: activeThreadBranch,
+ onActiveThreadBranchOverrideChange:
+ setPendingServerThreadBranch,
+ }
+ : {})}
+ envLocked={envLocked}
+ onComposerFocusRequest={scheduleComposerFocusStable}
+ {...(canCheckoutPullRequestIntoThread
+ ? { onCheckoutPullRequestRequest: openPullRequestDialogStable }
+ : {})}
+ {...(canChangeEnvironment
+ ? { onEnvironmentChange: onEnvironmentChangeStable }
+ : {})}
+ autoEnvironmentLabel={autoEnvironmentLabel}
+ onAutoEnvironment={
+ draftId &&
+ !envLocked &&
+ canAutoBalanceEnvironments &&
+ loadBalancingSettings.loadBalancingEnabled
+ ? onAutoEnvironmentStable
+ : undefined
+ }
+ availableEnvironments={logicalProjectEnvironments}
+ {...(isServerThread
+ ? {}
+ : {
+ trailing: (
+ <ComposerContextPermissions
+ environmentId={environmentId}
+ runtimeMode={runtimeMode}
+ supportedRuntimeModes={
+ activeProviderStatus?.supportedRuntimeModes
+ }
+ onRuntimeModeChange={handleRuntimeModeChangeStable}
+ />
+ ),
+ })}
+ />
+ </div>
+ )}
+ </div>
</div>
- </div>
+ </ComposerSurface.Shell>
{isDraftHeroState && composerBannerItems.length > 0 ? (
// Out of flow, like the headline, so a notice never moves the centered composer.
- <div className="absolute inset-x-0 top-full flex flex-col gap-1 pt-4">
+ // Short windows pin the composer to the bottom, where an out-of-flow notice
+ // would fall off-screen, so there it takes space and lifts the composer.
+ <div className="absolute inset-x-0 top-full flex flex-col gap-1 pt-4 [@media(max-height:34rem)]:static">
<ComposerBannerStack items={composerBannerItems} detached />
</div>
) : null}
- </ComposerSurface.Shell>
+ </div>
<div
aria-hidden
className="h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"
diff --git a/apps/web/src/components/chat/DraftHeroProjectHeading.tsx b/apps/web/src/components/chat/DraftHeroProjectHeading.tsx
index d5db58f503a..b0fa42cfcef 100644
--- a/apps/web/src/components/chat/DraftHeroProjectHeading.tsx
+++ b/apps/web/src/components/chat/DraftHeroProjectHeading.tsx
@@ -46,14 +46,16 @@ export function DraftHeroProjectHeading({
</span>
</span>
<h1 className="flex w-full flex-col items-center justify-center gap-2 text-center font-normal text-2xl text-foreground tracking-tight sm:text-3xl lg:group-data-[inline=true]/draft-hero:flex-row">
- <span className="max-w-full lg:group-data-[inline=true]/draft-hero:shrink-0">
+ <span className="max-w-full lg:group-data-[inline=true]/draft-hero:shrink-0 [@media(max-height:28rem)]:sr-only">
What should we build
<span className="lg:group-data-[inline=true]/draft-hero:hidden">?</span>
<span className="hidden lg:group-data-[inline=true]/draft-hero:inline"> in</span>
</span>
<span className="flex min-w-0 max-w-full items-baseline justify-center text-base tracking-normal lg:group-data-[inline=true]/draft-hero:text-3xl lg:group-data-[inline=true]/draft-hero:tracking-tight">
<span className="min-w-0">{children}</span>
- <span className="hidden shrink-0 lg:group-data-[inline=true]/draft-hero:inline">?</span>
+ <span className="hidden shrink-0 lg:group-data-[inline=true]/draft-hero:inline [@media(max-height:28rem)]:hidden!">
+ ?
+ </span>
</span>
</h1>
</div>
diff --git a/apps/web/src/components/settings/SnoozePresetsSettings.tsx b/apps/web/src/components/settings/SnoozePresetsSettings.tsx
index 22f2d43497f..1f88e5541dc 100644
--- a/apps/web/src/components/settings/SnoozePresetsSettings.tsx
+++ b/apps/web/src/components/settings/SnoozePresetsSettings.tsx
@@ -339,7 +339,7 @@ function SnoozePresetFields(props: {
// misclick on "When" can be undone without retyping it.
const [memory, setMemory] = useState<KindMemory>({ minutes: 60, time: "09:00" });
return (
- <div className="flex items-center gap-2">
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
<Select
value={when}
items={WHEN_LABELS}
@@ -373,7 +373,7 @@ function SnoozePresetFields(props: {
onChange={(minutes) => onChange({ ...preset, minutes })}
/>
) : (
- <>
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
<span className="text-xs text-muted-foreground">at</span>
<Input
nativeInput
@@ -388,7 +388,7 @@ function SnoozePresetFields(props: {
}
}}
/>
- </>
+ </div>
)}
</div>
);
@@ -410,7 +410,7 @@ function DurationFields(props: { minutes: number; onChange: (minutes: number) =>
setDraft(amount);
}
return (
- <>
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
<NumberField
size="sm"
className="w-32"
@@ -465,6 +465,6 @@ function DurationFields(props: { minutes: number; onChange: (minutes: number) =>
))}
</SelectPopup>
</Select>
- </>
+ </div>
);
}
diff --git a/apps/web/src/components/settings/TypographySettings.tsx b/apps/web/src/components/settings/TypographySettings.tsx
index 9e3c58aea1c..b782c616748 100644
--- a/apps/web/src/components/settings/TypographySettings.tsx
+++ b/apps/web/src/components/settings/TypographySettings.tsx
@@ -493,8 +493,8 @@ function FontFamilySettingsRow({
/>
);
const control = (
- <div className="flex w-full items-center gap-2 sm:w-auto">
- <div className="min-w-0 flex-1 sm:w-44 sm:flex-none">{familyControl}</div>
+ <div className="flex w-full flex-wrap items-center gap-2 sm:w-auto @min-[32rem]/settings-row:flex-nowrap">
+ <div className="min-w-36 flex-1 sm:w-44 sm:flex-none">{familyControl}</div>
<Select
value={String(size.value)}
onValueChange={(next) => {
diff --git a/apps/web/src/components/ui/command.tsx b/apps/web/src/components/ui/command.tsx
index 3beb9e266e7..a4c331d726f 100644
--- a/apps/web/src/components/ui/command.tsx
+++ b/apps/web/src/components/ui/command.tsx
@@ -3,6 +3,7 @@ import { SearchIcon } from "lucide-react";
import { useRef } from "react";
import type * as React from "react";
import { cn } from "~/lib/utils";
+import { useNativeTitlebarHeight } from "~/lib/windowControlsOverlay";
import {
Autocomplete,
AutocompleteCollection,
@@ -36,13 +37,19 @@ function CommandDialogBackdrop({ className, ...props }: CommandDialogPrimitive.B
}
function CommandDialogViewport({ className, ...props }: CommandDialogPrimitive.Viewport.Props) {
+ // Short desktop windows would put the search field under the native window controls.
+ const nativeTitlebarHeight = useNativeTitlebarHeight();
+ const titlebarStyle = {
+ "--command-titlebar-height": `${nativeTitlebarHeight}px`,
+ } as React.CSSProperties;
return (
<CommandDialogPrimitive.Viewport
className={cn(
- "pointer-events-none fixed inset-0 z-50 flex flex-col items-center px-4 py-[max(--spacing(4),4vh)] sm:py-[10vh]",
+ "pointer-events-none fixed inset-0 z-50 flex flex-col items-center px-4 pt-[max(--spacing(4),4vh,calc(var(--command-titlebar-height)+--spacing(2)))] pb-[max(--spacing(4),4vh)] sm:pt-[max(10vh,calc(var(--command-titlebar-height)+--spacing(2)))] sm:pb-[10vh]",
className,
)}
data-slot="command-dialog-viewport"
+ style={titlebarStyle}
{...props}
/>
);