statement
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import MissionItem from "./MissionItem";
|
||||
import { SecondaryButton } from "../../../components/button/SecondaryButton";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import { useEffect } from "react";
|
||||
import { setMenuActivePage } from "../../../redux/slices/store";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { fetchMissions } from "../../../redux/slices/missions";
|
||||
|
||||
|
||||
export interface Mission {
|
||||
@@ -17,457 +19,18 @@ export interface Mission {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
|
||||
const Missions = () => {
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
const naivgate = useNavigate();
|
||||
|
||||
const missions: Mission[] = [
|
||||
{
|
||||
"id": 1,
|
||||
"authorId": 1,
|
||||
"name": "Todo List App",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["react", "state", "list"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:13.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:13.000Z"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"authorId": 1,
|
||||
"name": "Search Filter Component",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["filter", "props", "hooks"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:14.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:14.000Z"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"authorId": 1,
|
||||
"name": "User Card List",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["components", "props", "array"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:15.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:15.000Z"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"authorId": 1,
|
||||
"name": "Theme Switcher",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["context", "theme", "hooks"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:16.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:16.000Z"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"authorId": 1,
|
||||
"name": "Debounced Input",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["debounce", "hooks", "events"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:17.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:17.000Z"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"authorId": 1,
|
||||
"name": "Pagination Component",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["pagination", "array", "state"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:18.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:18.000Z"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"authorId": 1,
|
||||
"name": "Modal Window",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["ui", "portal", "events"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:19.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:19.000Z"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"authorId": 1,
|
||||
"name": "Form Validation",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["form", "validation", "hooks"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:20.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:20.000Z"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"authorId": 1,
|
||||
"name": "Countdown Timer",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["timer", "hooks", "state"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:21.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:21.000Z"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"authorId": 1,
|
||||
"name": "Drag And Drop List",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["dragdrop", "array", "events"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:22.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:22.000Z"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"authorId": 1,
|
||||
"name": "Custom Hook Use Fetch",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["hook", "fetch", "async"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:23.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:23.000Z"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"authorId": 1,
|
||||
"name": "Infinite Scroll",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["scroll", "pagination", "api"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:24.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:24.000Z"
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"authorId": 1,
|
||||
"name": "Responsive Navbar",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["css", "layout", "responsive"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:25.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:25.000Z"
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"authorId": 1,
|
||||
"name": "Accordion Component",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["ui", "state", "events"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:26.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:26.000Z"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"authorId": 1,
|
||||
"name": "File Upload Preview",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["file", "events", "preview"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:27.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:27.000Z"
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"authorId": 1,
|
||||
"name": "Dark Mode Toggle",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["theme", "context", "localStorage"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:28.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:28.000Z"
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"authorId": 1,
|
||||
"name": "Realtime Clock",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["date", "state", "interval"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:29.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:29.000Z"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"authorId": 1,
|
||||
"name": "Chart With Recharts",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["chart", "data", "props"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:30.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:30.000Z"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"authorId": 1,
|
||||
"name": "Router Navigation",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["router", "navigation", "hooks"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:31.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:31.000Z"
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"authorId": 1,
|
||||
"name": "Data Table Sortable",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["table", "sort", "filter"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:32.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:32.000Z"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"authorId": 1,
|
||||
"name": "Todo List App",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["react", "state", "list"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:13.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:13.000Z"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"authorId": 1,
|
||||
"name": "Search Filter Component",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["filter", "props", "hooks"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:14.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:14.000Z"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"authorId": 1,
|
||||
"name": "User Card List",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["components", "props", "array"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:15.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:15.000Z"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"authorId": 1,
|
||||
"name": "Theme Switcher",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["context", "theme", "hooks"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:16.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:16.000Z"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"authorId": 1,
|
||||
"name": "Debounced Input",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["debounce", "hooks", "events"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:17.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:17.000Z"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"authorId": 1,
|
||||
"name": "Pagination Component",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["pagination", "array", "state"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:18.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:18.000Z"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"authorId": 1,
|
||||
"name": "Modal Window",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["ui", "portal", "events"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:19.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:19.000Z"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"authorId": 1,
|
||||
"name": "Form Validation",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["form", "validation", "hooks"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:20.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:20.000Z"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"authorId": 1,
|
||||
"name": "Countdown Timer",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["timer", "hooks", "state"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:21.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:21.000Z"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"authorId": 1,
|
||||
"name": "Drag And Drop List",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["dragdrop", "array", "events"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:22.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:22.000Z"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"authorId": 1,
|
||||
"name": "Custom Hook Use Fetch",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["hook", "fetch", "async"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:23.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:23.000Z"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"authorId": 1,
|
||||
"name": "Infinite Scroll",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["scroll", "pagination", "api"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:24.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:24.000Z"
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"authorId": 1,
|
||||
"name": "Responsive Navbar",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["css", "layout", "responsive"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:25.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:25.000Z"
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"authorId": 1,
|
||||
"name": "Accordion Component",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["ui", "state", "events"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:26.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:26.000Z"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"authorId": 1,
|
||||
"name": "File Upload Preview",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["file", "events", "preview"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:27.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:27.000Z"
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"authorId": 1,
|
||||
"name": "Dark Mode Toggle",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["theme", "context", "localStorage"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:28.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:28.000Z"
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"authorId": 1,
|
||||
"name": "Realtime Clock",
|
||||
"difficulty": "Easy",
|
||||
"tags": ["date", "state", "interval"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:29.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:29.000Z"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"authorId": 1,
|
||||
"name": "Chart With Recharts",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["chart", "data", "props"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:30.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:30.000Z"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"authorId": 1,
|
||||
"name": "Router Navigation",
|
||||
"difficulty": "Medium",
|
||||
"tags": ["router", "navigation", "hooks"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:31.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:31.000Z"
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"authorId": 1,
|
||||
"name": "Data Table Sortable",
|
||||
"difficulty": "Hard",
|
||||
"tags": ["table", "sort", "filter"],
|
||||
"timeLimit": 1000,
|
||||
"memoryLimit": 268435456,
|
||||
"createdAt": "2025-10-28T13:23:32.000Z",
|
||||
"updatedAt": "2025-10-28T13:23:32.000Z"
|
||||
}
|
||||
];
|
||||
const missions = useAppSelector((state) => state.missions.missions);
|
||||
|
||||
useEffect(() => {
|
||||
useEffect(() => {
|
||||
dispatch(setMenuActivePage("missions"))
|
||||
}, []);
|
||||
dispatch(fetchMissions({}))
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<div className=" h-full w-full box-border p-[20px] pt-[20px]">
|
||||
@@ -478,7 +41,7 @@ const Missions = () => {
|
||||
Задачи
|
||||
</div>
|
||||
<SecondaryButton
|
||||
onClick={() => {}}
|
||||
onClick={() => {naivgate("/upload")}}
|
||||
text="Создать задачу"
|
||||
className="absolute right-0"
|
||||
/>
|
||||
@@ -491,7 +54,19 @@ const Missions = () => {
|
||||
<div>
|
||||
|
||||
{missions.map((v, i) => (
|
||||
<MissionItem key={i} {...v} type={i % 2 == 0 ? "first" : "second"} status={i == 0 || i == 3 || i == 7 ? "success" : (i == 2 || i == 4 || i == 9 ? "error" : "empty")}/>
|
||||
<MissionItem
|
||||
key={i}
|
||||
id={v.id}
|
||||
authorId={v.authorId}
|
||||
name={v.name}
|
||||
difficulty={"Easy"}
|
||||
tags={v.tags}
|
||||
timeLimit={1000}
|
||||
memoryLimit={256 * 1024 * 1024}
|
||||
createdAt={v.createdAt}
|
||||
updatedAt={v.updatedAt}
|
||||
type={i % 2 == 0 ? "first" : "second"}
|
||||
status={i == 0 || i == 3 || i == 7 ? "success" : (i == 2 || i == 4 || i == 9 ? "error" : "empty")}/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user