refactor(webui): animate segmented control indicator

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-16 00:43:03 +08:00
1 parent 0374f74bb7
commit 0c4583b7f5
6 files changed
+270 -31

No files matched your search

@@ -954,6 +954,7 @@ function ModelAdvancedFields({
</span>
<SegmentedControl
value={String(contextWindowTokens)}
animateIndicator={false}
options={contextWindowOptions.map((tokens) => ({
value: String(tokens),
label: formatModelContextWindow(tokens),
@@ -38,7 +38,6 @@ import type {
} from "@/lib/local-preferences";
import { providerBrand, providerDisplayLabel } from "@/lib/provider-brand";
import type { SettingsPayload } from "@/lib/types";
import { cn } from "@/lib/utils";
import { useClient } from "@/providers/ClientProvider";
export function OverviewSettings({
@@ -275,30 +274,19 @@ export function AppearanceSettings({
<SettingsSectionTitle>{t("settings.sections.interface")}</SettingsSectionTitle>
<SettingsGroup>
<SettingsRow title={t("settings.rows.theme")}>
<button
type="button"
onClick={onToggleTheme}
className="inline-flex h-8 items-center rounded-full bg-muted p-0.5 text-[12px] font-medium text-muted-foreground"
>
<span
className={cn(
"rounded-full px-3 py-1 transition-colors",
theme === "light" &&
"bg-background text-foreground ring-1 ring-inset ring-border/45",
)}
>
{t("settings.values.light")}
</span>
<span
className={cn(
"rounded-full px-3 py-1 transition-colors",
theme === "dark" &&
"bg-background text-foreground ring-1 ring-inset ring-border/45",
)}
>
{t("settings.values.dark")}
</span>
</button>
<SegmentedControl
value={theme}
ariaLabel={t("settings.rows.theme")}
className="bg-muted p-0.5"
itemClassName="px-3"
options={[
{ value: "light", label: t("settings.values.light") },
{ value: "dark", label: t("settings.values.dark") },
]}
onChange={(nextTheme) => {
if (nextTheme !== theme) onToggleTheme();
}}
/>
</SettingsRow>
<SettingsRow title={t("settings.rows.language")}>
@@ -254,6 +254,7 @@ export function AutomationsSettings({
value={view}
className="rounded-[var(--radius-panel)] bg-[var(--automation-view-track)]"
itemClassName="min-h-8 rounded-[calc(var(--radius-panel)-0.25rem)]"
indicatorClassName="rounded-[calc(var(--radius-panel)-0.25rem)]"
options={[
{ value: "tasks", label: tx("settings.automations.views.tasks", "Tasks") },
{ value: "calendar", label: tx("settings.automations.views.calendar", "Calendar") },