Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

refactor(ui): consolidate inputs, selects, and toggles onto shared primitives

cyhc92285ef60f1
diff --git a/ui/src/components/RemoteAccess.tsx b/ui/src/components/RemoteAccess.tsx
index f85227a03..acb7a16f4 100644
--- a/ui/src/components/RemoteAccess.tsx
+++ b/ui/src/components/RemoteAccess.tsx
@@ -3,6 +3,7 @@ import { CheckCircle2, ExternalLink, Link2, RefreshCcw } from 'lucide-react';
import { Trans, useTranslation } from 'react-i18next';
import { useApi } from '../context/ApiContext';
import { useToast } from '../context/ToastContext';
+import { CompactField } from './settings/SettingsPrimitives';
const VIBE_CLOUD_URL = 'https://avibe.bot';
@@ -177,8 +178,8 @@ export const RemoteAccess: React.FC = () => {
<div className="grid gap-3 px-4 py-3 md:grid-cols-[1fr_auto] md:items-end">
<label className="space-y-1.5">
<span className="text-[12px] font-medium text-foreground">{t('remoteAccess.pairingKey')}</span>
- <input
- className="h-8 w-full rounded-md border border-input bg-surface-3 px-3 font-mono text-[12px] text-foreground outline-none focus:border-ring focus:ring-2 focus:ring-ring/30"
+ <CompactField
+ className="w-full font-mono"
value={pairingKey}
onChange={(event) => setPairingKey(event.target.value)}
placeholder="vrp_xxxxxxxxxxxxxxxxx"
diff --git a/ui/src/components/shared/ProxyUrlField.tsx b/ui/src/components/shared/ProxyUrlField.tsx
index 2e42123de..8d2c95d67 100644
--- a/ui/src/components/shared/ProxyUrlField.tsx
+++ b/ui/src/components/shared/ProxyUrlField.tsx
@@ -2,6 +2,7 @@ import { useState } from 'react';
import { ChevronDown, SplitSquareVertical } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
+import { CompactField } from '../settings/SettingsPrimitives';
interface ProxyUrlFieldProps {
value: string;
@@ -51,12 +52,12 @@ export function ProxyUrlField({
</button>
{expanded && (
<div className="space-y-2">
- <input
+ <CompactField
type="text"
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder="socks5://user:pass@host:port (optional)"
- className="w-full rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/55 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ className="w-full font-mono placeholder:text-muted/55"
/>
<p className="text-[11px] text-muted">{t(hintKey)}</p>
</div>
diff --git a/ui/src/components/shared/RoutingConfigPanel.tsx b/ui/src/components/shared/RoutingConfigPanel.tsx
index 16ed17502..93728d568 100644
--- a/ui/src/components/shared/RoutingConfigPanel.tsx
+++ b/ui/src/components/shared/RoutingConfigPanel.tsx
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
import { Combobox } from '../ui/combobox';
import { BackendIcon } from '../visual';
+import { CompactSelect } from '../settings/SettingsPrimitives';
// Mirrors design.pen `asPXu` (VR/RoutingConfig). Shared between groups (channels)
// and users — same form, same fields, same styles. The only difference is whether
@@ -140,7 +141,7 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
placeholder={globalConfig?.runtime?.default_cwd || t('channelList.useGlobalDefault')}
value={value.custom_cwd}
onCommit={(v) => onChange({ custom_cwd: v })}
- className="flex-1 rounded-lg border border-border bg-surface px-3 py-2 font-mono text-sm text-foreground placeholder:text-muted/50 focus:border-cyan focus:outline-none"
+ className="h-9 flex-1 rounded-lg border border-border bg-foreground/[0.04] px-3 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/50 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
/>
<button
type="button"
@@ -160,15 +161,15 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
<span className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2">
<BackendIcon backend={effectiveBackend} variant="glyph" size={14} />
</span>
- <select
+ <CompactSelect
value={effectiveBackend}
onChange={(e) => onChange({ routing: { ...value.routing, agent_backend: e.target.value } })}
- className="w-full rounded-lg border border-border bg-surface py-2 pl-9 pr-3 text-sm text-foreground focus:border-cyan focus:outline-none"
+ className="w-full pl-9 pr-3"
>
<option value="opencode">OpenCode</option>
<option value="claude">ClaudeCode</option>
<option value="codex">Codex</option>
- </select>
+ </CompactSelect>
</div>
</div>
@@ -281,20 +282,20 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
<div className="grid grid-cols-1 gap-3 rounded-xl border border-border bg-surface/80 p-3 md:grid-cols-3">
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
+ <CompactSelect
value={value.routing.opencode_agent || ''}
onChange={(e) => onChange({ routing: { ...value.routing, opencode_agent: e.target.value || null } })}
- className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ className="w-full"
>
<option value="">{t('common.default')}</option>
{(opencodeOptions?.agents || []).map((a: any) => (
<option key={a.name} value={a.name}>{a.name}</option>
))}
- </select>
+ </CompactSelect>
</div>
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.model')}</label>
- <select
+ <CompactSelect
value={value.routing.opencode_model || ''}
onChange={(e) => onChange({
routing: {
@@ -303,7 +304,7 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
opencode_reasoning_effort: null,
},
})}
- className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ className="w-full"
>
<option value="">{t('common.default')}</option>
{(opencodeOptions?.models?.providers || []).flatMap((provider: any) => {
@@ -320,23 +321,23 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
<option key={`${pid}:${mid}`} value={`${pid}/${mid}`}>{pLabel}/{mid}</option>
));
})}
- </select>
+ </CompactSelect>
</div>
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
+ <CompactSelect
value={value.routing.opencode_reasoning_effort || ''}
onChange={(e) => onChange({
routing: { ...value.routing, opencode_reasoning_effort: e.target.value || null },
})}
disabled={!getOpenCodeReasoningOptions(value.routing.opencode_model || '').length}
- className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground disabled:opacity-50"
+ className="w-full disabled:opacity-50"
>
<option value="">{t('common.default')}</option>
{getOpenCodeReasoningOptions(value.routing.opencode_model || '').map((opt) => (
<option key={opt.value} value={opt.value}>{opt.label}</option>
))}
- </select>
+ </CompactSelect>
</div>
</div>
</div>
@@ -348,14 +349,14 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
<div className="grid grid-cols-1 gap-3 rounded-xl border border-border bg-surface/80 p-3 md:grid-cols-3">
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
+ <CompactSelect
value={value.routing.claude_agent || ''}
onChange={(e) => onChange({ routing: { ...value.routing, claude_agent: e.target.value || null } })}
- className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ className="w-full"
>
<option value="">{t('common.default')}</option>
{claudeAgents.map((a) => <option key={a.id} value={a.id}>{a.name}</option>)}
- </select>
+ </CompactSelect>
</div>
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.model')}</label>
@@ -376,12 +377,12 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
</div>
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
+ <CompactSelect
value={value.routing.claude_reasoning_effort || ''}
onChange={(e) => onChange({
routing: { ...value.routing, claude_reasoning_effort: e.target.value || null },
})}
- className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ className="w-full"
>
<option value="">{t('common.default')}</option>
{getClaudeReasoning(value.routing.claude_model || '')
@@ -391,7 +392,7 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
{getReasoningLabel(option.value, option.label)}
</option>
))}
- </select>
+ </CompactSelect>
</div>
</div>
</div>
@@ -403,14 +404,14 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
<div className="grid grid-cols-1 gap-3 rounded-xl border border-border bg-surface/80 p-3 md:grid-cols-3">
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
+ <CompactSelect
value={value.routing.codex_agent || ''}
onChange={(e) => onChange({ routing: { ...value.routing, codex_agent: e.target.value || null } })}
- className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ className="w-full"
>
<option value="">{t('common.default')}</option>
{codexAgents.map((a) => <option key={a.id} value={a.id}>{a.name}</option>)}
- </select>
+ </CompactSelect>
</div>
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.model')}</label>
@@ -427,19 +428,19 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
</div>
<div className="space-y-1">
<label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
+ <CompactSelect
value={value.routing.codex_reasoning_effort || ''}
onChange={(e) => onChange({
routing: { ...value.routing, codex_reasoning_effort: e.target.value || null },
})}
- className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ className="w-full"
>
<option value="">{t('common.default')}</option>
<option value="low">{t('channelList.reasoningLow')}</option>
<option value="medium">{t('channelList.reasoningMedium')}</option>
<option value="high">{t('channelList.reasoningHigh')}</option>
<option value="xhigh">{t('channelList.reasoningXHigh')}</option>
- </select>
+ </CompactSelect>
</div>
</div>
</div>
diff --git a/ui/src/components/steps/AgentDetection.tsx b/ui/src/components/steps/AgentDetection.tsx
index fb9dbf58b..5691b06a3 100644
--- a/ui/src/components/steps/AgentDetection.tsx
+++ b/ui/src/components/steps/AgentDetection.tsx
@@ -16,6 +16,7 @@ import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
import { BackendIcon, EyebrowBadge, WizardCard } from '../visual';
import type { BackendId } from '../visual';
+import { CompactField, CompactSelect, ToggleSwitch } from '../settings/SettingsPrimitives';
interface AgentDetectionProps {
data: any;
@@ -192,15 +193,15 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
<span className="text-[11px] font-semibold uppercase tracking-[0.12em] text-muted">
{t('agentDetection.defaultBackend')}
</span>
- <select
+ <CompactSelect
value={defaultBackend}
onChange={(e) => setDefaultBackend(e.target.value)}
- className="mt-1 h-9 w-full rounded-lg border border-border bg-surface-2 px-3 text-[12px] text-foreground outline-none transition focus:border-cyan focus:ring-1 focus:ring-cyan/40 md:max-w-[260px]"
+ className="mt-1 w-full md:max-w-[260px]"
>
<option value="opencode">OpenCode {t('agentDetection.recommended')}</option>
<option value="claude">Claude Code</option>
<option value="codex">Codex</option>
- </select>
+ </CompactSelect>
</label>
<button
onClick={detectAll}
@@ -228,30 +229,16 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
</div>
<div className="flex items-center gap-3">
<StatusBadge status={agent.status || 'unknown'} loading={checking} />
- <button
- role="switch"
- aria-checked={agent.enabled}
+ <ToggleSwitch
+ enabled={agent.enabled}
onClick={() => toggle(name, !agent.enabled)}
- className={clsx(
- 'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border transition-colors focus:outline-none focus:ring-2 focus:ring-mint/40',
- agent.enabled
- ? 'border-mint/50 bg-mint shadow-[0_0_12px_-2px_rgba(91,255,160,0.6)]'
- : 'border-border-strong bg-border-strong'
- )}
- >
- <span
- className={clsx(
- 'inline-block size-3.5 rounded-full bg-background shadow transition-transform',
- agent.enabled ? 'translate-x-[18px]' : 'translate-x-1'
- )}
- />
- </button>
+ />
</div>
</div>
<div className="space-y-3 px-5 py-3.5">
<div className="flex gap-2">
- <input
+ <CompactField
type="text"
value={agent.cli_path}
onChange={(e) =>
@@ -261,7 +248,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
}))
}
placeholder={t('agentDetection.cliPathPlaceholder', { name })}
- className="h-9 flex-1 rounded-lg border border-border bg-surface-2 px-3 font-mono text-[12px] text-foreground outline-none transition focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ className="flex-1 font-mono"
/>
<button
onClick={() => detect(name, agent.cli_path)}
diff --git a/ui/src/components/steps/ChannelList.tsx b/ui/src/components/steps/ChannelList.tsx
index f3bd140f5..dda07c4f6 100644
--- a/ui/src/components/steps/ChannelList.tsx
+++ b/ui/src/components/steps/ChannelList.tsx
@@ -24,6 +24,7 @@ import clsx from 'clsx';
import { getEnabledPlatforms, platformSupportsChannels } from '../../lib/platforms';
import { EyebrowBadge, PlatformIcon, WizardCard } from '../visual';
import { RoutingConfigPanel } from '../shared/RoutingConfigPanel';
+import { CompactSelect, ToggleSwitch } from '../settings/SettingsPrimitives';
const PLATFORM_BRAND_COLORS: Record<string, string> = {
slack: '#4A154B',
@@ -979,16 +980,16 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
<div className="grid gap-3 md:grid-cols-[minmax(220px,280px)_1fr]">
<div className="space-y-1">
<label className="font-medium text-foreground">{t('channelList.guildBrowse')}</label>
- <select
+ <CompactSelect
value={selectedGuild}
onChange={(e) => updateSelectedGuild(e.target.value)}
- className="w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-foreground focus:border-cyan focus:outline-none"
+ className="w-full"
>
<option value="">{t('channelList.guildPlaceholder')}</option>
{knownDiscordGuilds.map((g) => (
<option key={g.id} value={g.id}>{g.name}</option>
))}
- </select>
+ </CompactSelect>
</div>
<div className="space-y-2">
<div className="flex flex-wrap items-center justify-between gap-2">
@@ -1086,28 +1087,13 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
discovered: summary.total,
})}
</div>
- <label className="inline-flex cursor-pointer items-center gap-2">
+ <div className="inline-flex items-center gap-2">
<span className="text-[12px] text-muted">{t('channelList.showInactive')}</span>
- <input
- type="checkbox"
- checked={showInactive}
- onChange={(e) => setShowInactive(e.target.checked)}
- className="sr-only"
+ <ToggleSwitch
+ enabled={showInactive}
+ onClick={() => setShowInactive(!showInactive)}
/>
- <span
- className={clsx(
- 'relative inline-flex h-[18px] w-[30px] items-center rounded-full transition-colors',
- showInactive ? 'bg-mint' : 'bg-border-strong'
- )}
- >
- <span
- className={clsx(
- 'inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform',
- showInactive ? 'translate-x-[14px]' : 'translate-x-0.5'
- )}
- />
- </span>
- </label>
+ </div>
</div>
{/* Channel rows — design.pen JrNBe / M8FRiG / KywfU */}
@@ -1166,37 +1152,23 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
)}
>
{/* Top row */}
- <button
- type="button"
+ <div
+ role="button"
+ tabIndex={0}
onClick={() => setExpandedChannelId(expanded ? null : rowKey)}
- className="flex w-full items-center gap-3.5 px-5 py-3.5 text-left"
+ onKeyDown={(e) => {
+ if (e.key === ' ' || e.key === 'Enter') {
+ e.preventDefault();
+ setExpandedChannelId(expanded ? null : rowKey);
+ }
+ }}
+ className="flex w-full cursor-pointer items-center gap-3.5 px-5 py-3.5 text-left"
>
{/* Toggle */}
- <span
- role="switch"
- aria-checked={channelEnabled}
- tabIndex={0}
- onClick={(e) => {
- e.stopPropagation();
- updateRow({ enabled: !channelEnabled });
- }}
- onKeyDown={(e) => {
- if (e.key === ' ' || e.key === 'Enter') {
- e.preventDefault();
- e.stopPropagation();
- updateRow({ enabled: !channelEnabled });
- }
- }}
- className={clsx(
- 'relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full transition-colors',
- channelEnabled ? 'bg-mint' : 'bg-border-strong'
- )}
- >
- <span
- className={clsx(
- 'inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform',
- channelEnabled ? 'translate-x-[14px]' : 'translate-x-0.5'
- )}
+ <span onClick={(e) => e.stopPropagation()}>
+ <ToggleSwitch
+ enabled={channelEnabled}
+ onClick={() => updateRow({ enabled: !channelEnabled })}
/>
</span>
@@ -1244,7 +1216,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
) : (
<ChevronDown size={18} className="shrink-0 text-muted" />
)}
- </button>
+ </div>
{/* Expanded body — design.pen asPXu (VR/RoutingConfig) — shared with /users */}
{expanded && (
@@ -1442,16 +1414,16 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
<div className="grid gap-3 md:grid-cols-[minmax(220px,280px)_1fr]">
<div className="space-y-1">
<label className="font-medium text-foreground">{t('channelList.guildBrowse')}</label>
- <select
+ <CompactSelect
value={selectedGuild}
onChange={(e) => updateSelectedGuild(e.target.value)}
- className="w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-foreground focus:outline-none focus:border-cyan"
+ className="w-full"
>
<option value="">{t('channelList.guildPlaceholder')}</option>
{knownDiscordGuilds.map((g) => (
<option key={g.id} value={g.id}>{g.name}</option>
))}
- </select>
+ </CompactSelect>
</div>
<div className="space-y-2">
<div className="flex flex-wrap items-center justify-between gap-2">
diff --git a/ui/src/components/steps/Summary.tsx b/ui/src/components/steps/Summary.tsx
index a3cc2c574..2a0ef6522 100644
--- a/ui/src/components/steps/Summary.tsx
+++ b/ui/src/components/steps/Summary.tsx
@@ -19,6 +19,7 @@ import { useToast } from '../../context/ToastContext';
import { copyTextToClipboard } from '../../lib/utils';
import { getEnabledPlatforms, getPrimaryPlatform } from '../../lib/platforms';
import { EyebrowBadge, WizardCard } from '../visual';
+import { ToggleSwitch } from '../settings/SettingsPrimitives';
interface SummaryProps {
data: any;
@@ -286,10 +287,13 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
className="flex items-center justify-between rounded-lg border border-border bg-surface-2 px-3 py-2"
>
<span className="text-[12px] font-medium text-foreground">{titleCase(platform)}</span>
- <Switch
- checked={!!requireMentionByPlatform[platform]}
- onChange={(value) =>
- setRequireMentionByPlatform((current) => ({ ...current, [platform]: value }))
+ <ToggleSwitch
+ enabled={!!requireMentionByPlatform[platform]}
+ onClick={() =>
+ setRequireMentionByPlatform((current) => ({
+ ...current,
+ [platform]: !current[platform],
+ }))
}
/>
</div>
@@ -304,7 +308,7 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
<h3 className="text-[13px] font-semibold text-foreground">{t('summary.autoUpdate')}</h3>
<p className="mt-0.5 text-[11px] text-muted">{t('summary.autoUpdateHint')}</p>
</div>
- <Switch checked={autoUpdate} onChange={setAutoUpdate} />
+ <ToggleSwitch enabled={autoUpdate} onClick={() => setAutoUpdate((v: boolean) => !v)} />
</div>
{/* Quick start tips */}
@@ -366,28 +370,6 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
);
};
-const Switch: React.FC<{ checked: boolean; onChange: (next: boolean) => void }> = ({ checked, onChange }) => (
- <button
- type="button"
- role="switch"
- aria-checked={checked}
- onClick={() => onChange(!checked)}
- className={clsx(
- 'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border transition-colors focus:outline-none focus:ring-2 focus:ring-mint/40',
- checked
- ? 'border-mint/50 bg-mint shadow-[0_0_12px_-2px_rgba(91,255,160,0.6)]'
- : 'border-border-strong bg-border-strong'
- )}
- >
- <span
- className={clsx(
- 'inline-block size-3.5 rounded-full bg-background shadow transition-transform',
- checked ? 'translate-x-[18px]' : 'translate-x-1'
- )}
- />
- </button>
-);
-
const Tip: React.FC<{
icon: React.ReactNode;
tone: 'cyan' | 'gold' | 'mint';
diff --git a/ui/src/components/steps/TelegramConfig.tsx b/ui/src/components/steps/TelegramConfig.tsx
index 91cc7756a..3db867d0d 100644
--- a/ui/src/components/steps/TelegramConfig.tsx
+++ b/ui/src/components/steps/TelegramConfig.tsx
@@ -20,6 +20,7 @@ import { copyTextToClipboard } from '../../lib/utils';
import { EmbeddedConfigShell, EyebrowBadge, WizardCard } from '../visual';
import { ProxyUrlField } from '../shared/ProxyUrlField';
import { StepHeader, StepShell } from '../shared/WizardStep';
+import { ToggleSwitch } from '../settings/SettingsPrimitives';
interface TelegramConfigProps {
data: any;
@@ -350,22 +351,20 @@ export const TelegramConfig: React.FC<TelegramConfigProps> = ({ data, onNext, on
<div className="space-y-3 border-t border-border px-5 py-4">
<p className="text-[13px] leading-[1.55] text-muted">{t('telegramConfig.step5Description')}</p>
- <label className="flex items-start justify-between gap-4 rounded-lg border border-border bg-background px-3 py-2.5">
+ <div className="flex items-start justify-between gap-4 rounded-lg border border-border bg-background px-3 py-2.5">
<div>
<div className="text-[12px] font-semibold text-foreground">
{t('telegramConfig.requireMention')}
</div>
<p className="mt-0.5 text-[11px] text-muted">{t('telegramConfig.requireMentionHint')}</p>
</div>
- <input
- type="checkbox"
- checked={requireMention}
- onChange={(e) => setRequireMention(e.target.checked)}
- className="mt-1 size-4 accent-mint"
+ <ToggleSwitch
+ enabled={requireMention}
+ onClick={() => setRequireMention(!requireMention)}
/>
- </label>
+ </div>
- <label className="flex items-start justify-between gap-4 rounded-lg border border-border bg-background px-3 py-2.5">
+ <div className="flex items-start justify-between gap-4 rounded-lg border border-border bg-background px-3 py-2.5">
<div className="pr-4">
<div className="flex items-center gap-2 text-[12px] font-semibold text-foreground">
<SplitSquareVertical size={14} className="text-cyan" />
@@ -373,13 +372,11 @@ export const TelegramConfig: React.FC<TelegramConfigProps> = ({ data, onNext, on
</div>
<p className="mt-0.5 text-[11px] text-muted">{t('telegramConfig.forumAutoTopicHint')}</p>
</div>
- <input
- type="checkbox"
- checked={forumAutoTopic}
- onChange={(e) => setForumAutoTopic(e.target.checked)}
- className="mt-1 size-4 accent-mint"
+ <ToggleSwitch
+ enabled={forumAutoTopic}
+ onClick={() => setForumAutoTopic(!forumAutoTopic)}
/>
- </label>
+ </div>
</div>
)}
</StepShell>
diff --git a/ui/src/components/steps/UserList.tsx b/ui/src/components/steps/UserList.tsx
index 9e6902c84..33613e1e8 100644
--- a/ui/src/components/steps/UserList.tsx
+++ b/ui/src/components/steps/UserList.tsx
@@ -22,6 +22,7 @@ import { DirectoryBrowser } from '../ui/directory-browser';
import { copyTextToClipboard } from '../../lib/utils';
import { PlatformIcon } from '../visual';
import { RoutingConfigPanel } from '../shared/RoutingConfigPanel';
+import { ToggleSwitch } from '../settings/SettingsPrimitives';
interface UserConfig {
display_name: string;
@@ -695,28 +696,13 @@ export const UserList: React.FC = () => {
{totalCount}
</span>
</div>
- <label className="flex cursor-pointer items-center gap-1.5 text-[12px] text-muted">
+ <div className="flex items-center gap-1.5 text-[12px] text-muted">
<span>{t('userList.showDisabled')}</span>
- <input
- type="checkbox"
- checked={showDisabled}
- onChange={(e) => setShowDisabled(e.target.checked)}
- className="sr-only"
+ <ToggleSwitch
+ enabled={showDisabled}
+ onClick={() => setShowDisabled(!showDisabled)}
/>
- <span
- className={clsx(
- 'relative inline-flex h-[18px] w-[30px] items-center rounded-full transition-colors',
- showDisabled ? 'bg-mint' : 'bg-border-strong'
- )}
- >
- <span
- className={clsx(
- 'inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform',
- showDisabled ? 'translate-x-[14px]' : 'translate-x-0.5'
- )}
- />
- </span>
- </label>
+ </div>
</div>
{/* User cards — design.pen asPXu (VR/RoutingConfig) shared with /groups */}
@@ -761,34 +747,23 @@ export const UserList: React.FC = () => {
)}
>
{/* Master row — matches /groups layout */}
- <button
- type="button"
+ <div
+ role="button"
+ tabIndex={0}
onClick={() => setExpandedKey(expanded ? null : u.key)}
- className="flex w-full items-center gap-3.5 px-5 py-3.5 text-left"
+ onKeyDown={(e) => {
+ if (e.key === ' ' || e.key === 'Enter') {
+ e.preventDefault();
+ setExpandedKey(expanded ? null : u.key);
+ }
+ }}
+ className="flex w-full cursor-pointer items-center gap-3.5 px-5 py-3.5 text-left"
>
{/* Enabled toggle */}
- <span
- role="switch"
- aria-checked={userConfig.enabled}
- tabIndex={0}
- onClick={(e) => { e.stopPropagation(); toggleEnabled(); }}
- onKeyDown={(e) => {
- if (e.key === ' ' || e.key === 'Enter') {
- e.preventDefault();
- e.stopPropagation();
- toggleEnabled();
- }
- }}
- className={clsx(
- 'relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full transition-colors',
- userConfig.enabled ? 'bg-mint' : 'bg-border-strong'
- )}
- >
- <span
- className={clsx(
- 'inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform',
- userConfig.enabled ? 'translate-x-[14px]' : 'translate-x-0.5'
- )}
+ <span onClick={(e) => e.stopPropagation()}>
+ <ToggleSwitch
+ enabled={userConfig.enabled}
+ onClick={toggleEnabled}
/>
</span>
@@ -863,7 +838,7 @@ export const UserList: React.FC = () => {
) : (
<ChevronDown size={18} className="shrink-0 text-muted" />
)}
- </button>
+ </div>
{/* Expanded body — design.pen asPXu (VR/RoutingConfig) shared with /groups, no @mention toggle */}
{expanded && (