fix(webui): keep local appearance ready during settings loads
This commit is contained in:
1 parent
ef8271b2c0
commit
44a7ef53ce
5 files changed
+72
-23
No files matched your search
@@ -270,15 +270,6 @@ export function SettingsPage({
|
||||
return <AboutSettings settings={settings} />;
|
||||
case "notifications":
|
||||
return <NotificationSettings localPrefs={localPrefs} onChangeLocalPrefs={setLocalPrefs} />;
|
||||
case "appearance":
|
||||
return (
|
||||
<AppearanceSettings
|
||||
themePreference={themePreference}
|
||||
onChangeTheme={onChangeTheme}
|
||||
localPrefs={localPrefs}
|
||||
onChangeLocalPrefs={setLocalPrefs}
|
||||
/>
|
||||
);
|
||||
case "models":
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
@@ -494,6 +485,9 @@ export function SettingsPage({
|
||||
|
||||
const renderSection = (section: SettingsSectionKey, embedded = false): ReactNode => {
|
||||
switch (section) {
|
||||
case "appearance":
|
||||
return <AppearanceSettings themePreference={themePreference} onChangeTheme={onChangeTheme}
|
||||
localPrefs={localPrefs} onChangeLocalPrefs={setLocalPrefs} />;
|
||||
case "channels":
|
||||
return (
|
||||
<ChannelsSettings
|
||||
@@ -623,7 +617,9 @@ export function SettingsPage({
|
||||
return renderSettingsSection(section, embedded);
|
||||
}
|
||||
};
|
||||
const sectionReady = settings !== null || activeSection === "skills" || activeSection === "apps"
|
||||
// Appearance reads only browser-local preferences, not the gateway settings snapshot.
|
||||
const localSection = activeSection === "appearance";
|
||||
const sectionReady = localSection || settings !== null || activeSection === "skills" || activeSection === "apps"
|
||||
|| activeSection === "channels" || activeSection === "automations";
|
||||
|
||||
return (
|
||||
@@ -790,7 +786,7 @@ export function SettingsPage({
|
||||
"flex min-h-0 flex-1 flex-col xl:overflow-hidden",
|
||||
)}
|
||||
>
|
||||
{error ? (
|
||||
{error && (!localSection || settings !== null) ? (
|
||||
<div className="rounded-floating border border-destructive/20 bg-destructive/5 px-4 py-3 text-[13px] text-destructive">
|
||||
{error}
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { SkeletonStatus } from "@/components/settings/shared/SkeletonStatus";
|
||||
import { RUNTIME_CONFIG_FIELDS, RUNTIME_CONFIG_GROUPS, type RuntimeConfigPage } from "@/components/settings/system/runtime-config-fields";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type Control = "switch" | "input" | "duration" | "idle-timeout" | "segments" | "reading" | "theme" | "edit" | "text" | "feature";
|
||||
type Control = "switch" | "input" | "duration" | "idle-timeout" | "segments" | "edit" | "text" | "feature";
|
||||
const block = "rounded bg-muted-foreground/20";
|
||||
|
||||
function Title({ heading = false }: { heading?: boolean }) {
|
||||
@@ -25,11 +25,9 @@ function Row({ control }: { control: Control }) {
|
||||
{control === "feature" ? <div className={cn(block, "mr-3 h-3 w-14")} /> : null}
|
||||
{control === "idle-timeout" ? <div className="flex items-center gap-2">
|
||||
<div className={cn(block, "h-9 w-28 rounded-full")} /><div className={cn(block, "h-3 w-10")} />
|
||||
</div> : control === "duration" ? <div className="w-full"><div className={cn(block, "h-9 w-full rounded-full")} /><div className="mt-1.5 flex h-4 items-center"><div className={cn(block, "h-2.5 w-4/5 opacity-60")} /></div></div> : <div data-skeleton-switch={toggle ? "" : undefined} data-skeleton-reading-size={control === "reading" ? "" : undefined} className={cn(block,
|
||||
</div> : control === "duration" ? <div className="w-full"><div className={cn(block, "h-9 w-full rounded-full")} /><div className="mt-1.5 flex h-4 items-center"><div className={cn(block, "h-2.5 w-4/5 opacity-60")} /></div></div> : <div data-skeleton-switch={toggle ? "" : undefined} className={cn(block,
|
||||
toggle ? "h-5 w-9 shrink-0 rounded-full" : control === "input" ? "h-9 w-full rounded-full"
|
||||
: control === "segments" || control === "reading" || control === "theme" ? "segmented-control w-44 rounded-full" : control === "edit" ? "ml-auto h-9 w-9 rounded-full" : "h-[1lh] w-24 text-ui",
|
||||
(control === "segments" || control === "reading") && "h-[34px]", control === "theme" && "h-8",
|
||||
control === "reading" && "w-36 [@media(pointer:coarse)]:w-40",
|
||||
: control === "segments" ? "segmented-control h-[34px] w-44 rounded-full" : control === "edit" ? "ml-auto h-9 w-9 rounded-full" : "h-[1lh] w-24 text-ui",
|
||||
)} />}
|
||||
</div>
|
||||
</div>;
|
||||
@@ -71,9 +69,6 @@ export function SettingsSectionSkeleton({ section, showRestart = false }: { sect
|
||||
{[0, 1, 2, 3].map((index) => <SettingsGroup key={index}><Row control={index === 3 ? "switch" : "feature"} /></SettingsGroup>)}
|
||||
</>;
|
||||
else switch (section) {
|
||||
case "appearance":
|
||||
content = <><Group controls={["theme", "input"]} /><Group controls={["reading", "segments", "segments", "switch", "switch"]} /></>;
|
||||
break;
|
||||
case "notifications":
|
||||
content = <section><Title /><SettingsGroup>
|
||||
<Row control="switch" />
|
||||
|
||||
Reference in new issue
Block a user