fix(ui): согласовать настройки и контекст Community

This commit is contained in:
Denozordec committed 2026-10-01 01:04:02 +07:00
1 parent 6e6558bde9
commit 5a23dfcfe6
15 files changed
+33 -12

No files matched your search

+9 -8
View File
@@ -245,9 +245,9 @@ function ConfChip({ conf }: { conf: string }) {
return <Chip color={map[conf] ?? map.LOW}>{conf}</Chip>
}
function NInput({ value, onChange, min, max, label }: { label: string; value: number; onChange: (v: number) => void; min?: number; max?: number }) {
function NInput({ value, onChange, min, max, label, disabled }: { disabled?: boolean; label: string; value: number; onChange: (v: number) => void; min?: number; max?: number }) {
return (
<Input aria-label={label} type="number" value={value} min={min} max={max}
<Input disabled={disabled} aria-label={label} type="number" value={value} min={min} max={max}
onChange={e => onChange(Math.max(min ?? 0, Math.min(max ?? 9999, parseInt(e.target.value) || 0)))}
className="w-16 h-7 text-xs font-mono text-right" />
)
@@ -315,7 +315,7 @@ function HomeRouterCard({ entry, jumpHosts, pinned, applied, applying, onPin, on
<div className="ml-auto flex items-center gap-2">
{switchCount > 0 && (
<Chip color="bg-warning/10 text-warning border-warning/20">
{switchCount} переключений
Рекомендаций: {switchCount}
</Chip>
)}
{bestRoute && (
@@ -771,7 +771,7 @@ function RouteOptimizerContent({requestedServer,onSelectServer}:{requestedServer
<SettingsIcon aria-hidden="true" className="size-4 text-muted-foreground shrink-0" />
<span className="text-sm font-medium flex-1">Настройки оптимизатора</span>
<span className="text-[11px] text-muted-foreground mr-2">
порог {settings.switchThreshold}% · ping {settings.pingWeight}% · зондирование {settings.probeIntervalMin} мин
порог {settings.switchThreshold} б. · ping {settings.pingWeight}% · обновление {settings.probeIntervalMin} мин
</span>
{showSettings ? <ChevronUpIcon aria-hidden="true" className="size-4 text-muted-foreground" /> : <ChevronDownIcon aria-hidden="true" className="size-4 text-muted-foreground" />}
</button>
@@ -781,12 +781,13 @@ function RouteOptimizerContent({requestedServer,onSelectServer}:{requestedServer
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
<div className="flex flex-col gap-3">
<p className="text-[10px] font-semibold uppercase tracking-widest text-muted-foreground">Пороги переключения</p>
<SettingRow label="Мин. выигрыш" unit="%">
<SettingRow label="Мин. выигрыш" unit="б.">
<NInput label="Порог переключения" value={settings.switchThreshold} onChange={v => set("switchThreshold", v)} min={0} max={50} />
</SettingRow>
<SettingRow label="Гистерезис" unit="%">
<NInput label="Порог гистерезиса" value={settings.hysteresisThreshold} onChange={v => set("hysteresisThreshold", v)} min={0} max={50} />
<SettingRow label="Гистерезис" unit="б.">
<NInput disabled label="Порог гистерезиса" value={settings.hysteresisThreshold} onChange={v => set("hysteresisThreshold", v)} min={0} max={50} />
</SettingRow>
<p className="text-[10px] text-muted-foreground">Гистерезис не участвует в этом расчёте.</p>
</div>
<div className="flex flex-col gap-3">
<p className="text-[10px] font-semibold uppercase tracking-widest text-muted-foreground">Веса метрик</p>
@@ -800,7 +801,7 @@ function RouteOptimizerContent({requestedServer,onSelectServer}:{requestedServer
<span>Ping {settings.pingWeight}%</span>
<span>BW {100 - settings.pingWeight}%</span>
</div>
<SettingRow label="Интервал зондирования">
<SettingRow label="Обновление расчёта">
<div className="flex rounded-md border border-input overflow-hidden h-7">
{[5, 10, 15, 30].map(v => (
<button type="button" aria-pressed={settings.probeIntervalMin===v} key={v} onClick={() => set("probeIntervalMin", v)}