From 802e296246a9ca3e9a32f6beb85dd1d0cb2e7623 Mon Sep 17 00:00:00 2001 From: Lekler Date: Wed, 28 Jan 2026 04:35:14 -0300 Subject: [PATCH] fix(ui): address PR review feedback (duplicates, types, labels) --- ui/src/i18n/lib/translate.ts | 8 ++------ ui/src/i18n/lib/types.ts | 2 +- ui/src/ui/app-render.ts | 24 ++---------------------- ui/src/ui/views/overview.ts | 1 + 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/ui/src/i18n/lib/translate.ts b/ui/src/i18n/lib/translate.ts index e7e62c9cb..9cef0696c 100644 --- a/ui/src/i18n/lib/translate.ts +++ b/ui/src/i18n/lib/translate.ts @@ -40,11 +40,7 @@ class Translator { setLocale(locale: string) { if (this.locale === locale) return; this.locale = locale; - try { - localStorage.setItem('moltbot-locale', locale); - } catch (e) { - // ignore - } + // localStorage persistence is handled by the app's UiSettings to avoid sync issues. this.notify(); } @@ -68,7 +64,7 @@ class Translator { private resolve(table: TranslationMap | undefined, key: string): any { if (!table) return undefined; - return key.split('.').reduce((obj, i) => (obj ? obj[i] : null), table); + return key.split('.').reduce((obj, i) => (obj ? (obj as any)[i] : null), table); } private interpolate(text: string, params?: Record) { diff --git a/ui/src/i18n/lib/types.ts b/ui/src/i18n/lib/types.ts index 5570eb34e..00776e3b5 100644 --- a/ui/src/i18n/lib/types.ts +++ b/ui/src/i18n/lib/types.ts @@ -1 +1 @@ -export type TranslationMap = Record; // Relaxed type for nested objects +export type TranslationMap = Record; // Relaxed type for nested objects diff --git a/ui/src/ui/app-render.ts b/ui/src/ui/app-render.ts index 75173e8c5..ee18a8377 100644 --- a/ui/src/ui/app-render.ts +++ b/ui/src/ui/app-render.ts @@ -105,7 +105,7 @@ export function renderApp(state: AppViewState) { const presenceCount = state.presenceEntries.length; const sessionsCount = state.sessionsResult?.count ?? null; const cronNext = state.cronStatus?.nextWakeAtMs ?? null; - const chatDisabledReason = state.connected ? null : t("status.disconnected") + " from gateway."; + const chatDisabledReason = state.connected ? null : t("status.disconnected_from_gateway"); const isChat = state.tab === "chat"; const chatFocus = isChat && (state.settings.chatFocusMode || state.onboarding); const showThinking = state.onboarding ? false : state.settings.chatShowThinking; @@ -122,40 +122,28 @@ export function renderApp(state: AppViewState) { state.applySettings({ ...state.settings, navCollapsed: !state.settings.navCollapsed, - })} - @click=${() => - state.applySettings({ - ...state.settings, - navCollapsed: !state.settings.navCollapsed, })} title="${state.settings.navCollapsed ? t("sidebar.expand") : t("sidebar.collapse")}" aria-label="${state.settings.navCollapsed ? t("sidebar.expand") : t("sidebar.collapse")}" > ${icons.menu} - > - ${icons.menu}
-
${t("brand.title")}
${t("brand.subtitle")}
-
-
-
${t("status.health")} ${state.connected ? t("status.ok") : t("status.offline")}
-
${renderThemeToggle(state)}
@@ -177,7 +165,7 @@ export function renderApp(state: AppViewState) { }} aria-expanded=${!isGroupCollapsed} > - ${group.label} + ${t("nav.group." + group.label)} ${isGroupCollapsed ? "+" : "−"} `; })} -