From 44b24543d070a5e2e97ee50563175df86158ee81 Mon Sep 17 00:00:00 2001 From: Peifan Li Date: Sat, 3 Jan 2026 16:24:13 -0500 Subject: [PATCH] feat: Add visitor mode in LoginPage component --- frontend/src/pages/LoginPage.tsx | 15 +++-- frontend/src/utils/locales/ar.ts | 21 ++++--- frontend/src/utils/locales/de.ts | 24 +++++--- frontend/src/utils/locales/en.ts | 83 +++++++++++++++---------- frontend/src/utils/locales/es.ts | 24 +++++--- frontend/src/utils/locales/fr.ts | 24 +++++--- frontend/src/utils/locales/ja.ts | 21 ++++--- frontend/src/utils/locales/ko.ts | 21 ++++--- frontend/src/utils/locales/pt.ts | 24 +++++--- frontend/src/utils/locales/ru.ts | 21 ++++--- frontend/src/utils/translations.ts | 98 +++++++++++++++++------------- 11 files changed, 238 insertions(+), 138 deletions(-) diff --git a/frontend/src/pages/LoginPage.tsx b/frontend/src/pages/LoginPage.tsx index 532c820..33f5310 100644 --- a/frontend/src/pages/LoginPage.tsx +++ b/frontend/src/pages/LoginPage.tsx @@ -24,6 +24,7 @@ import AlertModal from '../components/AlertModal'; import ConfirmationModal from '../components/ConfirmationModal'; import { useAuth } from '../contexts/AuthContext'; import { useLanguage } from '../contexts/LanguageContext'; +import { useVisitorMode } from '../contexts/VisitorModeContext'; import getTheme from '../theme'; import { getWebAuthnErrorTranslationKey } from '../utils/translations'; @@ -42,6 +43,7 @@ const LoginPage: React.FC = () => { const [resetPasswordCooldown, setResetPasswordCooldown] = useState(0); // in milliseconds const { t } = useLanguage(); const { login } = useAuth(); + const { visitorMode } = useVisitorMode(); const queryClient = useQueryClient(); // Fetch website name and settings from settings @@ -398,7 +400,12 @@ const LoginPage: React.FC = () => { {websiteName} - {websiteName !== 'MyTube' && ( + {visitorMode && ( + + {t('visitorMode')} + + )} + {websiteName !== 'MyTube' && !visitorMode && ( Powered by MyTube @@ -453,7 +460,7 @@ const LoginPage: React.FC = () => { > {loginMutation.isPending ? (t('verifying') || 'Verifying...') : t('signIn')} - {passkeysExist && ( + {passkeysExist && !visitorMode && ( <> OR )} - {allowResetPassword && ( + {allowResetPassword && !visitorMode && (