From fb58d803e414e31ca1b2ad0113c9445e4886c913 Mon Sep 17 00:00:00 2001 From: AviPeltz Date: Tue, 6 Oct 2026 16:05:52 -0700 Subject: [PATCH 1/4] feat(desktop): redesign the chat composer model and mode pickers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The model picker is one panel instead of a submenu chain: an agent icon tab strip with an underline marker, a borderless search row, the grouped model list with mod+digit hints and always-visible favorite stars, and an effort slider card in the footer (fast toggle, current level, stepped track). Other agent settings stay as "Label … Value ›" rows; their submenus are portaled because the frosted panel's backdrop-filter would otherwise contain and clip them. The mode picker gets icon + title + description rows with the Full access icon in amber, and moves to the left of the composer footer with the model picker on the right. Pill triggers are transparent at rest, and the type scale moves to 13px rows / 12px triggers. The shared Slider primitive accepts track, range and thumb class names and track children so the effort card can draw step marks. --- .../components/Composer/Composer.tsx | 32 +-- .../components/ModePicker/ModePicker.tsx | 80 ++++--- .../components/ModelPicker/ModelPicker.tsx | 195 ++++++++--------- .../EffortSliderCard/EffortSliderCard.tsx | 98 +++++++++ .../components/EffortSliderCard/index.ts | 1 + .../components/ModelFlyout/index.ts | 1 - .../ModelPanel.tsx} | 207 +++++++++++------- .../components/ModelPanel/index.ts | 1 + .../components/Composer/constants.ts | 13 +- packages/ui/src/components/ui/slider.tsx | 20 +- 10 files changed, 405 insertions(+), 243 deletions(-) create mode 100644 apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/EffortSliderCard.tsx create mode 100644 apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/index.ts delete mode 100644 apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelFlyout/index.ts rename apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/{ModelFlyout/ModelFlyout.tsx => ModelPanel/ModelPanel.tsx} (50%) create mode 100644 apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelPanel/index.ts diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/Composer.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/Composer.tsx index e8c282dbeb3..6f87c0dc204 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/Composer.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/Composer.tsx @@ -253,22 +253,22 @@ export const Composer = memo(function Composer({ status={onCancelTurn ? "streaming" : "ready"} submitWhileStreaming={promptQueue !== undefined} toolbar={ -
- {configOptions && onSetConfigOption ? ( - - ) : null} - {modes && onSetMode ? ( - - ) : null} -
+ modes && onSetMode ? ( + + ) : undefined + } + toolbarEnd={ + configOptions && onSetConfigOption ? ( + + ) : undefined } /> diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModePicker/ModePicker.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModePicker/ModePicker.tsx index 649a6ad34a5..120f17e28aa 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModePicker/ModePicker.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModePicker/ModePicker.tsx @@ -15,12 +15,11 @@ import { Play, SlidersHorizontal, } from "lucide-react"; -import { useState } from "react"; import { LuCheck, LuChevronDown } from "react-icons/lu"; import { isUnrestrictedMode } from "../../../../utils/isUnrestrictedMode"; import { MENU_DESCRIPTION_CLASS, - MENU_ROW_CLASS, + MENU_PANEL_CLASS, PILL_CHEVRON_CLASS, PILL_TRIGGER_CLASS, } from "../../constants"; @@ -36,7 +35,7 @@ type ModeCopy = { const HIDDEN_MODE_IDS = new Set(["plan", "acceptEdits", "workspace-write"]); const SOLID_ICONS = new Set([Pause, Play, FastForward]); -const UNRESTRICTED_TINT = "text-amber-500 opacity-65"; +const UNRESTRICTED_TINT = "text-amber-500"; export function ModePicker({ currentModeId, @@ -48,7 +47,6 @@ export function ModePicker({ onSelect: (modeId: string) => void; }) { const { t } = useLingui(); - const [highlightedId, setHighlightedId] = useState(); const offeredModes = modes.filter((mode) => !HIDDEN_MODE_IDS.has(mode.id)); if (offeredModes.length < 2) return null; @@ -116,30 +114,28 @@ export function ModePicker({ const currentCopy = copyFor(current); const CurrentIcon = currentCopy.icon; - const iconProps = (copy: ModeCopy) => ({ + const iconProps = (copy: ModeCopy, className: string) => ({ className: cn( - "size-3.5 shrink-0", + "shrink-0 text-current", + className, SOLID_ICONS.has(copy.icon) && "fill-current", - copy.unrestricted && UNRESTRICTED_TINT, ), strokeWidth: SOLID_ICONS.has(copy.icon) ? 1 : 2, }); - const highlighted = - offeredModes.find((mode) => mode.id === highlightedId) ?? current; - const footer = copyFor(highlighted).description; return ( - { - if (!open) setHighlightedId(undefined); - }} - > + @@ -149,41 +145,53 @@ export function ModePicker({ aria-label={t({ message: "How should the agent's actions be approved?", })} - className="w-[210px] rounded-xl" + className={cn(MENU_PANEL_CLASS, "w-[300px] p-1.5")} side="top" > {offeredModes.map((mode) => { const copy = copyFor(mode); const Icon = copy.icon; + const selected = mode.id === current.id; return ( setHighlightedId(mode.id)} onSelect={() => { if (mode.id !== currentModeId) onSelect(mode.id); }} > - - {copy.title} - {mode.id === current.id ? ( - - ) : null} + + + + + {copy.title} + {copy.description ? ( + + {copy.description} + + ) : null} + + + {selected ? ( + + ) : null} + ); })} - {footer ? ( -
-
- {footer} -
-
- ) : null}
); diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx index f73ed61e74b..bc6a839dba0 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx @@ -1,9 +1,9 @@ -import { Trans } from "@lingui/react/macro"; import type { SessionConfigOption } from "@superset/chat/protocol"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, + DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, @@ -17,11 +17,13 @@ import { useIsDarkTheme, } from "renderer/assets/app-icons/preset-icons"; import { + MENU_PANEL_CLASS, MENU_ROW_CLASS, PILL_CHEVRON_CLASS, PILL_TRIGGER_CLASS, } from "../../constants"; -import { ModelFlyout } from "./components/ModelFlyout"; +import { EffortSliderCard } from "./components/EffortSliderCard"; +import { ModelPanel } from "./components/ModelPanel"; import type { AgentSwitcher } from "./types"; export type ModelPickerProps = { @@ -30,7 +32,10 @@ export type ModelPickerProps = { agentSwitcher?: AgentSwitcher; }; -const SUB_TRIGGER_CLASS = cn(MENU_ROW_CLASS, "h-9 text-[13px]"); +const TRAIT_ROW_CLASS = cn( + MENU_ROW_CLASS, + "[&>svg:last-child]:size-3 [&>svg:last-child]:text-muted-foreground/70", +); function isToggle(option: SessionConfigOption) { return ( @@ -66,15 +71,18 @@ export function ModelPicker({ option.category !== "mode" && option.options.length > 0, ); - const toggles = settings.filter(isToggle); - const selects = settings.filter((option) => !isToggle(option)); - const fastOn = toggles.some( - (option) => option.id === "fast" && option.currentValue === "on", + const fast = settings.find( + (option) => option.id === "fast" && isToggle(option), ); - const effortLabel = currentLabel( - settings.find((option) => option.category === "thought_level"), + const fastOn = fast?.currentValue === "on"; + const effort = settings.find((option) => option.category === "thought_level"); + const effortLabel = currentLabel(effort); + // The slider card owns effort and the fast toggle; the rest stay as rows. + const rows = settings.filter( + (option) => option !== effort && (effort ? option !== fast : true), ); if (!model && settings.length === 0 && !canSwitchAgent) return null; + const showsModels = Boolean(model) || canSwitchAgent; const currentAgentLabel = agentSwitcher?.agents.find( (agent) => agent.presetId === agentSwitcher.currentPresetId, )?.label; @@ -119,108 +127,81 @@ export function ModelPicker({ - {toggles.map((option) => { - const on = option.currentValue === "on"; - return ( - { - event.preventDefault(); - onSelect(option.id, on ? "off" : "on"); - }} - role="menuitemcheckbox" - > - {option.label} - - ); - })} - {selects.map((option) => ( - - - {option.label} - - {currentLabel(option)} - - - - {option.options.map((entry) => ( - pick(option, entry.id)} - title={entry.description} - > - {entry.label} - {entry.id === option.currentValue ? ( - - ) : null} - - ))} - - - ))} - {model || canSwitchAgent ? ( - - - - Model - - - {agentIcon ? ( - - ) : null} - - {currentLabel(model) ?? Default} - - - - - { - setOpen(false); - agentSwitcher.onSwitch(presetId, picked); - }, - } - } - model={model} - onPick={(modelId) => { - if (model) pick(model, modelId); - }} - searchRef={searchRef} + {showsModels ? ( + { + setOpen(false); + agentSwitcher.onSwitch(presetId, picked); + }, + } + } + model={model} + onPick={(modelId) => { + if (model) pick(model, modelId); + }} + searchRef={searchRef} + /> + ) : null} + {settings.length > 0 ? ( +
+ {effort ? ( + - - + ) : null} + {rows.map((option) => ( + + + + {option.label} + + + {currentLabel(option)} + + + {/* Portaled: the panel's backdrop-blur would otherwise contain and clip it. */} + + + {option.options.map((entry) => ( + pick(option, entry.id)} + title={entry.description} + > + + {entry.label} + + {entry.id === option.currentValue ? ( + + ) : null} + + ))} + + + + ))} +
) : null}
diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/EffortSliderCard.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/EffortSliderCard.tsx new file mode 100644 index 00000000000..ac0c5c76a66 --- /dev/null +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/EffortSliderCard.tsx @@ -0,0 +1,98 @@ +import type { SessionConfigOption } from "@superset/chat/protocol"; +import { Slider } from "@superset/ui/slider"; +import { cn } from "@superset/ui/utils"; +import { LuZap } from "react-icons/lu"; + +const SNAP_MOTION_CLASS = + "transition-[left,right,width] duration-150 ease-[cubic-bezier(0.22,1.1,0.36,1)] motion-reduce:transition-none"; + +export function EffortSliderCard({ + effort, + fast, + onSelect, +}: { + effort: SessionConfigOption; + fast: SessionConfigOption | undefined; + onSelect: (configId: string, value: string) => void; +}) { + const levels = effort.options; + const lastIndex = Math.max(levels.length - 1, 0); + const index = Math.max( + levels.findIndex((level) => level.id === effort.currentValue), + 0, + ); + const fastOn = fast?.currentValue === "on"; + const marks = levels.map((_, i) => + lastIndex === 0 ? 0 : (i / lastIndex) * 100, + ); + + return ( +
+
+ {fast ? ( + + ) : ( +
+
+ { + const level = next === undefined ? undefined : levels[next]; + if (level && level.id !== effort.currentValue) { + onSelect(effort.id, level.id); + } + }} + rangeClassName={cn( + "rounded-full bg-amber-500", + SNAP_MOTION_CLASS, + index === 0 && "opacity-0", + )} + step={1} + thumbClassName={cn( + "size-7 cursor-grab border-0 bg-white shadow-[0_1px_2px_rgba(0,0,0,0.12),0_0_0_0.5px_rgba(0,0,0,0.05)] hover:ring-0 focus-visible:ring-2 focus-visible:ring-ring/40 active:cursor-grabbing", + SNAP_MOTION_CLASS, + )} + trackClassName="overflow-visible bg-foreground/[0.14] data-[orientation=horizontal]:h-6" + value={[index]} + > + +
+
+ ); +} diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/index.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/index.ts new file mode 100644 index 00000000000..dd7f8ddd868 --- /dev/null +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/index.ts @@ -0,0 +1 @@ +export { EffortSliderCard } from "./EffortSliderCard"; diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelFlyout/index.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelFlyout/index.ts deleted file mode 100644 index 1c2e70fdb3c..00000000000 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelFlyout/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { ModelFlyout } from "./ModelFlyout"; diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelFlyout/ModelFlyout.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelPanel/ModelPanel.tsx similarity index 50% rename from apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelFlyout/ModelFlyout.tsx rename to apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelPanel/ModelPanel.tsx index fe0c559d55f..8850159635e 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelFlyout/ModelFlyout.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelPanel/ModelPanel.tsx @@ -2,13 +2,19 @@ import { useLingui } from "@lingui/react/macro"; import type { SessionConfigOption } from "@superset/chat/protocol"; import { DropdownMenuItem } from "@superset/ui/dropdown-menu"; import { cn } from "@superset/ui/utils"; -import { type RefObject, useEffect, useRef, useState } from "react"; +import { + type KeyboardEvent, + type RefObject, + useEffect, + useRef, + useState, +} from "react"; import { LuCheck, LuSearch, LuStar } from "react-icons/lu"; import { getPresetIcon, useIsDarkTheme, } from "renderer/assets/app-icons/preset-icons"; -import { MENU_LABEL_CLASS, MENU_ROW_CLASS } from "../../../../constants"; +import { MENU_ROW_CLASS } from "../../../../constants"; import { useFavoriteModels } from "../../hooks/useFavoriteModels"; import type { AgentSwitcher } from "../../types"; @@ -21,8 +27,14 @@ type Row = { }; const FAVORITES_TAB = "favorites"; +const SHORTCUT_ROW_LIMIT = 9; +const SHORTCUT_MODIFIER = + typeof navigator !== "undefined" && + navigator.platform.toLowerCase().includes("mac") + ? "⌘" + : "Ctrl "; -export function ModelFlyout({ +export function ModelPanel({ agentSwitcher, model, onPick, @@ -101,27 +113,72 @@ export function ModelFlyout({ rows: rest, }, ].filter((group) => group.rows.length > 0); + const orderedRows = groups.flatMap((group) => group.rows); + const tabs = agentSwitcher + ? [ + { presetId: FAVORITES_TAB, label: t({ message: "Favorites" }) }, + ...agentSwitcher.agents, + ] + : []; const selectTab = (next: string) => { if (next === tab) return; setTab(next); setQuery(""); }; + const cycleTab = (direction: 1 | -1) => { + if (tabs.length === 0) return; + const index = tabs.findIndex((entry) => entry.presetId === tab); + const next = tabs[(index + direction + tabs.length) % tabs.length]; + if (next) selectTab(next.presetId); + }; + // Tab walks the agent tabs instead of leaving the menu; mod+digit picks a row. + const onPanelKeyDown = (event: KeyboardEvent) => { + if (event.key === "Tab") { + event.preventDefault(); + event.stopPropagation(); + cycleTab(event.shiftKey ? -1 : 1); + return; + } + if (!(event.metaKey || event.ctrlKey) || event.altKey) return; + const digit = Number(event.key); + if (!Number.isInteger(digit) || digit < 1 || digit > SHORTCUT_ROW_LIMIT) { + return; + } + const row = orderedRows[digit - 1]; + if (!row) return; + event.preventDefault(); + event.stopPropagation(); + pickRow(row); + }; - const renderRow = (row: Row) => { + const renderRow = (row: Row, index: number) => { const favorited = isFavorite(row); + const selected = + row.presetId === currentPresetId && + row.id === (model?.currentValue ?? null); return ( pickRow(row)} title={row.description} > {row.label} {row.agentLabel ? ( - + {row.agentLabel} ) : null} + {index < SHORTCUT_ROW_LIMIT ? ( + + {SHORTCUT_MODIFIER} + {index + 1} + + ) : null} + + {selected ? : null} + - - {row.presetId === currentPresetId && - row.id === (model?.currentValue ?? null) ? ( - - ) : null} - ); }; + let rowIndex = 0; return ( - <> - {agentSwitcher ? ( +
+ {tabs.length > 0 ? (
- {[ - { presetId: FAVORITES_TAB, label: t({ message: "Favorites" }) }, - ...agentSwitcher.agents, - ].map((entry) => { + {tabs.map((entry) => { const selected = entry.presetId === tab; const icon = entry.presetId === FAVORITES_TAB @@ -184,14 +232,12 @@ export function ModelFlyout({ aria-label={entry.label} aria-selected={selected} className={cn( - "grid size-8 shrink-0 cursor-pointer place-items-center rounded-md text-[11px] text-muted-foreground", - selected - ? "bg-foreground/[0.11] text-foreground" - : "opacity-60 hover:bg-foreground/[0.07] hover:opacity-100", + "relative flex h-7 min-w-7 shrink-0 cursor-pointer items-center justify-center rounded-md px-1.5 text-[11px] text-muted-foreground/70 transition-colors hover:bg-foreground/[0.07] hover:text-foreground", + selected && + "text-foreground after:absolute after:inset-x-1.5 after:-bottom-1.5 after:h-0.5 after:rounded-full after:bg-foreground", )} key={entry.presetId} onClick={() => selectTab(entry.presetId)} - onPointerEnter={() => selectTab(entry.presetId)} role="tab" tabIndex={-1} title={entry.label} @@ -199,10 +245,17 @@ export function ModelFlyout({ > {entry.presetId === FAVORITES_TAB ? ( ) : icon ? ( - + ) : ( entry.label.slice(0, 2) )} @@ -211,52 +264,56 @@ export function ModelFlyout({ })}
) : null} -
- -
- {groups.length === 0 ? ( -
- {onFavoritesTab && !needle - ? t({ message: "No favorite models" }) - : t({ message: "No matching models" })} + +
+ {groups.length === 0 ? ( +
+ {onFavoritesTab && !needle + ? t({ message: "No favorite models" }) + : t({ message: "No matching models" })} +
+ ) : ( + groups.map((group) => ( +
+ {group.label ? ( +
+ {group.label} +
+ ) : null} + {group.rows.map((row) => renderRow(row, rowIndex++))}
- ) : ( - groups.map((group) => ( -
- {group.label ? ( -
{group.label}
- ) : null} - {group.rows.map(renderRow)} -
- )) - )} -
+ )) + )}
- +
); } diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelPanel/index.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelPanel/index.ts new file mode 100644 index 00000000000..6de55d62c96 --- /dev/null +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/ModelPanel/index.ts @@ -0,0 +1 @@ +export { ModelPanel } from "./ModelPanel"; diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/constants.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/constants.ts index 7a2733586ae..4ace8b0c621 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/constants.ts +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/constants.ts @@ -1,12 +1,13 @@ export const PILL_TRIGGER_CLASS = - "flex h-[26px] min-w-0 shrink cursor-pointer items-center gap-1 whitespace-nowrap rounded-md bg-foreground/[0.07] px-1.5 text-[11px] text-foreground outline-none transition-colors hover:bg-foreground/[0.11] focus-visible:ring-1 focus-visible:ring-ring data-[state=open]:bg-foreground/[0.11]"; + "flex h-7 min-w-0 shrink cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[12px] text-foreground/80 outline-none transition-colors hover:bg-foreground/[0.07] hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring data-[state=open]:bg-foreground/[0.07] data-[state=open]:text-foreground"; export const PILL_CHEVRON_CLASS = - "size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"; + "size-3 shrink-0 opacity-60 transition-transform group-data-[state=open]:rotate-180"; -export const MENU_LABEL_CLASS = - "px-2 pt-2 pb-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70"; +/** Frosted picker panel shared by the composer's model and mode menus. */ +export const MENU_PANEL_CLASS = + "rounded-[0.875rem] border-border/80 bg-popover/85 shadow-lg backdrop-blur-2xl backdrop-saturate-150"; -export const MENU_ROW_CLASS = "h-8 gap-2 rounded-md px-2 text-xs"; +export const MENU_ROW_CLASS = "h-7 gap-2 rounded-[0.625rem] px-2 text-[13px]"; -export const MENU_DESCRIPTION_CLASS = "text-[11px] leading-snug"; +export const MENU_DESCRIPTION_CLASS = "text-[12px] leading-snug"; diff --git a/packages/ui/src/components/ui/slider.tsx b/packages/ui/src/components/ui/slider.tsx index 669baf208eb..8f975424cba 100644 --- a/packages/ui/src/components/ui/slider.tsx +++ b/packages/ui/src/components/ui/slider.tsx @@ -7,12 +7,22 @@ import { cn } from "../../lib/utils"; function Slider({ className, + trackClassName, + rangeClassName, + thumbClassName, + children, defaultValue, value, min = 0, max = 100, ...props -}: React.ComponentProps) { +}: React.ComponentProps & { + trackClassName?: string; + rangeClassName?: string; + thumbClassName?: string; + /** Rendered inside the track, after the range (e.g. step marks). */ + children?: React.ReactNode; +}) { const _values = React.useMemo( () => Array.isArray(value) @@ -40,21 +50,27 @@ function Slider({ data-slot="slider-track" className={cn( "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5", + trackClassName, )} > + {children} {Array.from({ length: _values.length }, (_, index) => ( ))} From 99ac4413087261c629e2b91dd14679f5b4ab39d4 Mon Sep 17 00:00:00 2001 From: AviPeltz Date: Tue, 6 Oct 2026 16:39:44 -0700 Subject: [PATCH 2/4] feat(desktop): make the composer zap a standalone fast-mode toggle --- .../components/ModelPicker/ModelPicker.tsx | 208 ++++++++++-------- 1 file changed, 112 insertions(+), 96 deletions(-) diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx index bc6a839dba0..242669d4fcc 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx @@ -106,104 +106,120 @@ export function ModelPicker({ }; return ( - - - - - - {showsModels ? ( - { - setOpen(false); - agentSwitcher.onSwitch(presetId, picked); - }, - } - } - model={model} - onPick={(modelId) => { - if (model) pick(model, modelId); - }} - searchRef={searchRef} - /> - ) : null} - {settings.length > 0 ? ( -
- {effort ? ( - + +
- ) : null} -
-
+ {pillLabel} + {effortLabel ? ( + + {effortLabel} + + ) : null} + + + + + {showsModels ? ( + { + setOpen(false); + agentSwitcher.onSwitch(presetId, picked); + }, + } + } + model={model} + onPick={(modelId) => { + if (model) pick(model, modelId); + }} + searchRef={searchRef} + /> + ) : null} + {settings.length > 0 ? ( +
+ {effort ? ( + + ) : null} + {rows.map((option) => ( + + + + {option.label} + + + {currentLabel(option)} + + + {/* Portaled: the panel's backdrop-blur would otherwise contain and clip it. */} + + + {option.options.map((entry) => ( + pick(option, entry.id)} + title={entry.description} + > + + {entry.label} + + {entry.id === option.currentValue ? ( + + ) : null} + + ))} + + + + ))} +
+ ) : null} +
+ +
); } From 4821cf27715b5a63b9789a278d3633af05521339 Mon Sep 17 00:00:00 2001 From: AviPeltz Date: Thu, 8 Oct 2026 22:43:10 -0700 Subject: [PATCH 3/4] feat(desktop): tint the effort slider and unrestricted mode with the theme highlight The slider range, effort label, fast-mode zap and the Full access icon were fixed amber-500 in every theme. They now use --highlight, so they follow the active theme's brand hue (terracotta on Ember, purple on Catppuccin, and so on) and match the agent glyph beside them. The favourite star stays amber: it is a star, not an accent. --- .../Composer/components/ModePicker/ModePicker.tsx | 2 +- .../Composer/components/ModelPicker/ModelPicker.tsx | 2 +- .../components/EffortSliderCard/EffortSliderCard.tsx | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModePicker/ModePicker.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModePicker/ModePicker.tsx index 120f17e28aa..30e3e650142 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModePicker/ModePicker.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModePicker/ModePicker.tsx @@ -35,7 +35,7 @@ type ModeCopy = { const HIDDEN_MODE_IDS = new Set(["plan", "acceptEdits", "workspace-write"]); const SOLID_ICONS = new Set([Pause, Play, FastForward]); -const UNRESTRICTED_TINT = "text-amber-500"; +const UNRESTRICTED_TINT = "text-highlight"; export function ModePicker({ currentModeId, diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx index f4fa2c92938..c7dd5581eac 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/ModelPicker.tsx @@ -113,7 +113,7 @@ export function ModelPicker({ aria-pressed={fastOn} className={cn( "flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-lg transition-colors hover:bg-foreground/[0.07] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", - fastOn ? "text-amber-500" : "text-muted-foreground/70", + fastOn ? "text-highlight" : "text-muted-foreground/70", )} onClick={() => onSelect(fast.id, fastOn ? "off" : "on")} title={fast.label} diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/EffortSliderCard.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/EffortSliderCard.tsx index ac0c5c76a66..c7c1a98d84b 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/EffortSliderCard.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/components/ModelPicker/components/EffortSliderCard/EffortSliderCard.tsx @@ -35,7 +35,7 @@ export function EffortSliderCard({ aria-pressed={fastOn} className={cn( "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-lg transition-colors hover:bg-foreground/[0.06] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", - fastOn ? "text-amber-500" : "text-muted-foreground/70", + fastOn ? "text-highlight" : "text-muted-foreground/70", )} onClick={() => onSelect(fast.id, fastOn ? "off" : "on")} title={fast.label} @@ -46,7 +46,7 @@ export function EffortSliderCard({ ) : (