From b16a7c3c2c203394c94ccfee8e829bc7685a2457 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Tue, 1 Oct 2024 01:23:37 +0800 Subject: [PATCH] fix: fix login view split incorrect if not any extra login way --- src/client/routes/login.tsx | 46 +++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/client/routes/login.tsx b/src/client/routes/login.tsx index a616812..e0c17c6 100644 --- a/src/client/routes/login.tsx +++ b/src/client/routes/login.tsx @@ -9,6 +9,7 @@ import { Input } from '@/components/ui/input'; import { useAuth } from '@/api/authjs/useAuth'; import { useEventWithLoading } from '@/hooks/useEvent'; import { LuGithub, LuLayers } from 'react-icons/lu'; +import { compact } from 'lodash-es'; export const Route = createFileRoute('/login')({ validateSearch: z.object({ @@ -44,6 +45,27 @@ function LoginComponent() { }); const { allowRegister, authProvider } = useGlobalConfig(); + const authProviderEl = compact([ + authProvider.includes('github') && ( + + ), + authProvider.includes('custom') && ( + + ), + ]); + return (
@@ -98,31 +120,11 @@ function LoginComponent() { )} - {authProvider.length > 0 && ( + {authProviderEl.length > 0 && ( <> {t('Or')} -
- {authProvider.includes('github') && ( - - )} - - {authProvider.includes('custom') && ( - - )} -
+
{authProviderEl}
)}