Skip to content

Commit 96ca07e

Browse files
committed
🤖 Decompose chat controls for proper shrinking behavior
Removed ChatToggles wrapper and decomposed into individual components with explicit flex behavior: - ModelSelectorGroup: flex shrink (can compress) - ThinkingSliderGroup: flex shrink-0 (fixed width) - Context1MGroup: flex shrink-0 (fixed width) - Mode toggles: ml-auto (pushes to right) Each component now has: - data-component attribute for debugging - Explicit shrink behavior (shrink vs shrink-0) - Proper gap-x-3 spacing between items - gap-y-1 for wrapped rows This allows proper wrapping and compression on constrained viewports.
1 parent 613039c commit 96ca07e

File tree

1 file changed

+41
-32
lines changed

1 file changed

+41
-32
lines changed

src/components/ChatInput.tsx

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { createCommandToast, createErrorToast } from "./ChatInputToasts";
77
import { parseCommand } from "@/utils/slashCommands/parser";
88
import { usePersistedState, updatePersistedState } from "@/hooks/usePersistedState";
99
import { useMode } from "@/contexts/ModeContext";
10-
import { ChatToggles } from "./ChatToggles";
10+
import { ThinkingSliderComponent } from "./ThinkingSlider";
11+
import { Context1MCheckbox } from "./Context1MCheckbox";
1112
import { useSendMessageOptions } from "@/hooks/useSendMessageOptions";
1213
import { getModelKey, getInputKey } from "@/constants/storage";
1314
import {
@@ -746,37 +747,45 @@ export const ChatInput: React.FC<ChatInputProps> = ({
746747
Editing message ({formatKeybind(KEYBINDS.CANCEL_EDIT)} to cancel)
747748
</div>
748749
)}
749-
<div className="flex flex-wrap items-center gap-y-1">
750-
<ChatToggles modelString={preferredModel}>
751-
<div className="mr-3 flex items-center gap-1.5">
752-
<ModelSelector
753-
ref={modelSelectorRef}
754-
value={preferredModel}
755-
onChange={setPreferredModel}
756-
recentModels={recentModels}
757-
onComplete={() => inputRef.current?.focus()}
758-
/>
759-
<TooltipWrapper inline>
760-
<HelpIndicator>?</HelpIndicator>
761-
<Tooltip className="tooltip" align="left" width="wide">
762-
<strong>Click to edit</strong> or use{" "}
763-
{formatKeybind(KEYBINDS.OPEN_MODEL_SELECTOR)}
764-
<br />
765-
<br />
766-
<strong>Abbreviations:</strong>
767-
<br /><code>/model opus</code> - Claude Opus 4.1
768-
<br /><code>/model sonnet</code> - Claude Sonnet 4.5
769-
<br />
770-
<br />
771-
<strong>Full format:</strong>
772-
<br />
773-
<code>/model provider:model-name</code>
774-
<br />
775-
(e.g., <code>/model anthropic:claude-sonnet-4-5</code>)
776-
</Tooltip>
777-
</TooltipWrapper>
778-
</div>
779-
</ChatToggles>
750+
<div className="flex flex-wrap items-center gap-x-3 gap-y-1">
751+
{/* Model Selector */}
752+
<div className="flex shrink items-center gap-1.5" data-component="ModelSelectorGroup">
753+
<ModelSelector
754+
ref={modelSelectorRef}
755+
value={preferredModel}
756+
onChange={setPreferredModel}
757+
recentModels={recentModels}
758+
onComplete={() => inputRef.current?.focus()}
759+
/>
760+
<TooltipWrapper inline>
761+
<HelpIndicator>?</HelpIndicator>
762+
<Tooltip className="tooltip" align="left" width="wide">
763+
<strong>Click to edit</strong> or use {formatKeybind(KEYBINDS.OPEN_MODEL_SELECTOR)}
764+
<br />
765+
<br />
766+
<strong>Abbreviations:</strong>
767+
<br /><code>/model opus</code> - Claude Opus 4.1
768+
<br /><code>/model sonnet</code> - Claude Sonnet 4.5
769+
<br />
770+
<br />
771+
<strong>Full format:</strong>
772+
<br />
773+
<code>/model provider:model-name</code>
774+
<br />
775+
(e.g., <code>/model anthropic:claude-sonnet-4-5</code>)
776+
</Tooltip>
777+
</TooltipWrapper>
778+
</div>
779+
780+
{/* Thinking Slider */}
781+
<div className="flex shrink-0 items-center" data-component="ThinkingSliderGroup">
782+
<ThinkingSliderComponent modelString={preferredModel} />
783+
</div>
784+
785+
{/* Context 1M Checkbox */}
786+
<div className="flex shrink-0 items-center" data-component="Context1MGroup">
787+
<Context1MCheckbox modelString={preferredModel} />
788+
</div>
780789
<div className="max-@[700px]:hidden ml-auto flex items-center gap-1.5">
781790
<div
782791
className={cn(

0 commit comments

Comments
 (0)