'use client'; import LanguageSwitch from '@/components/language-switch'; import ThemeSwitch from '@/components/theme-switch'; import useGlobalStore from '@/config/use-global'; import { oAuthLogin } from '@/services/common/oauth'; import { DotLottieReact } from '@lottiefiles/dotlottie-react'; import { Button } from '@workspace/ui/components/button'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@workspace/ui/components/tabs'; import { Icon } from '@workspace/ui/custom-components/icon'; import LoginLottie from '@workspace/ui/lotties/login.json'; import { useTranslations } from 'next-intl'; import Image from 'next/legacy/image'; import Link from 'next/link'; import EmailAuthForm from './email/auth-form'; import PhoneAuthForm from './phone/auth-form'; const icons = { apple: 'uil:apple', google: 'logos:google-icon', facebook: 'logos:facebook', github: 'uil:github', telegram: 'logos:telegram', }; export default function Page() { const t = useTranslations('auth'); const { common } = useGlobalStore(); const { site, auth, oauth_methods } = common; const AUTH_COMPONENT_MAP = { email: , sms: , } as const; type AuthMethod = keyof typeof AUTH_COMPONENT_MAP; const enabledAuthMethods = (Object.keys(AUTH_COMPONENT_MAP) as AuthMethod[]).filter((key) => { const value = auth[key]; const enabledKey = `${key}_enabled` as const; if (typeof value !== 'object' || value === null) { return false; } if (!(enabledKey in value)) { return false; } const isEnabled = (value as unknown as Record)[enabledKey]; return isEnabled; }); return (
{site.site_logo && ( logo )} {site.site_name}

{site.site_desc}

{t('verifyAccount')}

{t('verifyAccountDesc')}
{enabledAuthMethods.length === 1 ? AUTH_COMPONENT_MAP[enabledAuthMethods[0] as AuthMethod] : enabledAuthMethods[0] && ( {enabledAuthMethods.map((method) => ( {t(`methods.${method}`)} ))} {enabledAuthMethods.map((method) => ( {AUTH_COMPONENT_MAP[method]} ))} )}
{oauth_methods?.length > 0 && ( <>
Or continue with
{oauth_methods?.map((method: any) => { return ( ); })}
)}
{t('tos')}
); }