upload mission

This commit is contained in:
Виталий Лавшонок
2025-11-02 13:15:12 +03:00
parent 99018537c5
commit 59f89d5113
18 changed files with 312 additions and 115 deletions

View File

@@ -0,0 +1,507 @@
import MissionItem from "./MissionItem";
import { SecondaryButton } from "../../../components/button/SecondaryButton";
import { useAppDispatch } from "../../../redux/hooks";
import { useEffect } from "react";
import { setMenuActivePage } from "../../../redux/slices/store";
export interface Mission {
id: number;
authorId: number;
name: string;
difficulty: "Easy" | "Medium" | "Hard";
tags: string[];
timeLimit: number;
memoryLimit: number;
createdAt: string;
updatedAt: string;
}
const Missions = () => {
const dispatch = useAppDispatch();
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"
}
];
useEffect(() => {
dispatch(setMenuActivePage("missions"))
}, []);
return (
<div className=" h-full w-full box-border p-[20px] pt-[20px]">
<div className="h-full box-border">
<div className="relative flex items-center mb-[20px]">
<div className="h-[50px] text-[40px] font-bold text-liquid-white flex items-center">
Задачи
</div>
<SecondaryButton
onClick={() => {}}
text="Создать задачу"
className="absolute right-0"
/>
</div>
<div className="bg-liquid-lighter h-[50px] mb-[20px]">
</div>
<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")}/>
))}
</div>
<div>
pages
</div>
</div>
</div>
);
};
export default Missions;