Skip to content

The agent that grows with you

fix(desktop): setup cards follow the chat's conversation text scale

alt-glitch7a5a77b8c603
diff --git a/apps/desktop/src/components/assistant-ui/connector-directory-card.tsx b/apps/desktop/src/components/assistant-ui/connector-directory-card.tsx
index 3a27d698b7f..03f5177cc26 100644
--- a/apps/desktop/src/components/assistant-ui/connector-directory-card.tsx
+++ b/apps/desktop/src/components/assistant-ui/connector-directory-card.tsx
@@ -16,6 +16,7 @@ import type { ConnectorCardModel } from '@/app/capabilities/connectors/types'
import { useSessionView } from '@/app/chat/session-view'
import { sessionRoute } from '@/app/routes'
import { orderConnectorPicks } from '@/components/assistant-ui/connector-order'
+import { CARD_ACTION_CLASS, CARD_CHIP_CLASS, CARD_LABEL_CLASS } from '@/components/assistant-ui/setup-beat/card-type'
import { useConnectionOwner } from '@/components/assistant-ui/use-connection-owner'
import { WIDGET_SHELL_CLASS } from '@/components/chat/widget-shell'
import { Button } from '@/components/ui/button'
@@ -51,8 +52,6 @@ export interface DirectorySections {
// The onboarding apps step showed search from this many apps on.
const SEARCH_THRESHOLD = 12
-const LABEL_CLASS = 'text-[0.6875rem] leading-4 text-(--ui-text-tertiary)'
-
const matches = (card: ConnectorCardModel, needle: string): boolean =>
!needle || card.name.toLowerCase().includes(needle) || card.slug.includes(needle)
@@ -180,7 +179,7 @@ function DirectoryBody({ onContinue, owner, returnRoute, suggested = NO_SUGGESTI
return (
<Chip
- className="w-full"
+ className={cn('w-full', CARD_CHIP_CLASS)}
icon={
<ConnectorLogo
className="size-7 rounded-full text-sm"
@@ -212,14 +211,14 @@ function DirectoryBody({ onContinue, owner, returnRoute, suggested = NO_SUGGESTI
)}
>
<div className="flex items-start gap-2">
- <span className={cn('flex-1', LABEL_CLASS)}>{copy.title}</span>
+ <span className={cn('flex-1', CARD_LABEL_CLASS)}>{copy.title}</span>
<Plug aria-hidden className="mt-px size-4 shrink-0 text-(--ui-text-tertiary)" />
</div>
<HostedNotice hasGuest={freeTier?.has_guest === true} phase={hosted.phase} />
{hosted.phase === 'failed' ? (
- <p className="flex items-center gap-1.5 text-xs text-(--ui-text-tertiary)">
+ <p className={cn('flex items-center gap-1.5', CARD_LABEL_CLASS)}>
{t.connectorsPage.page.hostedFailedTitle}
<Button onClick={hosted.refetch} size="xs" variant="text">
{t.connectorsPage.page.retry}
@@ -242,24 +241,24 @@ function DirectoryBody({ onContinue, owner, returnRoute, suggested = NO_SUGGESTI
<>
{pinned ? (
<section className="grid gap-1.5">
- <span className={LABEL_CLASS}>{copy.directory.suggested}</span>
+ <span className={CARD_LABEL_CLASS}>{copy.directory.suggested}</span>
<div className="grid grid-cols-3 gap-2 p-1">{sections.suggested.map(tile)}</div>
</section>
) : null}
{sections.rest.length > 0 ? (
<section className="grid gap-1.5">
- {pinned ? <span className={LABEL_CLASS}>{copy.directory.allApps}</span> : null}
+ {pinned ? <span className={CARD_LABEL_CLASS}>{copy.directory.allApps}</span> : null}
<FadeScroll className="grid grid-cols-3 gap-2 p-1" fade="1.5rem" maxHeight="18rem" pad="1.5rem">
{sections.rest.map(tile)}
</FadeScroll>
</section>
) : null}
- {nothingMatches ? <p className="text-xs text-(--ui-text-tertiary)">{copy.empty}</p> : null}
+ {nothingMatches ? <p className={CARD_LABEL_CLASS}>{copy.empty}</p> : null}
</>
)}
</div>
<div className="px-3.5">
- <Button onClick={finish} size="sm">
+ <Button className={CARD_ACTION_CLASS} onClick={finish} size="sm">
{t.common.continue}
</Button>
</div>
diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/beat-cards.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/beat-cards.tsx
index 37cc4941293..57ce153651a 100644
--- a/apps/desktop/src/components/assistant-ui/setup-beat/beat-cards.tsx
+++ b/apps/desktop/src/components/assistant-ui/setup-beat/beat-cards.tsx
@@ -6,8 +6,11 @@ import { Button } from '@/components/ui/button'
import { Chip } from '@/components/ui/chip'
import { Input } from '@/components/ui/input'
import { useI18n } from '@/i18n'
+import { cn } from '@/lib/utils'
import type { BeatOption } from '@/store/setup-beat'
+import { CARD_ACTION_CLASS, CARD_CHIP_CLASS, CARD_INPUT_CLASS } from './card-type'
+
/** A text box for the name. The OS account's full name is offered as a row and is sent only when picked. */
export function NameCard({ onName, suggested }: { onName: (name: string) => void; suggested?: string }) {
const { t } = useI18n()
@@ -16,7 +19,15 @@ export function NameCard({ onName, suggested }: { onName: (name: string) => void
return (
<div className="grid gap-2">
- {suggested && <Chip label={t.firstRun.useName(suggested)} on={false} onToggle={() => onName(suggested)} variant="pill" />}
+ {suggested && (
+ <Chip
+ className={CARD_CHIP_CLASS}
+ label={t.firstRun.useName(suggested)}
+ on={false}
+ onToggle={() => onName(suggested)}
+ variant="pill"
+ />
+ )}
<form
className="flex items-center gap-2"
onSubmit={event => {
@@ -30,12 +41,12 @@ export function NameCard({ onName, suggested }: { onName: (name: string) => void
<Input
aria-label={t.firstRun.namePlaceholder}
autoFocus
- className="flex-1"
+ className={cn('flex-1', CARD_INPUT_CLASS)}
onChange={event => setName(event.target.value)}
placeholder={t.firstRun.namePlaceholder}
value={name}
/>
- <Button disabled={!typed} size="sm" type="submit">
+ <Button className={CARD_ACTION_CLASS} disabled={!typed} size="sm" type="submit">
{t.common.continue}
</Button>
</form>
@@ -48,7 +59,14 @@ export function OptionsCard({ onPick, options }: { onPick: (option: BeatOption)
return (
<div className="flex flex-wrap gap-2" role="group">
{options.map(option => (
- <Chip key={option.id} label={option.label} on={false} onToggle={() => onPick(option)} variant="pill" />
+ <Chip
+ className={CARD_CHIP_CLASS}
+ key={option.id}
+ label={option.label}
+ on={false}
+ onToggle={() => onPick(option)}
+ variant="pill"
+ />
))}
</div>
)
diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/card-type.ts b/apps/desktop/src/components/assistant-ui/setup-beat/card-type.ts
new file mode 100644
index 00000000000..343767eba0e
--- /dev/null
+++ b/apps/desktop/src/components/assistant-ui/setup-beat/card-type.ts
@@ -0,0 +1,23 @@
+// Setup cards read the chat's conversation tokens, so the setup chat's larger scale reaches them too.
+// Relative sizes follow main's setup cards: label and detail one rung under the options, prose above.
+
+/** The card's question line and section labels. */
+export const CARD_LABEL_CLASS =
+ 'text-[length:var(--conversation-tool-font-size)] leading-(--conversation-caption-line-height) text-(--ui-text-tertiary)'
+
+/** Option names (pills, tiles, picker cards). */
+export const CARD_OPTION_CLASS = 'text-[length:var(--conversation-caption-font-size)]'
+
+/** The second line under an option name. */
+export const CARD_DETAIL_CLASS = 'text-[length:var(--conversation-tool-font-size)]'
+
+/** Chip draws its own fixed sizes; this restates both lines in the conversation tokens. */
+export const CARD_CHIP_CLASS =
+ 'text-[length:var(--conversation-caption-font-size)] [&_.text-xs]:text-[length:var(--conversation-tool-font-size)]'
+
+/** Continue and other card buttons. */
+export const CARD_ACTION_CLASS =
+ 'h-auto text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height)'
+
+/** A text box typed into like the composer. */
+export const CARD_INPUT_CLASS = 'text-[length:var(--conversation-text-font-size)] leading-(--conversation-line-height)'
diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/plugins-card.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/plugins-card.tsx
index 051a1d81d54..c81e7c76bce 100644
--- a/apps/desktop/src/components/assistant-ui/setup-beat/plugins-card.tsx
+++ b/apps/desktop/src/components/assistant-ui/setup-beat/plugins-card.tsx
@@ -11,16 +11,24 @@ import { Button } from '@/components/ui/button'
import { Chip } from '@/components/ui/chip'
import { useI18n } from '@/i18n'
import { lookupPluginCatalogEntry } from '@/lib/plugin-catalog'
+import { cn } from '@/lib/utils'
import { $agentPlugins } from '@/store/agent-plugins'
import type { ConnectionOwner } from '@/store/connection-request'
import { requestGatewayForAgent } from '@/store/gateway'
import { openCatalogPluginInstall } from '@/store/plugin-catalog-install'
+import { CARD_ACTION_CLASS, CARD_CHIP_CLASS, CARD_LABEL_CLASS } from './card-type'
+
async function readPresence(owner: ConnectionOwner, names: string[]): Promise<CatalogPluginPresence[]> {
- const result = await requestGatewayForAgent<PluginsManageResult>(owner.connectionId, owner.profile, 'plugins.manage', {
- action: 'presence',
- names
- })
+ const result = await requestGatewayForAgent<PluginsManageResult>(
+ owner.connectionId,
+ owner.profile,
+ 'plugins.manage',
+ {
+ action: 'presence',
+ names
+ }
+ )
return result.presence ?? []
}
@@ -69,11 +77,11 @@ export function PluginsCard({
return (
<div className="grid gap-3">
{presence.isPending && names.length > 0 ? (
- <p className="text-xs text-(--ui-text-tertiary)" role="status">
+ <p className={CARD_LABEL_CLASS} role="status">
{copy.loading}
</p>
) : rows.length === 0 ? (
- <p className="text-xs text-(--ui-text-tertiary)">{copy.noPlugins}</p>
+ <p className={CARD_LABEL_CLASS}>{copy.noPlugins}</p>
) : (
<div className="grid grid-cols-2 gap-2 p-1">
{rows.map(row => {
@@ -81,7 +89,7 @@ export function PluginsCard({
return (
<Chip
- className="w-full"
+ className={cn('w-full', CARD_CHIP_CLASS)}
icon={PLUGIN_ICON}
key={row.name}
label={row.title || row.name}
@@ -99,6 +107,7 @@ export function PluginsCard({
)}
<div>
<Button
+ className={CARD_ACTION_CLASS}
onClick={() => {
const done = names.filter(name => installed.has(name))
const title = (name: string) => rows.find(row => row.name === name)?.title || name
diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx
index aca1a1a24d1..b7ce966a548 100644
--- a/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx
+++ b/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx
@@ -17,8 +17,6 @@ export const SETUP_BEAT_SHELL_CLASS = cn(
'my-1.5 text-[length:var(--conversation-text-font-size)] text-(--ui-text-primary)'
)
-export const SETUP_BEAT_LABEL_CLASS = 'text-[0.6875rem] leading-4 text-(--ui-text-tertiary)'
-
/** What a settled card shows: the beat's pick, or how the card closed without one. */
export type SetupBeatOutcome =
| { answer: SetupBeatAnswer; beat: SetupBeat; kind: 'answer' }
diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/setup-beat-tool.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/setup-beat-tool.tsx
index 2eacac488cd..7e3a9f2ac8a 100644
--- a/apps/desktop/src/components/assistant-ui/setup-beat/setup-beat-tool.tsx
+++ b/apps/desktop/src/components/assistant-ui/setup-beat/setup-beat-tool.tsx
@@ -23,14 +23,9 @@ import {
} from '@/store/setup-beat'
import { NameCard, OptionsCard } from './beat-cards'
+import { CARD_LABEL_CLASS } from './card-type'
import { PluginsCard } from './plugins-card'
-import {
- SETUP_BEAT_LABEL_CLASS,
- SETUP_BEAT_SHELL_CLASS,
- type SetupBeatOutcome,
- setupBeatOutcome,
- SetupBeatReceipt
-} from './receipt'
+import { SETUP_BEAT_SHELL_CLASS, type SetupBeatOutcome, setupBeatOutcome, SetupBeatReceipt } from './receipt'
/** The card body for one beat; `answer` sends the beat's picks and settles the card. */
function BeatBody({ answer, request }: { answer: (picks: SetupBeatAnswer) => void; request: SetupBeatRequest }) {
@@ -76,10 +71,17 @@ function BeatBody({ answer, request }: { answer: (picks: SetupBeatAnswer) => voi
)
case 'tour':
- return <OptionsCard onPick={option => answer({ label: option.label, tour: option.id })} options={card.options ?? []} />
+ return (
+ <OptionsCard onPick={option => answer({ label: option.label, tour: option.id })} options={card.options ?? []} />
+ )
case 'build':
- return <OptionsCard onPick={option => answer({ build: option.id, label: option.label })} options={card.options ?? []} />
+ return (
+ <OptionsCard
+ onPick={option => answer({ build: option.id, label: option.label })}
+ options={card.options ?? []}
+ />
+ )
case 'connectors':
return null
@@ -103,7 +105,7 @@ function BeatShell({ beat, children, question }: { beat: SetupBeat; children: Re
return (
<div className={cn(SETUP_BEAT_SHELL_CLASS, 'grid gap-3')} data-setup-beat={beat}>
<div className="flex items-start gap-2">
- <span className={cn(SETUP_BEAT_LABEL_CLASS, 'flex-1')}>{question}</span>
+ <span className={cn(CARD_LABEL_CLASS, 'flex-1')}>{question}</span>
<Icon aria-hidden className={CLARIFY_ICON_CLASS} />
</div>
{children}
diff --git a/apps/desktop/src/components/assistant-ui/theme-picker/layout-picker-card.tsx b/apps/desktop/src/components/assistant-ui/theme-picker/layout-picker-card.tsx
index 3d6077f3690..5d9fd178b6e 100644
--- a/apps/desktop/src/components/assistant-ui/theme-picker/layout-picker-card.tsx
+++ b/apps/desktop/src/components/assistant-ui/theme-picker/layout-picker-card.tsx
@@ -11,6 +11,8 @@ import { useI18n } from '@/i18n'
import { selectableCardClass } from '@/lib/selectable-card'
import { cn } from '@/lib/utils'
+import { CARD_DETAIL_CLASS, CARD_OPTION_CLASS } from '../setup-beat/card-type'
+
export interface LayoutPickerCardProps {
onPick: (preset: string) => void
}
@@ -45,10 +47,16 @@ export function LayoutPickerCard({ onPick }: LayoutPickerCardProps) {
{isLayoutNode(tree) && <TreeThumbnail node={tree} resting={layoutPresetResting(choice.id)} />}
</span>
<span className="flex flex-col gap-0.5">
- <span className={cn('text-xs font-medium', active ? 'text-foreground' : 'text-(--ui-text-secondary)')}>
+ <span
+ className={cn(
+ CARD_OPTION_CLASS,
+ 'font-medium',
+ active ? 'text-foreground' : 'text-(--ui-text-secondary)'
+ )}
+ >
{copy[choice.name]}
</span>
- <span className="text-[0.68rem] text-(--ui-text-tertiary)">{copy[choice.detail]}</span>
+ <span className={cn(CARD_DETAIL_CLASS, 'text-(--ui-text-tertiary)')}>{copy[choice.detail]}</span>
</span>
</button>
)
diff --git a/apps/desktop/src/components/assistant-ui/theme-picker/theme-tool.tsx b/apps/desktop/src/components/assistant-ui/theme-picker/theme-tool.tsx
index 4465e751514..f2e427e614a 100644
--- a/apps/desktop/src/components/assistant-ui/theme-picker/theme-tool.tsx
+++ b/apps/desktop/src/components/assistant-ui/theme-picker/theme-tool.tsx
@@ -18,6 +18,7 @@ import { useTheme } from '@/themes'
import { accentName, resolveAccentPick } from '@/themes/accents'
import type { ThemeMode } from '@/themes/context'
+import { CARD_LABEL_CLASS } from '../setup-beat/card-type'
import { ToolFallback } from '../tool/fallback'
import { TypedAnswer } from '../typed-answer'
@@ -25,7 +26,10 @@ import { AccentPickerCard } from './accent-picker-card'
import { setThemeCall } from './args'
import { LayoutPickerCard } from './layout-picker-card'
-const SHELL_CLASS = cn(WIDGET_SHELL_CLASS, 'my-1.5 text-[length:var(--conversation-text-font-size)] text-(--ui-text-primary)')
+const SHELL_CLASS = cn(
+ WIDGET_SHELL_CLASS,
+ 'my-1.5 text-[length:var(--conversation-text-font-size)] text-(--ui-text-primary)'
+)
const MODES: readonly ThemeMode[] = ['light', 'dark', 'system']
@@ -139,7 +143,7 @@ export function ThemeTool(props: ToolCallMessagePartProps) {
return (
<div className={cn(SHELL_CLASS, 'grid gap-2')} data-theme-picker={picker}>
<div className="flex items-center justify-between gap-2">
- <span className="font-medium">{copy[picker]}</span>
+ <span className={CARD_LABEL_CLASS}>{copy[picker]}</span>
<button
aria-label={copy.noPick}
className="grid size-6 place-items-center rounded-md text-(--ui-text-tertiary) hover:bg-(--chrome-action-hover) hover:text-foreground"