This commit is contained in:
Виталий Лавшонок
2025-12-14 17:24:02 +03:00
parent 0c41cc59b9
commit 781945b358
8 changed files with 39 additions and 21 deletions

View File

@@ -2,9 +2,9 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title> <title>LiquidCode</title>
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap" rel="stylesheet">

5
public/logo.svg Normal file
View File

@@ -0,0 +1,5 @@
<svg width="62" height="56" viewBox="0 0 62 56" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16.7765 44.9299V16.6675C16.7765 7.46416 9.26353 0 0 0V44.9299C0.00729412 45.9589 0.153177 50.4447 3.64706 53.626C4.92353 54.7927 6.27294 55.4377 7.29412 55.8H23.3412C22.4221 55.4377 21.2113 54.7927 20.0588 53.626C16.9151 50.4447 16.7838 45.9589 16.7765 44.9299Z" fill="#0C8092"/>
<path d="M35.7412 44.9299V27.5377C35.7412 18.3343 28.2282 10.8701 18.9647 10.8701V44.9299C18.972 45.9589 19.1179 50.4447 22.6118 53.626C23.8882 54.7927 25.2376 55.4377 26.2588 55.8H42.3059C41.3868 55.4377 40.176 54.7927 39.0235 53.626C35.8798 50.4447 35.7485 45.9589 35.7412 44.9299Z" fill="#16A7C6"/>
<path d="M58.3529 53.626C54.8591 50.4447 54.7132 45.9589 54.7059 44.9299V39.1325C54.7059 29.9291 47.1929 22.4649 37.9294 22.4649V44.9299C37.9367 45.9589 38.0826 50.4447 41.5765 53.626C42.8529 54.7927 44.2024 55.4377 45.2235 55.8H62C60.9788 55.4377 59.6294 54.7927 58.3529 53.626Z" fill="#00DBD9"/>
</svg>

After

Width:  |  Height:  |  Size: 993 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,5 +1,6 @@
import { createSlice, createAsyncThunk, PayloadAction } from '@reduxjs/toolkit'; import { createSlice, createAsyncThunk, PayloadAction } from '@reduxjs/toolkit';
import axios from '../../axios'; import axios from '../../axios';
import { toastError } from '../../lib/toastNotification';
type Status = 'idle' | 'loading' | 'successful' | 'failed'; type Status = 'idle' | 'loading' | 'successful' | 'failed';
@@ -85,7 +86,7 @@ export const registerUser = createAsyncThunk(
}); });
return response.data; return response.data;
} catch (err: any) { } catch (err: any) {
return rejectWithValue(err.response?.data?.errors); return rejectWithValue(err.response?.data?.errors ? err.response?.data?.errors : {"error" : [err.response?.data]});
} }
}, },
); );
@@ -216,6 +217,11 @@ const authSlice = createSlice({
builder.addCase(registerUser.rejected, (state, action) => { builder.addCase(registerUser.rejected, (state, action) => {
state.status = 'failed'; state.status = 'failed';
state.register.errors = action.payload as Record<string, string[]>; state.register.errors = action.payload as Record<string, string[]>;
Object.values(state.register.errors).forEach((messages) => {
messages.forEach((msg) => {
toastError(msg);
});
});
}); });
// ----------------- Login ----------------- // ----------------- Login -----------------

View File

@@ -67,7 +67,7 @@ const Login = () => {
</div> </div>
<div className=" relative pointer-events-auto"> <div className=" relative pointer-events-auto">
<div> <div>
<div className="text-[40px] text-liquid-white font-bold h-[50px]"> <div className="text-[35px] text-liquid-white font-bold h-[50px]">
С возвращением С возвращением
</div> </div>
<div className="text-[18px] text-liquid-light font-bold h-[23px]"> <div className="text-[18px] text-liquid-light font-bold h-[23px]">
@@ -100,15 +100,8 @@ const Login = () => {
error={getErrorPasswordMessage()} error={getErrorPasswordMessage()}
/> />
<div className="flex justify-end mt-[10px]"> <div className="flex justify-end mt-[10px] h-[20px]">
<Link
to={''}
className={
'text-liquid-brightmain text-[16px] h-[20px] transition-all hover:underline '
}
>
Забыли пароль?
</Link>
</div> </div>
<div className="mt-[10px]"> <div className="mt-[10px]">

View File

@@ -9,7 +9,7 @@ import { registerUser } from '../../../redux/slices/auth';
import { setMenuActivePage } from '../../../redux/slices/store'; import { setMenuActivePage } from '../../../redux/slices/store';
import { Balloon } from '../../../assets/icons/auth'; import { Balloon } from '../../../assets/icons/auth';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Checkbox } from '../../../components/checkbox/Checkbox'; // import { Checkbox } from '../../../components/checkbox/Checkbox';
function isValidEmail(email: string): boolean { function isValidEmail(email: string): boolean {
const pattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; const pattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
@@ -52,12 +52,13 @@ const Register = () => {
const [password, setPassword] = useState<string>(''); const [password, setPassword] = useState<string>('');
const [confirmPassword, setConfirmPassword] = useState<string>(''); const [confirmPassword, setConfirmPassword] = useState<string>('');
const [submitClicked, setSubmitClicked] = useState<boolean>(false); const [submitClicked, setSubmitClicked] = useState<boolean>(false);
const [politicChecked, setPoliticChecked] = useState<boolean>(false); const [politicChecked, setPoliticChecked] = useState<boolean>(true);
const { status, jwt } = useAppSelector((state) => state.auth); const { status, jwt } = useAppSelector((state) => state.auth);
// const { errors } = useAppSelector((state) => state.auth.register); // const { errors } = useAppSelector((state) => state.auth.register);
useEffect(() => { useEffect(() => {
setPoliticChecked(true);
dispatch(setMenuActivePage('account')); dispatch(setMenuActivePage('account'));
}, []); }, []);
@@ -142,7 +143,7 @@ const Register = () => {
</div> </div>
<div className=" relative pointer-events-auto"> <div className=" relative pointer-events-auto">
<div> <div>
<div className="text-[40px] text-liquid-white font-bold h-[50px]"> <div className="text-[35px] text-liquid-white font-bold h-[50px]">
Добро пожаловать Добро пожаловать
</div> </div>
<div className="text-[18px] text-liquid-light font-bold h-[23px]"> <div className="text-[18px] text-liquid-light font-bold h-[23px]">
@@ -200,7 +201,7 @@ const Register = () => {
/> />
<div className=" flex items-center mt-[10px] h-[24px]"> <div className=" flex items-center mt-[10px] h-[24px]">
<Checkbox {/* <Checkbox
onChange={(value: boolean) => { onChange={(value: boolean) => {
setPoliticChecked(value); setPoliticChecked(value);
}} }}
@@ -215,13 +216,13 @@ const Register = () => {
/> />
<span className="text-[14px] font-medium text-liquid-light h-[18px] ml-[10px]"> <span className="text-[14px] font-medium text-liquid-light h-[18px] ml-[10px]">
Я принимаю{' '} Я принимаю{' '}
{/* <Link to={'/home'} className={' underline'}> <Link to={'/home'} className={' underline'}>
политику конфиденциальности политику конфиденциальности
</Link> */} </Link>
<span className={' underline cursor-pointer'}> <span className={' underline cursor-pointer'}>
политику конфиденциальности политику конфиденциальности
</span> </span>
</span> </span> */}
</div> </div>
<div className="mt-[10px]"> <div className="mt-[10px]">

View File

@@ -14,12 +14,15 @@ import {
} from '../../../redux/slices/contests'; } from '../../../redux/slices/contests';
import ModalCreateContest from './ModalCreate'; import ModalCreateContest from './ModalCreate';
import Filters from './Filter'; import Filters from './Filter';
import { toastWarning } from '../../../lib/toastNotification';
const Contests = () => { const Contests = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [modalActive, setModalActive] = useState<boolean>(false); const [modalActive, setModalActive] = useState<boolean>(false);
const jwt = useAppSelector((state) => state.auth.jwt);
const { contests, status } = useAppSelector( const { contests, status } = useAppSelector(
(state) => state.contests.fetchContests, (state) => state.contests.fetchContests,
); );
@@ -49,6 +52,10 @@ const Contests = () => {
</div> </div>
<SecondaryButton <SecondaryButton
onClick={() => { onClick={() => {
if (!jwt){
toastWarning("Для создания контеста необходимо авторизоваться")
return;
}
setModalActive(true); setModalActive(true);
}} }}
text="Создать контест" text="Создать контест"

View File

@@ -10,6 +10,7 @@ import {
import { fetchMissions } from '../../../redux/slices/missions'; import { fetchMissions } from '../../../redux/slices/missions';
import ModalCreate from './ModalCreate'; import ModalCreate from './ModalCreate';
import Filters from './Filter'; import Filters from './Filter';
import { toastWarning } from '../../../lib/toastNotification';
export interface Mission { export interface Mission {
id: number; id: number;
@@ -29,6 +30,7 @@ const Missions = () => {
const missions = useAppSelector((state) => state.missions.missions); const missions = useAppSelector((state) => state.missions.missions);
const jwt = useAppSelector((state) => state.auth.jwt);
const nameFilter = useAppSelector( const nameFilter = useAppSelector(
(state) => state.store.missions.filterName, (state) => state.store.missions.filterName,
); );
@@ -60,6 +62,11 @@ const Missions = () => {
</div> </div>
<SecondaryButton <SecondaryButton
onClick={() => { onClick={() => {
if (!jwt){
toastWarning("Для загрузки задачи необходимо авторизоваться")
return;
}
setModalActive(true); setModalActive(true);
}} }}
text="Добавить задачу" text="Добавить задачу"