Skip to content

Commit 723fa72

Browse files
t3dotggclaude
andcommitted
feat(web): simpler composer controls
- Effort shows as rising bars; Ultracode and Ultrathink keep their names. - Permissions hide while the thread matches your default; a horizontal toggle lives in the effort menu, and a chip appears only for a non-default mode. - No chevrons; the new-thread chin becomes a plain row. - The compacted composer keeps its controls in its one row; the model strip, the resting portal and the chin seam are deleted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 28286d5 commit 723fa72

26 files changed

Lines changed: 963 additions & 459 deletions

‎apps/web/src/components/BranchToolbar.logic.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ export function shouldShowComposerContextStrip(input: {
7070
hasActiveProject: boolean;
7171
isGitRepo: boolean;
7272
showEnvironmentIndicator: boolean;
73-
hostsRestingComposerControls: boolean;
7473
}): boolean {
7574
return (
7675
input.hasActiveProject &&
7776
(input.isDraftHeroState || input.persistInActiveThreads) &&
78-
(input.isGitRepo || input.showEnvironmentIndicator || input.hostsRestingComposerControls)
77+
(input.isGitRepo || input.showEnvironmentIndicator)
7978
);
8079
}
8180

‎apps/web/src/components/BranchToolbar.tsx‎

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@ import { stackedThreadToast, toastManager } from "./ui/toast";
55
import { ComposerContextLabel } from "./ComposerContextLabel";
66
import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime/environment";
77
import type { EnvironmentId, ProjectId, ThreadId } from "@t3tools/contracts";
8-
import {
9-
ChevronDownIcon,
10-
FolderGit2Icon,
11-
FolderGitIcon,
12-
FolderIcon,
13-
PlusIcon,
14-
ScaleIcon,
15-
} from "lucide-react";
8+
import { FolderGit2Icon, FolderGitIcon, FolderIcon, PlusIcon, ScaleIcon } from "lucide-react";
169
import {
1710
type Ref,
1811
type MouseEvent as ReactMouseEvent,
@@ -72,8 +65,6 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
7265
import { MiddleTruncate } from "./ui/middle-truncate";
7366
import { ComposerSurface } from "./chat/ComposerSurface";
7467
import { useComposerMenuProps } from "./chat/composerEventScope";
75-
import { measureRestingComposerControls } from "./chat/restingComposerControlsMeasurement";
76-
import { resolveRestingComposerControlsNaturalWidth } from "./composerFooterLayout";
7768
import { cn } from "~/lib/utils";
7869
import { observeResize } from "~/lib/observeResize";
7970

@@ -107,8 +98,6 @@ interface BranchToolbarProps {
10798
onComposerFocusRequest?: () => void;
10899
availableEnvironments?: readonly EnvironmentOption[];
109100
onEnvironmentChange?: (environmentId: EnvironmentId) => void;
110-
composerControlsHostRef?: (element: HTMLDivElement | null) => void;
111-
contextStripVisible?: boolean;
112101
}
113102

114103
function showWorkspaceContextMenu(event: ReactMouseEvent, workspacePath: string) {
@@ -319,7 +308,6 @@ const RunContextSelector = memo(function RunContextSelector({
319308
].join(" ")}
320309
>
321310
{triggerContent}
322-
{!isPanel ? <ChevronDownIcon className="size-3 shrink-0 mx-0!" /> : null}
323311
</MenuTrigger>
324312
<MenuPopup
325313
align="start"
@@ -546,16 +534,7 @@ function useLabelsOverflow(): readonly [
546534
let groups = 0;
547535
for (const child of current.children) {
548536
if (!(child instanceof HTMLElement)) continue;
549-
// Reserve overflowed controls' width to prevent repeated hiding and expansion.
550-
const hostedControls = child.matches('[data-chat-resting-composer-controls-host="true"]')
551-
? child.querySelector<HTMLElement>('[data-chat-composer-resting-controls="true"]')
552-
: null;
553-
const hostedMeasurement = hostedControls
554-
? measureRestingComposerControls(hostedControls)
555-
: null;
556-
const width = hostedMeasurement
557-
? resolveRestingComposerControlsNaturalWidth(hostedMeasurement)
558-
: contentWidth(hostedControls ?? child);
537+
const width = contentWidth(child);
559538
if (width <= 1) continue;
560539
groups += 1;
561540
needed += width;
@@ -587,7 +566,6 @@ function useLabelsOverflow(): readonly [
587566
[
588567
current,
589568
...Array.from(current.children),
590-
...Array.from(current.querySelectorAll("[data-chat-composer-resting-controls='true']")),
591569
...Array.from(current.querySelectorAll(COMPOSER_CONTEXT_LABEL_SELECTOR)),
592570
],
593571
measure,
@@ -642,8 +620,6 @@ export const BranchToolbar = memo(function BranchToolbar({
642620
onComposerFocusRequest,
643621
availableEnvironments,
644622
onEnvironmentChange,
645-
composerControlsHostRef,
646-
contextStripVisible = true,
647623
}: BranchToolbarProps) {
648624
const branchSelectorRef = useRef<BranchToolbarBranchSelectorHandle>(null);
649625
const threadRef = scopeThreadRef(environmentId, threadId);
@@ -766,11 +742,7 @@ export const BranchToolbar = memo(function BranchToolbar({
766742
<ComposerSurface.ContextStrip
767743
ref={attachStrip}
768744
data-compact={labelsOverflow ? "" : undefined}
769-
className={cn(
770-
"gap-1 text-xs font-normal text-foreground/70 dark:text-muted-foreground",
771-
// Hide empty non-Git strips while retaining host width so controls can reappear as the chat grows.
772-
!contextStripVisible && "pointer-events-none invisible absolute inset-x-0 top-full",
773-
)}
745+
className={cn("gap-1 text-xs font-normal text-foreground/70 dark:text-muted-foreground")}
774746
>
775747
{showGitControls ? (
776748
<div className="contents @3xl/composer-surface:hidden">
@@ -801,7 +773,7 @@ export const BranchToolbar = memo(function BranchToolbar({
801773
className={cn(
802774
"min-h-7 min-w-10 items-center gap-1 sm:min-h-6",
803775
showGitControls ? "hidden @3xl/composer-surface:flex" : "flex",
804-
composerControlsHostRef ? "shrink" : "flex-1",
776+
"flex-1",
805777
)}
806778
>
807779
{showEnvironmentIndicator && availableEnvironments && (
@@ -839,15 +811,6 @@ export const BranchToolbar = memo(function BranchToolbar({
839811
</div>
840812
) : null}
841813

842-
{composerControlsHostRef ? (
843-
<div
844-
ref={composerControlsHostRef}
845-
data-composer-context-control
846-
data-chat-resting-composer-controls-host="true"
847-
className="flex min-w-0 flex-1 items-center justify-start overflow-x-clip overflow-y-visible"
848-
/>
849-
) : null}
850-
851814
{showGitControls ? (
852815
<BranchToolbarBranchSelector
853816
forceNewWorktree={forceNewWorktree}

‎apps/web/src/components/BranchToolbarBranchSelector.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
type VcsRef,
1717
type ThreadId,
1818
} from "@t3tools/contracts";
19-
import { ChevronDownIcon, GitBranchIcon } from "lucide-react";
19+
import { GitBranchIcon } from "lucide-react";
2020
import {
2121
useDeferredValue,
2222
useEffect,
@@ -731,7 +731,6 @@ export function BranchToolbarBranchSelector({
731731
className="w-full"
732732
/>
733733
</ComposerContextLabel>
734-
{displayMode !== "panel" ? <ChevronDownIcon className="size-3 shrink-0" /> : null}
735734
</ComboboxTrigger>
736735
</span>
737736
{displayMode === "panel" && prNumber !== undefined && prUrl !== undefined ? (

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,6 @@ export default function ChatView(props: ChatViewProps) {
606606
const composerFilesRef = useRef<ComposerFileAttachment[]>([]);
607607
const composerTerminalContextsRef = useRef<TerminalContextDraft[]>([]);
608608
const branchToolbarRef = useRef<BranchToolbarHandle>(null);
609-
const [restingComposerControlsHost, setRestingComposerControlsHost] =
610-
useState<HTMLDivElement | null>(null);
611-
const [restingComposerControlsVisible, setRestingComposerControlsVisible] = useState(false);
612609
const citeAssistantText = (
613610
citation: AssistantCitation,
614611
sourceAnchor: AssistantCitationSourceAnchor,
@@ -1638,25 +1635,13 @@ export default function ChatView(props: ChatViewProps) {
16381635
providerSubagentModels,
16391636
reportedModelSelection,
16401637
);
1641-
const mountComposerContextStrip = shouldShowComposerContextStrip({
1642-
isDraftHeroState,
1643-
persistInActiveThreads: settings.persistComposerContextStrip,
1644-
hasActiveProject: activeProject !== null && !showProviderSubagentBar,
1645-
isGitRepo,
1646-
showEnvironmentIndicator: showComposerEnvironmentIndicator,
1647-
hostsRestingComposerControls: routeKind === "server",
1648-
});
16491638
const showComposerContextStrip = shouldShowComposerContextStrip({
16501639
isDraftHeroState,
16511640
persistInActiveThreads: settings.persistComposerContextStrip,
16521641
hasActiveProject: activeProject !== null && !showProviderSubagentBar,
16531642
isGitRepo,
16541643
showEnvironmentIndicator: showComposerEnvironmentIndicator,
1655-
hostsRestingComposerControls: routeKind === "server" && restingComposerControlsVisible,
16561644
});
1657-
const mountComposerModelStrip =
1658-
routeKind === "server" && !mountComposerContextStrip && !showProviderSubagentBar;
1659-
const showComposerModelStrip = mountComposerModelStrip && restingComposerControlsVisible;
16601645
const terminalShortcutLabelOptions = {
16611646
context: {
16621647
terminalFocus: true,
@@ -2130,21 +2115,10 @@ export default function ChatView(props: ChatViewProps) {
21302115
composerMounted: composerMountedRef.current,
21312116
composerReportedResting: composerRestingRef.current,
21322117
});
2133-
const modelStrip = composerOverlayElement?.querySelector<HTMLElement>(
2134-
'[data-composer-model-strip="true"]',
2135-
);
2136-
const restingOnlyHeight =
2137-
modelStrip && isResting
2138-
? Math.max(
2139-
0,
2140-
modelStrip.offsetHeight + Number.parseFloat(getComputedStyle(modelStrip).marginTop),
2141-
)
2142-
: 0;
21432118
const nextInset = resolveComposerTimelineInset({
21442119
currentInset: composerTimelineInsetRef.current,
21452120
overlayHeight: height,
21462121
isResting,
2147-
restingOnlyHeight,
21482122
});
21492123
if (composerTimelineInsetRef.current !== nextInset) {
21502124
composerTimelineInsetRef.current = nextInset;
@@ -2688,7 +2662,10 @@ export default function ChatView(props: ChatViewProps) {
26882662
canOverrideServerThreadEnvMode,
26892663
setPendingServerThreadEnvModeEntry,
26902664
setPendingServerThreadStartFromOriginByThreadId,
2691-
scheduleComposerFocus,
2665+
// A settings change from the compacted row keeps it compacted (focus would expand it).
2666+
scheduleComposerFocus: () => {
2667+
if (!composerRef.current?.isResting()) scheduleComposerFocus();
2668+
},
26922669
});
26932670
const { onResume, isResuming } = useComposerResume({
26942671
environmentId,
@@ -3364,9 +3341,7 @@ export default function ChatView(props: ChatViewProps) {
33643341
: undefined
33653342
}
33663343
>
3367-
<ComposerSurface.Shell
3368-
contextStrip={showComposerContextStrip || showComposerModelStrip}
3369-
>
3344+
<ComposerSurface.Shell contextRow={showComposerContextStrip}>
33703345
<ComposerSurface.Host
33713346
inert={queuedRunEdit.isSaving}
33723347
aria-busy={queuedRunEdit.isSaving}
@@ -3481,6 +3456,7 @@ export default function ChatView(props: ChatViewProps) {
34813456
activeEnvironmentUnavailable ? null : threadSyncPhase
34823457
}
34833458
runtimeMode={runtimeMode}
3459+
defaultRuntimeMode={defaultRuntimeMode}
34843460
interactionMode={interactionMode}
34853461
lockedProvider={modelPickerLockedProvider}
34863462
providerStatuses={providerStatuses as ServerProvider[]}
@@ -3506,12 +3482,6 @@ export default function ChatView(props: ChatViewProps) {
35063482
supportsPullRequests ? activeProjectRepository : null
35073483
}
35083484
threadPullRequests={(activeThreadShell ?? activeThread)?.pullRequests}
3509-
restingControlsHost={restingComposerControlsHost}
3510-
restingControlsHaveLeadingContext={
3511-
mountComposerContextStrip &&
3512-
(isGitRepo || showComposerEnvironmentIndicator)
3513-
}
3514-
onRestingControlsVisibilityChange={setRestingComposerControlsVisible}
35153485
getTimelineScrollableNode={getTimelineScrollableNodeStable}
35163486
isTimelineAtLogicalEnd={isTimelineAtLogicalEndStable}
35173487
timelineOverflows={timelineOverflows}
@@ -3567,24 +3537,7 @@ export default function ChatView(props: ChatViewProps) {
35673537
data-terminal-open={terminalUiState.terminalOpen ? "true" : undefined}
35683538
className="relative z-0"
35693539
>
3570-
{mountComposerModelStrip ? (
3571-
<ComposerSurface.ContextStrip
3572-
data-composer-model-strip="true"
3573-
aria-hidden={showComposerModelStrip ? undefined : true}
3574-
inert={showComposerModelStrip ? undefined : true}
3575-
className={cn(
3576-
"group-data-model-strip-transition/composer-surface:before:backdrop-blur-(--glass-blur) group-data-model-strip-transition/composer-surface:before:bg-(--chat-composer-glass-surface)/(--glass-opacity)",
3577-
!showComposerModelStrip &&
3578-
"pointer-events-none invisible absolute inset-x-0 top-full",
3579-
)}
3580-
>
3581-
<div
3582-
ref={setRestingComposerControlsHost}
3583-
className="min-w-0 flex-1"
3584-
/>
3585-
</ComposerSurface.ContextStrip>
3586-
) : null}
3587-
{mountComposerContextStrip && (
3540+
{showComposerContextStrip && (
35883541
<div className="pointer-events-auto">
35893542
<BranchToolbar
35903543
forceNewWorktree={multipleModelSelections !== null}
@@ -3625,8 +3578,6 @@ export default function ChatView(props: ChatViewProps) {
36253578
: undefined
36263579
}
36273580
availableEnvironments={logicalProjectEnvironments}
3628-
composerControlsHostRef={setRestingComposerControlsHost}
3629-
contextStripVisible={showComposerContextStrip}
36303581
/>
36313582
</div>
36323583
)}

0 commit comments

Comments
 (0)