Smooth share-link drawer opening; number fields can be cleared

- Share links: opening the assistant focused its composer while the
  drawer was still sliding in from off-screen, so the browser scrolled
  the whole page 680px sideways and back. The composer now focuses
  without scrolling, and both page rows clip sideways overflow so a
  sliding drawer can never widen or scroll the page.
- Number fields clamped on every keystroke, so clearing one snapped it
  to its minimum (1, or 256 for max output tokens). A shared NumberInput
  keeps the text as typed while focused, passes on in-range values as
  they are typed, and fits the value into its limits when the field is
  left or Enter is pressed (an empty field returns to its last value).
  Used for question and card counts, med math count, timers, review
  limits, template counts and model settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-16 15:30:53 -07:00
parent f738fbe7be
commit 0ad6290250
10 changed files with 101 additions and 21 deletions

View file

@ -8,7 +8,7 @@ import { McpSettings } from './McpSettings';
import { SemanticSettings } from './SemanticSettings';
import { REASONING_EFFORTS, type AdapterMeta, type AiModel, type AiStatus, type Provider, type ProviderKind, type TaskConfig, type TaskName, type TaskSettings } from '@/lib/types';
import { cx, formatCost, formatTokens, plural, timeAgo } from '@/lib/util';
import { Badge, Button, Callout, Dialog, EmptyState, Field, IconButton, Input, Menu, MenuItem, MenuSeparator, Section, Select, Skeleton, Switch, Textarea, Tooltip, useConfirm } from '@/ui';
import { Badge, Button, Callout, Dialog, EmptyState, Field, IconButton, Input, NumberInput, Menu, MenuItem, MenuSeparator, Section, Select, Skeleton, Switch, Textarea, Tooltip, useConfirm } from '@/ui';
interface Meta {
adapters: AdapterMeta[];
@ -558,10 +558,10 @@ function TaskRow({
</Select>
</Field>
<Field label="Temperature" hint={model && !model.capabilities.temperature ? 'Ignored by this model' : '0 to 2'}>
<Input type="number" min={0} max={2} step={0.1} value={config.temperature ?? ''} placeholder={same ?? 'Model default'} onChange={(e) => onChange({ ...config, temperature: e.target.value === '' ? null : Math.max(0, Math.min(2, Number(e.target.value))) })} />
<NumberInput min={0} max={2} step={0.1} integer={false} allowEmpty value={config.temperature ?? null} placeholder={same ?? 'Model default'} onValueChange={(n) => onChange({ ...config, temperature: n })} />
</Field>
<Field label="Output limit" hint="Tokens per response">
<Input type="number" min={256} step={256} value={config.maxOutputTokens ?? ''} placeholder={same ?? 'Automatic'} onChange={(e) => onChange({ ...config, maxOutputTokens: e.target.value === '' ? null : Math.max(256, Math.round(Number(e.target.value))) })} />
<NumberInput min={256} step={256} allowEmpty value={config.maxOutputTokens ?? null} placeholder={same ?? 'Automatic'} onValueChange={(n) => onChange({ ...config, maxOutputTokens: n })} />
</Field>
</div>
</details>