import type { AuthModalMode, AuthModalSearchParams } from './types' import { clsx } from 'clsx' import { Show, Component, createEffect, createMemo } from 'solid-js' import { Dynamic } from 'solid-js/web' import { useLocalize } from '../../../context/localize' import { useRouter } from '../../../stores/router' import { hideModal } from '../../../stores/ui' import { isMobile } from '../../../utils/media-query' import { EmailConfirm } from './EmailConfirm' import { ForgotPasswordForm } from './ForgotPasswordForm' import { LoginForm } from './LoginForm' import { RegisterForm } from './RegisterForm' import styles from './AuthModal.module.scss' const AUTH_MODAL_MODES: Record = { login: LoginForm, register: RegisterForm, 'forgot-password': ForgotPasswordForm, 'confirm-email': EmailConfirm, } export const AuthModal = () => { let rootRef: HTMLDivElement const { t } = useLocalize() const { searchParams } = useRouter() const { source } = searchParams() const mode = createMemo(() => { return AUTH_MODAL_MODES[searchParams().mode] ? searchParams().mode : 'login' }) createEffect((oldMode) => { if (oldMode !== mode() && !isMobile()) { rootRef?.querySelector('input')?.focus() } }, null) return (

{t(`Join the global community of authors!`)}

{t( 'Get to know the most intelligent people of our time, edit and discuss the articles, share your expertise, rate and decide what to publish in the magazine', )} .  {t('New stories every day and even more!')}

{t('By signing up you agree with our')}{' '} { hideModal() }} > {t('terms of use')} , {t('personal data usage and email notifications')}.

{' '}
) }