Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(ui): give the model picker a readable surface in the chat header

Lensf3134f53d7a2
diff --git a/src/components/ModelPicker.simple.test.ts b/src/components/ModelPicker.simple.test.ts
index 0f3d83db7e..51876acc2c 100644
--- a/src/components/ModelPicker.simple.test.ts
+++ b/src/components/ModelPicker.simple.test.ts
@@ -382,6 +382,26 @@ describe("the model picker in Simple mode", () => {
expect(String(advanced.props.title)).toContain("High effort");
});
+ it("puts the header chip on an opaque surface, so scrolled transcript text cannot read through it", () => {
+ const classes = () => String(render(bot()).nodes.find((node) => node.props["data-tour"] === "model")!.props.className);
+ // bg-composer is a solid fill: the picker reads over any row that scrolls under the fading Simple header.
+ expect(classes().split(" ")).toEqual(expect.arrayContaining(["bg-composer", "ring-[0.5px]", "shadow-(--shadow-float)"]));
+ expect(classes()).not.toMatch(/hover:bg-ink|aria-expanded:bg-ink/);
+ fixture.advanced = true;
+ try {
+ expect(classes().split(" ")).toEqual(expect.arrayContaining(["bg-composer", "shadow-(--shadow-float)"]));
+ expect(classes()).not.toMatch(/hover:bg-ink|aria-expanded:bg-ink/);
+ } finally {
+ fixture.advanced = false;
+ }
+ });
+
+ it("leaves a contained picker on its settings row unchanged, with no floating surface", () => {
+ const chip = render(bot(), { contained: true }).nodes.find((node) => node.props["data-tour"] === "model")!;
+ expect(String(chip.props.className)).not.toContain("bg-composer");
+ expect(String(chip.props.className)).not.toContain("shadow-(--shadow-float)");
+ });
+
it("puts the provider before a model the catalog names in one bare word, on the chip and the current row", () => {
fixture.instances = [claude(), cursor];
const forBot = bot(undefined, "cursor", "auto");
diff --git a/src/components/ModelPicker.tsx b/src/components/ModelPicker.tsx
index 66e3616ba2..394af0f741 100644
--- a/src/components/ModelPicker.tsx
+++ b/src/components/ModelPicker.tsx
@@ -11,6 +11,7 @@ import { pickerPlacement, type PickerPlacement } from "@/lib/picker-placement";
import { isTypeaheadKey, TYPEAHEAD_RESET_MS, typeaheadMatch, typeaheadText, type Typeahead } from "@/lib/menu-keys";
import { usePopoverDismiss } from "@/hooks/use-popover-dismiss";
import { InstanceProviderMark } from "./ProviderIcons";
+import { ELEVATED_FLOAT, ELEVATED_HOVER } from "./elevated";
import { EngineSetup, EngineUpdateNotice, needsCli, needsSignIn } from "./EngineSetup";
import { ConfirmDialog } from "./ConfirmDialog";
import { ChatGptPlanStatus } from "./ChatGptPlanStatus";
@@ -722,11 +723,14 @@ export function ModelPicker({
<button
{...triggerProps}
className={cn(
- "flex items-center gap-1.5 rounded-full border-[0.5px] border-ink/10 py-1 pl-2 pr-2.5 text-[13px] text-ink hover:bg-ink/[0.06] aria-expanded:bg-ink/[0.08] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent",
+ "group flex items-center gap-1.5 rounded-full border-[0.5px] border-ink/10 py-1 pl-2 pr-2.5 text-[13px] text-ink disabled:cursor-not-allowed",
+ contained
+ ? "hover:bg-ink/[0.06] aria-expanded:bg-ink/[0.08] disabled:opacity-50 disabled:hover:bg-transparent"
+ : cn("bg-composer shadow-(--shadow-float) disabled:text-ink-tertiary disabled:hover:bg-composer", ELEVATED_HOVER),
!contained && active && !showActiveAccount && COMPACT_SQUARE,
)}
>
- {active && <InstanceProviderMark instance={active} size={14} />}
+ {active && <InstanceProviderMark instance={active} size={14} className="group-disabled:opacity-50" />}
{!contained && active && showActiveAccount && (
<span data-model-account-compact className="hidden max-w-20 truncate @max-4xl/chathead:inline">{active.displayName}</span>
)}
@@ -761,7 +765,10 @@ export function ModelPicker({
<button
{...triggerProps}
className={cn(
- "group flex shrink-0 items-center rounded-full text-[13px] leading-[18px] text-ink-secondary transition-colors duration-150 hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.08] aria-expanded:text-ink disabled:cursor-not-allowed disabled:text-ink-tertiary disabled:hover:bg-transparent",
+ "group flex shrink-0 items-center rounded-full text-[13px] leading-[18px] text-ink-secondary disabled:cursor-not-allowed disabled:text-ink-tertiary",
+ contained
+ ? "transition-colors duration-150 hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.08] aria-expanded:text-ink disabled:hover:bg-transparent"
+ : cn(ELEVATED_FLOAT, ELEVATED_HOVER, "hover:text-ink aria-expanded:text-ink"),
size === "sm" ? "h-7 pl-2 pr-1.5" : "h-8 pl-2.5 pr-2",
)}
>