mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 01:19:31 +08:00
* fix(web): refine knowledge and settings accessibility and layout Name row controls from their visible titles, portal tooltip descriptions out of tablists, and make the knowledge tabs keyboard-complete. Also stack the KB master-detail on phones, add a section-scroll hint, demote the indexing diagnostic to its detail tab, and consolidate the knowledge type scale. * perf(web): cut knowledge and settings payload Serve raster engine marks through next/image, stop preloading the serif face on pages that do not use it, and prefetch settings routes only on hover or keyboard focus instead of on first paint. * docs(perf): record knowledge and settings audit Document the protocol, baseline and after medians, payload and accessibility results, limits, and reproduction commands, with mobile before/after screenshots. * test(web): match the model row's visible accessible name The row no longer overrides its name with a provider-first aria-label; select it by the model-first text a screen reader now reads, which also contains the visible default/task badge. * fix(web): keep the MinerU download-type name in the locale catalog Reuse the existing Download models and Type strings instead of introducing a new t() literal, so the strict i18n audit stays green. * docs(perf): link the UI audit from the handbook index The docs contract requires every guide under docs-for-dev to be reachable from README.md. * docs(perf): record the isolated knowledge-detail LCP Re-measured the detail route with the host pinned away from unrelated work; the 668 ms row was contention, while the isolated median is 568 ms and the stable repeats overlap the baseline. --------- Co-authored-by: Antonio-Faure <209759495+Antonio-Faure@users.noreply.github.com>
39 lines
1015 B
TypeScript
39 lines
1015 B
TypeScript
"use client";
|
|
|
|
import { useSettingRowLabelId } from "./shared";
|
|
|
|
export function Toggle({
|
|
checked,
|
|
onChange,
|
|
disabled,
|
|
label,
|
|
}: {
|
|
checked: boolean;
|
|
onChange: (next: boolean) => void;
|
|
disabled?: boolean;
|
|
/** Standalone use; inside a `SettingRow` the row title is used instead. */
|
|
label?: string;
|
|
}) {
|
|
const rowLabelId = useSettingRowLabelId();
|
|
return (
|
|
<button
|
|
type="button"
|
|
role="switch"
|
|
aria-checked={checked}
|
|
aria-label={label}
|
|
aria-labelledby={label ? undefined : rowLabelId}
|
|
disabled={disabled}
|
|
onClick={() => onChange(!checked)}
|
|
className={`relative h-5 w-9 shrink-0 rounded-full transition-colors disabled:opacity-40 ${
|
|
checked ? "bg-[var(--foreground)]" : "bg-[var(--border)]"
|
|
}`}
|
|
>
|
|
<span
|
|
className={`absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-[var(--background)] shadow-sm transition-transform ${
|
|
checked ? "translate-x-4" : "translate-x-0"
|
|
}`}
|
|
/>
|
|
</button>
|
|
);
|
|
}
|