missions and filter

This commit is contained in:
Виталий Лавшонок
2025-11-08 06:58:56 +03:00
parent 69655dda82
commit b12a3acf1d
26 changed files with 694 additions and 158 deletions

View File

@@ -1,10 +1,9 @@
import { useEffect } from 'react';
import { useAppDispatch, useAppSelector } from '../../../redux/hooks';
import { setMenuActivePage } from '../../../redux/slices/store';
import { Navigate, Route, Routes, useNavigate, useParams } from 'react-router-dom';
import { Navigate, Route, Routes, useParams } from 'react-router-dom';
import { fetchContestById } from '../../../redux/slices/contests';
import ContestMissions from './Missions';
import { PrimaryButton } from '../../../components/button/PrimaryButton';
import Submissions from './Submissions';
export interface Article {
@@ -14,7 +13,6 @@ export interface Article {
}
const Contest = () => {
const navigate = useNavigate();
const { contestId } = useParams<{ contestId: string }>();
const contestIdNumber =
contestId && /^\d+$/.test(contestId) ? parseInt(contestId, 10) : null;
@@ -22,8 +20,9 @@ const Contest = () => {
return <Navigate to="/home/contests" replace />;
}
const dispatch = useAppDispatch();
const contest = useAppSelector((state) => state.contests.fetchContestById.contest);
const contest = useAppSelector(
(state) => state.contests.fetchContestById.contest,
);
useEffect(() => {
dispatch(setMenuActivePage('contest'));
@@ -34,19 +33,17 @@ const Contest = () => {
}, [contestIdNumber]);
return (
<div className='w-full h-full'>
<div className="w-full h-full">
<Routes>
<Route
path="submissions"
element={<Submissions contest={contest}/>}
element={<Submissions contest={contest} />}
/>
<Route
path="*"
element={<ContestMissions contest={contest}/>}
element={<ContestMissions contest={contest} />}
/>
</Routes>
</div>
);
};