From 3340e984edf872b78720264f67fe095ec90153af Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Fri, 17 Apr 2026 17:28:37 +0800 Subject: [PATCH] feat(web): improve login error layout and add Terms of Service link - Improve backend connection error display with bordered container, inline icon, and better visual hierarchy - Extract actual error message from axios response object - Add Terms of Service link (https://langbot.app/terms) to login footer - Add termsOfService i18n key for all 7 locales --- web/src/app/login/page.tsx | 45 +++++++++++++++++++++++++-------- web/src/i18n/locales/en-US.ts | 1 + web/src/i18n/locales/es-ES.ts | 3 ++- web/src/i18n/locales/ja-JP.ts | 1 + web/src/i18n/locales/th-TH.ts | 1 + web/src/i18n/locales/vi-VN.ts | 1 + web/src/i18n/locales/zh-Hans.ts | 1 + web/src/i18n/locales/zh-Hant.ts | 1 + 8 files changed, 42 insertions(+), 12 deletions(-) diff --git a/web/src/app/login/page.tsx b/web/src/app/login/page.tsx index 51bd0fb8..cd4da632 100644 --- a/web/src/app/login/page.tsx +++ b/web/src/app/login/page.tsx @@ -75,9 +75,18 @@ export default function Login() { // Also check if already logged in checkIfAlreadyLoggedIn(); } catch (err) { - const errorMessage = - err instanceof Error ? err.message : t('common.loginLoadError'); - setLoadError(errorMessage); + let detail = ''; + if (err instanceof Error) { + detail = err.message; + } else if ( + err && + typeof err === 'object' && + 'msg' in err && + typeof (err as Record).msg === 'string' + ) { + detail = (err as Record).msg as string; + } + setLoadError(detail || t('common.loginLoadError')); setLoading(false); } } @@ -146,8 +155,8 @@ export default function Login() { if (loadError) { return (
- - + +
@@ -161,20 +170,25 @@ export default function Login() { {t('common.welcome')} - -
- -

+ +

+
+ + + {t('common.loginLoadError')} + +
+

{t('common.loginLoadErrorDesc')}

- + {loadError}