GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Composer polish: focus ring, send/stop buttons, command menu, context meter, answer panel by juliusmarminge · Pull Request #3018 · pingdotgg/t3code Conversation
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
Bugbot Autofix prepared fixes for all 4 issues found in the latest run.
Or push these changes by commenting:
@cursor push f7cf8476ad
diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -808,8 +808,14 @@ if (entry) { return getProviderDisplayName(providerStatuses, entry.driver); } + const instanceEntry = providerInstanceEntries.find( + (e) => e.instanceId === activeThreadModelSelection.instanceId, + ); + if (instanceEntry) { + return instanceEntry.displayName; + } return formatProviderDisplayName(activeThreadModelSelection.instanceId); - }, [providerStatuses, activeThreadModelSelection]); + }, [providerStatuses, providerInstanceEntries, activeThreadModelSelection]); // ------------------------------------------------------------------ // Composer-local state diff --git a/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx b/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx --- a/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx +++ b/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx @@ -154,25 +154,29 @@ return ( <div className="px-4 py-3 sm:px-5"> - {prompt.questions.length > 1 ? ( - <div className="flex items-center gap-3"> + <div className="flex items-center gap-3"> + {prompt.questions.length > 1 ? ( <span className="flex h-5 items-center rounded-md bg-muted/60 px-1.5 text-[10px] font-medium tabular-nums text-muted-foreground/60"> {questionIndex + 1}/{prompt.questions.length} </span> - </div> - ) : null} - <p className="text-sm text-foreground/90">{activeQuestion.question}</p> + ) : null} + <span className="text-[11px] font-semibold tracking-widest text-muted-foreground/50 uppercase"> + {activeQuestion.header} + </span> + </div> + <p className="mt-1.5 text-sm text-foreground/90">{activeQuestion.question}</p> {activeQuestion.multiSelect ? ( <p className="mt-1 text-xs text-muted-foreground/65">Select one or more options.</p> ) : null} <div className="mt-3 space-y-1"> {activeQuestion.options.map((option, index) => { + const optimisticActiveForQuestion = + optimisticSingleSelect?.questionId === activeQuestion.id; const isOptimisticallySelected = - optimisticSingleSelect?.questionId === activeQuestion.id && - optimisticSingleSelect.optionLabel === option.label; - const isSelected = - isOptimisticallySelected || - (!customAnswerActive && progress.selectedOptionLabels.includes(option.label)); + optimisticActiveForQuestion && optimisticSingleSelect.optionLabel === option.label; + const isSelected = optimisticActiveForQuestion + ? isOptimisticallySelected + : !customAnswerActive && progress.selectedOptionLabels.includes(option.label); const shortcutKey = index < 9 ? index + 1 : null; const className = cn( "group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left transition-all duration-150", @@ -214,6 +218,13 @@ if (isResponding) return; handleOptionSelection(activeQuestion.id, option.label); }} + onKeyDown={(e) => { + if (isResponding) return; + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + handleOptionSelection(activeQuestion.id, option.label); + } + }} className={className} > {content}
You can send follow-ups to the cloud agent here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
🚀 Expo continuous deployment is ready!
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const isOptimisticallySelected = | ||
| optimisticSingleSelect?.questionId === activeQuestion.id && | ||
| optimisticSingleSelect.optionLabel === option.label; | ||
| const isSelected = | ||
| isOptimisticallySelected || | ||
| (!customAnswerActive && progress.selectedOptionLabels.includes(option.label)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Low chat/ComposerPendingUserInputPanel.tsx:170
When customAnswer becomes non-empty after an optimistic selection was made, the option continues to appear selected because isOptimisticallySelected at lines 170-172 doesn't check customAnswerActive. The stale optimistic state persists until manually cleared, incorrectly showing the option as selected when custom answers should take precedence.
const isOptimisticallySelected = - optimisticSingleSelect?.questionId === activeQuestion.id && - optimisticSingleSelect.optionLabel === option.label; + !customAnswerActive && + optimisticSingleSelect?.questionId === activeQuestion.id && + optimisticSingleSelect.optionLabel === option.label; const isSelected = isOptimisticallySelected || (!customAnswerActive && progress.selectedOptionLabels.includes(option.label));
In file @apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx around lines 170-175:
When `customAnswer` becomes non-empty after an optimistic selection was made, the option continues to appear selected because `isOptimisticallySelected` at lines 170-172 doesn't check `customAnswerActive`. The stale optimistic state persists until manually cleared, incorrectly showing the option as selected when custom answers should take precedence.
Evidence trail:
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx lines 153, 170-175 (isOptimisticallySelected bypasses customAnswerActive guard), lines 64-67 (optimisticSingleSelect state), lines 73-92 (useEffect cleanup only clears when customAnswer is empty per line 82), lines 103-117 (handleOptionSelection sets optimistic state)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| </button> | ||
| </> | ||
| ); | ||
| return ( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium chat/ComposerPendingUserInputPanel.tsx:207
Converting from <button> to <div role="button"> removes native keyboard activation. A real <button> automatically responds to Enter and Space key presses, but a <div role="button"> does not handle these keyboard events. Users who navigate via keyboard can focus these elements (via tabIndex={0}) but pressing Enter or Space will do nothing, breaking accessibility. The existing keyboard handler (lines 122-147) only handles number keys 1-9, not the standard button activation keys.
In file @apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx around line 207:
Converting from `<button>` to `<div role="button">` removes native keyboard activation. A real `<button>` automatically responds to Enter and Space key presses, but a `<div role="button">` does not handle these keyboard events. Users who navigate via keyboard can focus these elements (via `tabIndex={0}`) but pressing Enter or Space will do nothing, breaking accessibility. The existing keyboard handler (lines 122-147) only handles number keys 1-9, not the standard button activation keys.
Evidence trail:
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx lines 207-221 (div with role='button', tabIndex, onClick but no onKeyDown/onKeyPress handler), lines 122-147 (global keydown handler only handles digit keys 1-9, not Enter/Space)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
ApprovabilityVerdict: Needs human review 2 blocking correctness issues found. This PR introduces new keyboard interception behavior beyond pure styling changes, and has unresolved medium-severity review comments identifying accessibility regressions (keyboard activation broken on converted buttons) and potential bugs in the type-to-focus feature. You can customize Macroscope's approvability policy. Learn more. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
238e64e to
cd4ba11
Compare
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 5 total unresolved issues (including 4 from previous reviews).
Bugbot Autofix prepared a fix for the issue found in the latest run.
Or push these changes by commenting:
@cursor push 08f769c4b5
diff --git a/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx b/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx --- a/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx +++ b/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx @@ -79,7 +79,7 @@ return; } if ( - progress.customAnswer.trim().length === 0 && + progress.customAnswer.trim().length > 0 || progress.selectedOptionLabels.includes(optimisticSingleSelect.optionLabel) ) { setOptimisticSingleSelect(null); @@ -171,8 +171,8 @@ optimisticSingleSelect?.questionId === activeQuestion.id && optimisticSingleSelect.optionLabel === option.label; const isSelected = - isOptimisticallySelected || - (!customAnswerActive && progress.selectedOptionLabels.includes(option.label)); + !customAnswerActive && + (isOptimisticallySelected || progress.selectedOptionLabels.includes(option.label)); const shortcutKey = index < 9 ? index + 1 : null; const className = cn( "group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left transition-all duration-150",
You can send follow-ups to the cloud agent here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
3a6bfe0 to
aa7db25
Compare
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
Or push these changes by commenting:
@cursor push 59a73e6ae4
diff --git a/apps/web/src/components/ChatView.browser.tsx b/apps/web/src/components/ChatView.browser.tsx --- a/apps/web/src/components/ChatView.browser.tsx +++ b/apps/web/src/components/ChatView.browser.tsx @@ -1416,13 +1416,15 @@ return waitForElement(() => findButtonByText(text), `Unable to find "${text}" button.`); } -function findButtonContainingText(text: string): HTMLButtonElement | null { - return (Array.from(document.querySelectorAll("button")).find((button) => - button.textContent?.includes(text), - ) ?? null) as HTMLButtonElement | null; +function findButtonContainingText(text: string): HTMLElement | null { + return ( + Array.from(document.querySelectorAll<HTMLElement>('button, [role="button"]')).find((button) => + button.textContent?.includes(text), + ) ?? null + ); } -async function waitForButtonContainingText(text: string): Promise<HTMLButtonElement> { +async function waitForButtonContainingText(text: string): Promise<HTMLElement> { return waitForElement( () => findButtonContainingText(text), `Unable to find button containing "${text}".`, diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -86,6 +86,7 @@ BotIcon, CircleAlertIcon, ListTodoIcon, + PencilRulerIcon, type LucideIcon, LockIcon, LockOpenIcon, @@ -96,6 +97,7 @@ import { getProviderInteractionModeToggle } from "../../providerModels"; import { deriveProviderInstanceEntries, + getProviderInstanceEntry, resolveProviderDriverKindForInstanceSelection, sortProviderInstanceEntries, type ProviderInstanceEntry, @@ -195,37 +197,45 @@ ? `Hide ${props.planSidebarLabel.toLowerCase()} sidebar` : `Show ${props.planSidebarLabel.toLowerCase()} sidebar`; + const interactionModeToggle = props.showInteractionModeToggle ? ( + <> + <Separator orientation="vertical" className="mx-0.5 hidden h-4 sm:block" /> + <Tooltip> + <TooltipTrigger + render={ + <Button + variant="ghost" + className={cn( + "shrink-0 whitespace-nowrap px-2 sm:px-3", + props.interactionMode === "plan" + ? "bg-blue-500/10 text-blue-400 hover:bg-blue-500/15 hover:text-blue-300" + : "text-muted-foreground/70 hover:text-foreground/80", + )} + size="sm" + type="button" + onClick={props.onToggleInteractionMode} + aria-label={interactionModeTooltip} + /> + } + > + {props.interactionMode === "plan" ? ( + <PencilRulerIcon className="text-current opacity-100" /> + ) : ( + <BotIcon /> + )} + <span className="sr-only sm:not-sr-only"> + {props.interactionMode === "plan" ? "Plan" : "Build"} + </span> + </TooltipTrigger> + <TooltipPopup side="top">{interactionModeTooltip}</TooltipPopup> + </Tooltip> + </> + ) : null; + return ( <> <Separator orientation="vertical" className="mx-0.5 hidden h-4 sm:block" /> - {props.showInteractionModeToggle ? ( - <> - <Tooltip> - <TooltipTrigger - render={ - <Button - variant="ghost" - className="shrink-0 whitespace-nowrap px-2 text-muted-foreground/70 hover:text-foreground/80 sm:px-3" - size="sm" - type="button" - onClick={props.onToggleInteractionMode} - aria-label={interactionModeTooltip} - /> - } - > - <BotIcon /> - <span className="sr-only sm:not-sr-only"> - {props.interactionMode === "plan" ? "Plan" : "Build"} - </span> - </TooltipTrigger> - <TooltipPopup side="top">{interactionModeTooltip}</TooltipPopup> - </Tooltip> - - <Separator orientation="vertical" className="mx-0.5 hidden h-4 sm:block" /> - </> - ) : null} - <Tooltip> <Select value={props.runtimeMode} @@ -267,6 +277,8 @@ <TooltipPopup side="top">{runtimeModeOption.description}</TooltipPopup> </Tooltip> + {interactionModeToggle} + {props.showPlanToggle ? ( <> <Separator orientation="vertical" className="mx-0.5 hidden h-4 sm:block" /> @@ -278,7 +290,7 @@ className={cn( "shrink-0 whitespace-nowrap px-2 sm:px-3", props.planSidebarOpen - ? "text-blue-400 hover:text-blue-300" + ? "bg-blue-500/10 text-blue-400 hover:bg-blue-500/15 hover:text-blue-300" : "text-muted-foreground/70 hover:text-foreground/80", )} size="sm" @@ -288,7 +300,9 @@ /> } > - <ListTodoIcon /> + <ListTodoIcon + className={props.planSidebarOpen ? "text-current opacity-100" : undefined} + /> <span className="sr-only sm:not-sr-only">{props.planSidebarLabel}</span> </TooltipTrigger> <TooltipPopup side="top">{planSidebarTooltip}</TooltipPopup> @@ -302,6 +316,7 @@ const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryActions(props: { compact: boolean; activeContextWindow: ReturnType<typeof deriveLatestContextWindowSnapshot>; + activeThreadProviderDisplayName: string | null; isPreparingWorktree: boolean; pendingAction: { questionIndex: number; @@ -324,7 +339,12 @@ }) { return ( <> - {props.activeContextWindow ? <ContextWindowMeter usage={props.activeContextWindow} /> : null} + {props.activeContextWindow ? ( + <ContextWindowMeter + usage={props.activeContextWindow} + providerDisplayName={props.activeThreadProviderDisplayName} + /> + ) : null} {props.isPreparingWorktree ? ( <span className="text-muted-foreground/70 text-xs">Preparing worktree...</span> ) : null} @@ -799,6 +819,11 @@ () => deriveLatestContextWindowSnapshot(activeThreadActivities ?? []), [activeThreadActivities], ); + const activeThreadProviderDisplayName = useMemo(() => { + if (!activeThreadModelSelection) return null; + const entry = getProviderInstanceEntry(providerStatuses, activeThreadModelSelection.instanceId); + return entry?.displayName ?? null; + }, [providerStatuses, activeThreadModelSelection]); // ------------------------------------------------------------------ // Composer-local state @@ -2153,7 +2178,7 @@ )} > {composerMenuOpen && !isComposerApprovalState && ( - <div className="absolute inset-x-0 bottom-full z-20 mb-2 px-1"> + <div className="absolute inset-x-0 bottom-full z-20 mb-2"> <ComposerCommandMenu items={composerMenuItems} resolvedTheme={resolvedTheme} @@ -2325,6 +2350,7 @@ data-chat-composer-footer-compact={isComposerFooterCompact ? "true" : "false"} className={cn( "flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-2.5 pb-2.5 sm:px-3 sm:pb-3", + pendingUserInputs.length > 0 && "pt-2", isComposerFooterCompact ? "gap-1.5" : "gap-2 sm:gap-0", showMobilePendingAnswerActions && "hidden sm:flex", )} @@ -2400,6 +2426,7 @@ <ComposerFooterPrimaryActions compact={isComposerPrimaryActionsCompact} activeContextWindow={activeContextWindow} + activeThreadProviderDisplayName={activeThreadProviderDisplayName} pendingAction={pendingPrimaryAction} isRunning={phase === "running"} showPlanFollowUpPrompt={pendingUserInputs.length === 0 && showPlanFollowUpPrompt} diff --git a/apps/web/src/components/chat/ComposerCommandMenu.tsx b/apps/web/src/components/chat/ComposerCommandMenu.tsx --- a/apps/web/src/components/chat/ComposerCommandMenu.tsx +++ b/apps/web/src/components/chat/ComposerCommandMenu.tsx @@ -141,34 +141,35 @@ > <div ref={listRef} - className="relative overflow-hidden rounded-xl border border-border/80 bg-popover/96 shadow-lg/8 backdrop-blur-xs" + className="relative w-full overflow-hidden rounded-[20px] border border-border/80 bg-popover/96 shadow-lg/8 backdrop-blur-xs" > - <CommandList className="max-h-72"> - {groups.map((group, groupIndex) => ( - <div key={group.id}> - {groupIndex > 0 ? <CommandSeparator className="my-0.5" /> : null} - <CommandGroup> - {group.label ? ( - <CommandGroupLabel className="px-3 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/55"> - {group.label} - </CommandGroupLabel> - ) : null} - {group.items.map((item) => ( - <ComposerCommandMenuItem - key={item.id} - item={item} - resolvedTheme={props.resolvedTheme} - isActive={props.activeItemId === item.id} - onHighlight={props.onHighlightedItemChange} - onSelect={props.onSelect} - /> - ))} - </CommandGroup> - </div> - ))} - </CommandList> - {props.items.length === 0 ? ( - <div className="px-3 py-2"> + {props.items.length > 0 ? ( + <CommandList className="max-h-72"> + {groups.map((group, groupIndex) => ( + <div key={group.id}> + {groupIndex > 0 ? <CommandSeparator className="my-0.5" /> : null} + <CommandGroup> + {group.label ? ( + <CommandGroupLabel className="px-3 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/55"> + {group.label} + </CommandGroupLabel> + ) : null} + {group.items.map((item) => ( + <ComposerCommandMenuItem + key={item.id} + item={item} + resolvedTheme={props.resolvedTheme} + isActive={props.activeItemId === item.id} + onHighlight={props.onHighlightedItemChange} + onSelect={props.onSelect} + /> + ))} + </CommandGroup> + </div> + ))} + </CommandList> + ) : ( + <div className="px-5 py-3.5"> {props.triggerKind === "skill" ? ( <CommandGroup> <CommandGroupLabel className="px-0 pt-0 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/55"> @@ -192,7 +193,7 @@ </p> )} </div> - ) : null} + )} </div> </Command> ); diff --git a/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx b/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx --- a/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx +++ b/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx @@ -1,5 +1,5 @@ import { type ApprovalRequestId } from "@t3tools/contracts"; -import { memo, useEffect, useEffectEvent, useRef } from "react"; +import { memo, useEffect, useEffectEvent, useRef, useState } from "react"; import { type PendingUserInput } from "../../session-logic"; import { derivePendingUserInputProgress, @@ -61,11 +61,36 @@ const activeQuestion = progress.activeQuestion; const autoAdvanceTimerRef = useRef<number | null>(null); const onAdvanceRef = useRef(onAdvance); + const [optimisticSingleSelect, setOptimisticSingleSelect] = useState<{ + questionId: string; + optionLabel: string; + } | null>(null); useEffect(() => { onAdvanceRef.current = onAdvance; }, [onAdvance]); + useEffect(() => { + if (!activeQuestion || activeQuestion.multiSelect || !optimisticSingleSelect) { + return; + } + if (optimisticSingleSelect.questionId !== activeQuestion.id) { + setOptimisticSingleSelect(null); + return; + } + if ( + progress.customAnswer.trim().length === 0 && + progress.selectedOptionLabels.includes(optimisticSingleSelect.optionLabel) + ) { + setOptimisticSingleSelect(null); + } + }, [ + activeQuestion, + optimisticSingleSelect, + progress.customAnswer, + progress.selectedOptionLabels, + ]); + // Clear auto-advance timer on unmount useEffect(() => { return () => { @@ -76,10 +101,12 @@ }, []); const handleOptionSelection = useEffectEvent((questionId: string, optionLabel: string) => { - onToggleOption(questionId, optionLabel); if (activeQuestion?.multiSelect) { + onToggleOption(questionId, optionLabel); return; } + setOptimisticSingleSelect({ questionId, optionLabel }); + onToggleOption(questionId, optionLabel); if (autoAdvanceTimerRef.current !== null) { window.clearTimeout(autoAdvanceTimerRef.current); } @@ -123,65 +150,75 @@ return null; } + const customAnswerActive = progress.customAnswer.trim().length > 0; + return ( <div className="px-4 py-3 sm:px-5"> - <div className="flex items-center gap-3"> - <div className="flex items-center gap-2"> - {prompt.questions.length > 1 ? ( - <span className="flex h-5 items-center rounded-md bg-muted/60 px-1.5 text-[10px] font-medium tabular-nums text-muted-foreground/60"> - {questionIndex + 1}/{prompt.questions.length} - </span> - ) : null} - <span className="text-[11px] font-semibold tracking-widest text-muted-foreground/50 uppercase"> - {activeQuestion.header} + {prompt.questions.length > 1 ? ( + <div className="flex items-center gap-3"> + <span className="flex h-5 items-center rounded-md bg-muted/60 px-1.5 text-[10px] font-medium tabular-nums text-muted-foreground/60"> + {questionIndex + 1}/{prompt.questions.length} </span> </div> - </div> - <p className="mt-1.5 text-sm text-foreground/90">{activeQuestion.question}</p> + ) : null} + <p className="text-sm text-foreground/90">{activeQuestion.question}</p> {activeQuestion.multiSelect ? ( <p className="mt-1 text-xs text-muted-foreground/65">Select one or more options.</p> ) : null} <div className="mt-3 space-y-1"> {activeQuestion.options.map((option, index) => { - const isSelected = progress.selectedOptionLabels.includes(option.label); + const isOptimisticallySelected = + optimisticSingleSelect?.questionId === activeQuestion.id && + optimisticSingleSelect.optionLabel === option.label; + const isSelected = + isOptimisticallySelected || + (!customAnswerActive && progress.selectedOptionLabels.includes(option.label)); const shortcutKey = index < 9 ? index + 1 : null; - return ( - <button - key={`${activeQuestion.id}:${option.label}`} - type="button" - disabled={isResponding} - onClick={() => handleOptionSelection(activeQuestion.id, option.label)} - className={cn( - "group flex w-full items-center gap-3 rounded-lg border px-3 py-2 text-left transition-all duration-150", - isSelected - ? "border-blue-500/40 bg-blue-500/8 text-foreground" - : "border-transparent bg-muted/20 text-foreground/80 hover:bg-muted/40 hover:border-border/40", - isResponding && "opacity-50 cursor-not-allowed", - )} - > - {shortcutKey !== null ? ( + const className = cn( + "group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left transition-all duration-150", + isSelected + ? "bg-blue-500/10 text-foreground" + : "bg-background dark:bg-input/32 text-foreground/85 hover:bg-muted/60 dark:hover:bg-input/45", + isResponding && "opacity-50 cursor-not-allowed", + !isResponding && "cursor-pointer", + ); + const content = ( + <> + <div className="min-w-0 flex-1 flex flex-col gap-0.5"> + <span className="text-sm font-medium">{option.label}</span> + {option.description && option.description !== option.label ? ( + <span className="text-xs text-muted-foreground/50">{option.description}</span> + ) : null} + </div> + {isSelected ? ( + <CheckIcon className="size-3.5 shrink-0 text-blue-400" /> + ) : shortcutKey !== null ? ( <kbd className={cn( - "flex size-5 shrink-0 items-center justify-center rounded text-[11px] font-medium tabular-nums transition-colors duration-150", - isSelected - ? "bg-blue-500/20 text-blue-400" - : "bg-muted/40 text-muted-foreground/50 group-hover:bg-muted/60 group-hover:text-muted-foreground/70", + "flex size-5 shrink-0 items-center justify-center rounded border border-border/70 text-[11px] font-medium tabular-nums transition-colors duration-150", + "bg-muted text-foreground group-hover:bg-muted/80", )} > {shortcutKey} </kbd> ) : null} - <div className="min-w-0 flex-1"> - <span className="text-sm font-medium">{option.label}</span> - {option.description && option.description !== option.label ? ( - <span className="ml-2 text-xs text-muted-foreground/50"> - {option.description} - </span> - ) : null} - </div> - {isSelected ? <CheckIcon className="size-3.5 shrink-0 text-blue-400" /> : null} - </button> + </> ); + return ( + <div + key={`${activeQuestion.id}:${option.label}`} + role="button" + tabIndex={isResponding ? -1 : 0} + aria-disabled={isResponding} + onClick={() => { + if (isResponding) return; + handleOptionSelection(activeQuestion.id, option.label); + }} + className={className} + > + {content} + </div> + ); })} </div> </div> diff --git a/apps/web/src/components/chat/ComposerPrimaryActions.tsx b/apps/web/src/components/chat/ComposerPrimaryActions.tsx --- a/apps/web/src/components/chat/ComposerPrimaryActions.tsx +++ b/apps/web/src/components/chat/ComposerPrimaryActions.tsx @@ -3,6 +3,7 @@ import { cn } from "~/lib/utils"; import { Button } from "../ui/button"; import { Menu, MenuItem, MenuPopup, MenuTrigger } from "../ui/menu"; +import { Spinner } from "../ui/spinner"; interface PendingActionState { questionIndex: number; @@ -126,7 +127,7 @@ return ( <button type="button" - className="flex size-8 cursor-pointer items-center justify-center rounded-full bg-rose-500/90 text-white transition-all duration-150 hover:bg-rose-500 hover:scale-105 sm:h-8 sm:w-8" + className="flex size-8 cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-all duration-150 hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none sm:h-8 sm:w-8" {...pointerFocusProps} onClick={onInterrupt} aria-label="Stop generation" @@ -195,7 +196,7 @@ return ( <button type="submit" - className="flex h-9 w-9 enabled:cursor-pointer items-center justify-center rounded-full bg-primary/90 text-primary-foreground transition-all duration-150 hover:bg-primary hover:scale-105 disabled:pointer-events-none disabled:opacity-30 disabled:hover:scale-100 sm:h-8 sm:w-8" + className="flex h-9 w-9 enabled:cursor-pointer items-center justify-center rounded-full bg-primary/90 text-primary-foreground shadow-xs enabled:shadow-primary/24 enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] transition-all duration-150 hover:bg-primary hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-30 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8" {...pointerFocusProps} disabled={isSendBusy || isConnecting || isEnvironmentUnavailable || !hasSendableContent} aria-label={ @@ -211,24 +212,7 @@ } > {isConnecting || isSendBusy ? ( - <svg - width="14" - height="14" - viewBox="0 0 14 14" - fill="none" - className="animate-spin" - aria-hidden="true" - > - <circle - cx="7" - cy="7" - r="5.5" - stroke="currentColor" - strokeWidth="1.5" - strokeLinecap="round" - strokeDasharray="20 12" - /> - </svg> + <Spinner className="size-3.5" aria-hidden="true" /> ) : ( <svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"> <path diff --git a/apps/web/src/components/chat/ContextWindowMeter.tsx b/apps/web/src/components/chat/ContextWindowMeter.tsx --- a/apps/web/src/components/chat/ContextWindowMeter.tsx +++ b/apps/web/src/components/chat/ContextWindowMeter.tsx @@ -12,13 +12,20 @@ return `${Math.round(value)}%`; } -export function ContextWindowMeter(props: { usage: ContextWindowSnapshot }) { - const { usage } = props; +export function ContextWindowMeter(props: { + usage: ContextWindowSnapshot; + providerDisplayName?: string | null; +}) { + const { usage, providerDisplayName } = props; const usedPercentage = formatPercentage(usage.usedPercentage); const normalizedPercentage = Math.max(0, Math.min(100, usage.usedPercentage ?? 0)); const radius = 9.75; const circumference = 2 * Math.PI * radius; const dashOffset = circumference - (normalizedPercentage / 100) * circumference; + const totalProcessedTokens = usage.totalProcessedTokens ?? null; + const showTotalProcessed = totalProcessedTokens !== null && totalProcessedTokens > 0; + const isOverloaded = normalizedPercentage > 90; + const usageColor = isOverloaded ? "var(--color-red-500)" : "var(--color-blue-500)"; return ( <Popover> @@ -29,17 +36,21 @@ render={ <button type="button" - className="group inline-flex items-center justify-center rounded-full transition-opacity hover:opacity-85" + className={cn( + "inline-flex size-6 cursor-pointer items-center justify-center rounded-full border border-transparent text-muted-foreground outline-none transition-colors", + "hover:bg-accent data-[pressed]:bg-accent", + "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background", + )} aria-label={ usage.maxTokens !== null && usedPercentage ? `Context window ${usedPercentage} used` : `Context window ${formatContextWindowTokens(usage.usedTokens)} tokens used` } > - <span className="relative flex h-6 w-6 items-center justify-center"> + <span className="relative flex size-4 items-center justify-center"> <svg viewBox="0 0 24 24" - className="-rotate-90 absolute inset-0 h-full w-full transform-gpu" + className="-rotate-90 absolute inset-0 size-full transform-gpu" aria-hidden="true" > <circle @@ -47,7 +58,7 @@ cy="12" r={radius} fill="none" - stroke="color-mix(in oklab, var(--color-muted) 70%, transparent)" + stroke="color-mix(in oklab, var(--color-muted-foreground) 35%, transparent)" strokeWidth="3" /> <circle @@ -55,7 +66,7 @@ cy="12" r={radius} fill="none" - stroke="var(--color-muted-foreground)" + stroke={usageColor} strokeWidth="3" strokeLinecap="round" strokeDasharray={circumference} @@ -63,48 +74,55 @@ className="transition-[stroke-dashoffset] duration-500 ease-out motion-reduce:transition-none" /> </svg> - <span - className={cn( - "relative flex h-[15px] w-[15px] items-center justify-center rounded-full bg-background text-[8px] font-medium", - "text-muted-foreground", - )} - > - {usage.usedPercentage !== null - ? Math.round(usage.usedPercentage) - : formatContextWindowTokens(usage.usedTokens)} - </span> </span> </button> } /> - <PopoverPopup tooltipStyle side="top" align="end" className="w-max max-w-none px-3 py-2"> - <div className="space-y-1.5 leading-tight"> - <div className="text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground"> - Context window + <PopoverPopup tooltipStyle side="top" align="end" className="w-64 max-w-none p-0"> + <div className="flex flex-col gap-2 p-3"> + <div className="flex items-center justify-between gap-3"> + <div className="font-medium text-muted-foreground text-xs">Context Window</div> + {usage.maxTokens !== null && usedPercentage ? ( + <div className="text-[11px] tabular-nums text-muted-foreground/70"> + <span>{usedPercentage}</span> + <span className="mx-1">·</span> + <span> + {formatContextWindowTokens(usage.usedTokens)}/ + {formatContextWindowTokens(usage.maxTokens ?? null)} + </span> + </div> + ) : ( + <div className="text-[11px] tabular-nums text-muted-foreground/70"> + {formatContextWindowTokens(usage.usedTokens)} + </div> + )} </div> - {usage.maxTokens !== null && usedPercentage ? ( - <div className="whitespace-nowrap text-xs font-medium text-foreground"> - <span>{usedPercentage}</span> - <span className="mx-1">⋅</span> - <span>{formatContextWindowTokens(usage.usedTokens)}</span> - <span>/</span> - <span>{formatContextWindowTokens(usage.maxTokens ?? null)} context used</span> + {usage.maxTokens !== null ? ( + <div + className="h-1.5 w-full overflow-hidden rounded-full bg-muted/60" + role="progressbar" + aria-valuemin={0} + aria-valuemax={100} + aria-valuenow={Math.round(normalizedPercentage)} + aria-label="Context window usage" + > + <div + className="h-full rounded-full transition-[width,background-color] duration-500 ease-out motion-reduce:transition-none" + style={{ width: `${normalizedPercentage}%`, backgroundColor: usageColor }} + /> </div> - ) : ( - <div className="text-sm text-foreground"> - {formatContextWindowTokens(usage.usedTokens)} tokens used so far - </div> - )} - {(usage.totalProcessedTokens ?? null) !== null && - (usage.totalProcessedTokens ?? 0) > usage.usedTokens ? ( - <div className="text-xs text-muted-foreground"> - Total processed: {formatContextWindowTokens(usage.totalProcessedTokens ?? null)}{" "} - tokens - </div> ) : null} - {usage.compactsAutomatically ? ( - <div className="text-xs text-muted-foreground"> - Automatically compacts its context when needed. + {showTotalProcessed || usage.compactsAutomatically ? ( + <div className="mt-2 text-pretty text-[11px] text-muted-foreground/70"> + {showTotalProcessed + ? `You have used ${formatContextWindowTokens(totalProcessedTokens)} tokens.` + : null} + {showTotalProcessed && usage.compactsAutomatically ? " " : null} + {usage.compactsAutomatically ? ( + <span className="font-medium"> + {providerDisplayName ?? "It"} automatically compacts its context when needed. + </span> + ) : null} </div> ) : null} </div> diff --git a/apps/web/src/components/chat/composerProviderState.test.tsx b/apps/web/src/components/chat/composerProviderState.test.tsx --- a/apps/web/src/components/chat/composerProviderState.test.tsx +++ b/apps/web/src/components/chat/composerProviderState.test.tsx @@ -56,7 +56,7 @@ const ULTRATHINK_FRAME_CLASSES = { composerFrameClassName: "ultrathink-frame", - composerSurfaceClassName: "shadow-[0_0_0_1px_rgba(255,255,255,0.04)_inset]", + composerSurfaceClassName: "shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]", modelPickerIconClassName: "ultrathink-chroma", } as const; diff --git a/apps/web/src/components/chat/composerProviderState.tsx b/apps/web/src/components/chat/composerProviderState.tsx --- a/apps/web/src/components/chat/composerProviderState.tsx +++ b/apps/web/src/components/chat/composerProviderState.tsx @@ -67,7 +67,7 @@ ...(ultrathinkActive ? { composerFrameClassName: "ultrathink-frame", - composerSurfaceClassName: "shadow-[0_0_0_1px_rgba(255,255,255,0.04)_inset]", + composerSurfaceClassName: "shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]", modelPickerIconClassName: "ultrathink-chroma", } : {}), diff --git a/apps/web/src/index.css b/apps/web/src/index.css --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -685,6 +685,7 @@ ); background-image: var(--ultrathink-spectrum); background-size: 220% 220%; + filter: saturate(0.82) brightness(0.92); animation: ultrathink-rainbow 10s linear infinite; }
You can send follow-ups to the cloud agent here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return trimmed.charAt(0).toUpperCase() + trimmed.slice(1); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Low Severity
New formatProviderDisplayName re-implements provider-to-label mapping already covered by PROVIDER_DISPLAY_NAMES, formatProviderDriverKindLabel, and getProviderDisplayName, and the composer fallback passes instanceId into a helper documented for driver kinds.
Reviewed by Cursor Bugbot for commit aa7db25371c063839ca2683f62f48fbfb0b1e8d5. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
16ea047 to
4ad961d
Compare
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix prepared a fix for the issue found in the latest run.
pendingUserInputs.length > 0 guard from insertTextAtEnd; the downstream applyPromptReplacement already correctly routes pending user input text through onChangeActivePendingUserInputCustomAnswer.Or push these changes by commenting:
@cursor push b00c1115ff
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 4ad961d. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return false; | ||
| } | ||
| const rangeEnd = promptRef.current.length; | ||
| return applyPromptReplacement(rangeEnd, rangeEnd, text); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Medium Severity
New type-to-focus calls insertTextAtEnd, but that handle returns false whenever pendingUserInputs.length > 0. During pending user-input prompts the composer still accepts free-text answers via applyPromptReplacement, so printable keys from the page background never reach the draft and custom responses cannot be started without clicking the editor first.
Reviewed by Cursor Bugbot for commit 4ad961d. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4ad961d to
4d8e88c
Compare
…nu, context meter, answer panel Ported from #2451. Co-authored-by: ss <[email protected]> Co-Authored-By: Claude Opus 4.8 <[email protected]> Co-authored-by: codex <[email protected]>
4d8e88c to
f59dbf2
Compare
| '[contenteditable="true"]', | ||
| '[contenteditable="plaintext-only"]', |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium components/ChatView.tsx:210
The selector [contenteditable="true"] does not match elements where the attribute is set as contenteditable="" or as the bare boolean attribute contenteditable (no value), both of which are valid HTML equivalents of contenteditable="true". When a user types inside such an element, target?.closest(...) fails to match it, so shouldTypeToFocusComposer returns true and redirects keystrokes to the composer instead of letting them reach the contenteditable element. Replacing the two contenteditable selectors with [contenteditable]:not([contenteditable="false"]) covers all truthy forms in one selector.
| '[contenteditable="true"]', | |
| '[contenteditable="plaintext-only"]', | |
| '[contenteditable]:not([contenteditable="false"])', |
In file @apps/web/src/components/ChatView.tsx around lines 210-211:
The selector `[contenteditable="true"]` does not match elements where the attribute is set as `contenteditable=""` or as the bare boolean attribute `contenteditable` (no value), both of which are valid HTML equivalents of `contenteditable="true"`. When a user types inside such an element, `target?.closest(...)` fails to match it, so `shouldTypeToFocusComposer` returns `true` and redirects keystrokes to the composer instead of letting them reach the contenteditable element. Replacing the two contenteditable selectors with `[contenteditable]:not([contenteditable="false"])` covers all truthy forms in one selector.
Evidence trail:
apps/web/src/components/ChatView.tsx lines 206-213 (the TYPE_TO_FOCUS_EDITABLE_SELECTOR with `[contenteditable="true"]`), apps/web/src/components/ChatView.tsx lines 249-259 (shouldTypeToFocusComposer function using the selector), apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx line 132 (same codebase using the more robust `[contenteditable]:not([contenteditable="false"])` pattern), HTML spec for contenteditable attribute (empty string = editable), CSS Selectors spec (attribute selectors match exact string values).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.