From 9696a4dcc3dac4a55679dbaa70becbcbc91c8295 Mon Sep 17 00:00:00 2001 From: Kirill Date: Fri, 22 May 2026 13:24:35 +0500 Subject: [PATCH] feat(client): redesign auth page with minimal style, BearLogo, pill buttons --- .../pages/auth/__tests__/AuthPage.test.tsx | 6 +- client/src/pages/auth/ui/AuthPage.tsx | 328 ++++++++++++------ 2 files changed, 228 insertions(+), 106 deletions(-) diff --git a/client/src/pages/auth/__tests__/AuthPage.test.tsx b/client/src/pages/auth/__tests__/AuthPage.test.tsx index 05e2f32..d686ffc 100644 --- a/client/src/pages/auth/__tests__/AuthPage.test.tsx +++ b/client/src/pages/auth/__tests__/AuthPage.test.tsx @@ -24,9 +24,9 @@ function renderPage() { describe('AuthPage', () => { it('renders three tabs', () => { renderPage() - expect(screen.getByRole('tab', { name: 'Пароль' })).toBeTruthy() - expect(screen.getByRole('tab', { name: 'Код' })).toBeTruthy() - expect(screen.getByRole('tab', { name: 'Другой способ' })).toBeTruthy() + expect(screen.getByRole('button', { name: 'Пароль' })).toBeTruthy() + expect(screen.getByRole('button', { name: 'Код' })).toBeTruthy() + expect(screen.getByRole('button', { name: 'Другой способ' })).toBeTruthy() }) it('shows login form by default on tab 0', () => { diff --git a/client/src/pages/auth/ui/AuthPage.tsx b/client/src/pages/auth/ui/AuthPage.tsx index 99182b7..2f59857 100644 --- a/client/src/pages/auth/ui/AuthPage.tsx +++ b/client/src/pages/auth/ui/AuthPage.tsx @@ -1,19 +1,22 @@ import { useEffect, useState } from 'react' +import { alpha, useTheme } from '@mui/material/styles' import Alert from '@mui/material/Alert' import Box from '@mui/material/Box' import Button from '@mui/material/Button' +import InputAdornment from '@mui/material/InputAdornment' +import Paper from '@mui/material/Paper' import Stack from '@mui/material/Stack' -import Tab from '@mui/material/Tab' -import Tabs from '@mui/material/Tabs' import TextField from '@mui/material/TextField' import Typography from '@mui/material/Typography' import { useMutation } from '@tanstack/react-query' import { useUnit } from 'effector-react' +import { Lock, Mail } from 'lucide-react' import { useForm } from 'react-hook-form' import { useNavigate, useSearchParams } from 'react-router-dom' import { OAuthButtons } from '@/features/auth-oauth' import { apiClient } from '@/shared/api/client' import { $user, tokenSet } from '@/shared/model/auth' +import { BearLogo } from '@/shared/ui/BearLogo' type AuthResponse = { token: string @@ -36,6 +39,7 @@ function getApiErrorMessage(err: unknown): string | null { } export function AuthPage() { + const theme = useTheme() const [message, setMessage] = useState(null) const [oauthError, setOauthError] = useState(null) const [tab, setTab] = useState(0) @@ -112,121 +116,239 @@ export function AuthPage() { getApiErrorMessage(requestCode.error) || getApiErrorMessage(verifyCode.error) - const passwordError = isRegister && passwordConfirm && password !== passwordConfirm ? 'Пароли не совпадают' : null + const passwordError = + isRegister && passwordConfirm && password !== passwordConfirm ? 'Пароли не совпадают' : null return ( - - - Вход / регистрация - + + + + + - {message && ( - - {message} - - )} - {oauthError && ( - setOauthError(null)}> - {oauthError} - - )} - {errMsg && ( - - {errMsg} - - )} + + Добро пожаловать в Любимый Креатив + - setTab(v)} sx={{ mb: 3 }}> - - - - + + Войдите или зарегистрируйтесь, чтобы продолжить + - {tab === 0 && ( - - - - + + + {[ + { label: 'Пароль', idx: 0 }, + { label: 'Код', idx: 1 }, + { label: 'Другой способ', idx: 2 }, + ].map(({ label, idx }) => ( + + ))} - - - {isRegister && ( - + {(errMsg || oauthError) && ( + { + setOauthError(null) + }} + > + {errMsg || oauthError} + + )} + {message && ( + setMessage(null)}> + {message} + )} - + {tab === 0 && ( + + + + + - {isRegister && ( - + + + + ), + }, + }} + /> + + {isRegister && ( + + )} + + + + + ), + }, + }} + /> + + {isRegister && ( + + )} + + {isRegister ? ( + + ) : ( + + )} + )} - {isRegister ? ( - - ) : ( - + {tab === 1 && ( + + + + + ), + }, + }} + /> + + + + + + )} - - )} - {tab === 1 && ( - - - - - - - - - )} - - {tab === 2 && ( - - - - )} + {tab === 2 && ( + + + + )} + + ) }