diff --git a/src/renderer/components/GradientTextField.tsx b/src/renderer/components/GradientTextField.tsx new file mode 100644 index 0000000..085f3ab --- /dev/null +++ b/src/renderer/components/GradientTextField.tsx @@ -0,0 +1,90 @@ +// GradientTextField.tsx +import React from 'react'; +import TextField, { TextFieldProps } from '@mui/material/TextField'; + +const GRADIENT = + 'linear-gradient(71deg, #F27121 0%, #E940CD 70%, #8A2387 100%)'; + +const GradientTextField: React.FC = ({ sx, ...props }) => { + return ( + + ); +}; + +export default GradientTextField; diff --git a/src/renderer/components/Login/AuthForm.tsx b/src/renderer/components/Login/AuthForm.tsx index 5237807..9891a44 100644 --- a/src/renderer/components/Login/AuthForm.tsx +++ b/src/renderer/components/Login/AuthForm.tsx @@ -1,4 +1,5 @@ import { Box, Button, TextField, Typography } from '@mui/material'; +import GradientTextField from '../../components/GradientTextField'; interface AuthFormProps { config: { @@ -19,72 +20,38 @@ const AuthForm = ({ config, handleInputChange, onLogin }: AuthFormProps) => { alignItems: 'center', }} > - Логин - - Пароль - - diff --git a/src/renderer/pages/Registration.tsx b/src/renderer/pages/Registration.tsx index 1c9f52d..fc58563 100644 --- a/src/renderer/pages/Registration.tsx +++ b/src/renderer/pages/Registration.tsx @@ -24,6 +24,7 @@ import { } from '../api'; import QRCodeStyling from 'qr-code-styling'; import popalogo from '../../../assets/icons/popa-popa.svg'; +import GradientTextField from '../components/GradientTextField'; const ColorlibConnector = styled(StepConnector)(({ theme }) => ({ [`&.${stepConnectorClasses.alternativeLabel}`]: { @@ -32,7 +33,8 @@ const ColorlibConnector = styled(StepConnector)(({ theme }) => ({ [`&.${stepConnectorClasses.active}`]: { [`& .${stepConnectorClasses.line}`]: { backgroundImage: - 'linear-gradient( 95deg,rgb(242,113,33) 0%,rgb(233,64,87) 50%,rgb(138,35,135) 100%)', + //'linear-gradient( 95deg,rgb(242,113,33) 0%,rgb(233,64,87) 50%,rgb(138,35,135) 100%)', + 'linear-gradient( 95deg,rgb(150,150,150) 0%, rgb(242,113,33) 80%,rgb(233,64,87) 110%,rgb(138,35,135) 150%)' }, }, [`&.${stepConnectorClasses.completed}`]: { @@ -44,8 +46,9 @@ const ColorlibConnector = styled(StepConnector)(({ theme }) => ({ [`& .${stepConnectorClasses.line}`]: { height: 3, border: 0, - backgroundColor: '#eaeaf0', + backgroundImage: 'linear-gradient( 275deg,rgb(150,150,150) 0%, rgb(242,113,33) 80%,rgb(233,64,87) 110%,rgb(138,35,135) 150%)', borderRadius: 1, + transition: 'background-image 1s ease, background-color 1s ease', ...theme.applyStyles('dark', { backgroundColor: theme.palette.grey[800], }), @@ -55,7 +58,7 @@ const ColorlibConnector = styled(StepConnector)(({ theme }) => ({ const ColorlibStepIconRoot = styled('div')<{ ownerState: { completed?: boolean; active?: boolean }; }>(({ theme }) => ({ - backgroundColor: '#ccc', + backgroundColor: '#adadad', zIndex: 1, color: '#fff', width: 50, @@ -64,6 +67,7 @@ const ColorlibStepIconRoot = styled('div')<{ borderRadius: '50%', justifyContent: 'center', alignItems: 'center', + transition: 'background-image 1s ease, box-shadow 1s ease, transform 1s ease', ...theme.applyStyles('dark', { backgroundColor: theme.palette.grey[700], }), @@ -74,13 +78,14 @@ const ColorlibStepIconRoot = styled('div')<{ backgroundImage: 'linear-gradient( 136deg, rgb(242,113,33) 0%, rgb(233,64,87) 50%, rgb(138,35,135) 100%)', boxShadow: '0 4px 10px 0 rgba(0,0,0,.25)', + transform: 'scale(1.08)', }, }, { props: ({ ownerState }) => ownerState.completed, style: { backgroundImage: - 'linear-gradient( 136deg, rgb(242,113,33) 0%, rgb(233,64,87) 50%, rgb(138,35,135) 100%)', + '#adadad', }, }, ], @@ -142,6 +147,7 @@ export const Registration = () => { const [activeStep, setActiveStep] = useState(0); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); + const [enterpassword, setEnterPassword] = useState(''); const [open, setOpen] = useState(false); const [message, setMessage] = useState(''); const [verificationCode, setVerificationCode] = useState(null); @@ -162,7 +168,22 @@ export const Registration = () => { }, [url]); const handleCreateAccount = async () => { + // простая валидация на фронте + if (!username || !password || !enterpassword) { + setOpen(true); + setMessage('Заполните все поля'); + return; + } + + if (password !== enterpassword) { + setOpen(true); + setMessage('Пароли не совпадают'); + return; + } + + // тут уже точно всё ок — отправляем запрос const response = await registerUser(username, password); + if (response.status === 'success') { setActiveStep(1); } else { @@ -253,27 +274,33 @@ export const Registration = () => { }; return ( - + <> } + sx={{ + position: 'absolute', + top: '10%', + }} // чтобы отделить степпер от формы > {steps.map((label) => ( { ))} - {activeStep === 0 && ( - - Создание аккаунта - Введите ваш никнейм - setUsername(e.target.value)} + + + {activeStep === 0 && ( + - Введите ваш пароль - setPassword(e.target.value)} + > + setUsername(e.target.value)} + /> + setPassword(e.target.value)} + /> + setEnterPassword(e.target.value)} + error={Boolean(enterpassword) && password !== enterpassword} + helperText={ + Boolean(enterpassword) && password !== enterpassword + ? 'Пароли не совпадают' + : '⠀' + } + sx={{ mb: '0vw' }} + /> + + + )} + + {activeStep === 1 && ( + - - - )} - {activeStep === 1 && ( - - Откройте бота в телеграмме - -
- - Введите код верификации в боте - - {verificationCode ? ( - <> - - {verificationCode} - - Ждем ответа от бота + +
+ + Введите код верификации в боте + + {verificationCode ? ( + <> + + {verificationCode} + + Ждем ответа от бота + + + ) : ( - - ) : ( - - )} - - )} - - + )} + + )} + + + + ); };