diff --git a/services/frontend/src/App.tsx b/services/frontend/src/App.tsx index 9c7f555..5af70fa 100644 --- a/services/frontend/src/App.tsx +++ b/services/frontend/src/App.tsx @@ -1,19 +1,19 @@ import { Routes, Route } from "react-router"; import "./styles/globals.css"; -import CompetitionsPage from "./pages/Competitions"; -import CompetitionPage from "./pages/Competition"; -import CompetitionRunnerPage from "./pages/CompetitionSession"; +import Competitions from "./pages/Competitions"; +import CompetitionPreview from './pages/CompetitionPreview' +import CompetitionSession from "./pages/CompetitionSession"; import { NavbarLayout } from "./widgets/navbar-layout"; const App = () => { return ( }> - } /> - } /> + } /> + } /> } + path="/competition/:id/tasks/:taskId" + element={} /> diff --git a/services/frontend/src/pages/Competition/index.tsx b/services/frontend/src/pages/CompetitionPreview/index.tsx similarity index 72% rename from services/frontend/src/pages/Competition/index.tsx rename to services/frontend/src/pages/CompetitionPreview/index.tsx index bdddd5a..1f07d24 100644 --- a/services/frontend/src/pages/Competition/index.tsx +++ b/services/frontend/src/pages/CompetitionPreview/index.tsx @@ -1,16 +1,29 @@ + import { useState } from "react"; -import { useParams, Link } from "react-router-dom"; +import { useParams, Link, useNavigate } from "react-router-dom"; import { Button } from "@/components/ui/button"; import { ArrowLeft } from "lucide-react"; import { Competition } from "@/shared/types"; -import { mockCompetitions } from "@/shared/mocks/mocks"; +import { mockCompetitions, mockTasks } from "@/shared/mocks/mocks"; const CompetitionPage = () => { const { id } = useParams<{ id: string }>(); + const navigate = useNavigate(); const [competition] = useState( mockCompetitions.find((comp) => comp.id === id)!, ); + const handleContinue = () => { + if (competition?.id) { + if (mockTasks && mockTasks.length > 0) { + const firstTaskId = mockTasks[0].id; + navigate(`/competition/${competition.id}/tasks/${firstTaskId}`); + } else { + navigate(`/competition/${competition.id}/tasks`); + } + } + }; + return (
{
- +
diff --git a/services/frontend/src/pages/CompetitionRunnerPage/index.tsx b/services/frontend/src/pages/CompetitionRunnerPage/index.tsx deleted file mode 100644 index dc12b58..0000000 --- a/services/frontend/src/pages/CompetitionRunnerPage/index.tsx +++ /dev/null @@ -1,150 +0,0 @@ -import { useState, useEffect } from "react"; -import { useParams, useNavigate } from "react-router-dom"; -import { Task } from "@/shared/types"; -import { getTaskBgColor, getTaskTextColor } from "./utils/utils"; -import { mockTasks } from "@/shared/mocks/mocks"; -import { Button } from "@/components/ui/button"; -import { Calendar } from "lucide-react"; - -const CompetitionRunnerPage = () => { - const { id, taskId } = useParams<{ id: string; taskId?: string }>(); - const navigate = useNavigate(); - const [competitionTitle, setCompetitionTitle] = useState("Олимпиада DANO 2025. Индивидуальный этап"); - const [tasks] = useState(mockTasks); - const [selectedTaskId, setSelectedTaskId] = useState(taskId || null); - const [answer, setAnswer] = useState(""); - - useEffect(() => { - if (taskId) { - setSelectedTaskId(taskId); - } else if (tasks.length > 0) { - navigate(`/competition/${id}/tasks/${tasks[0].id}`, { replace: true }); - } - }, [taskId, tasks, id, navigate]); - - const handleTaskClick = (taskId: string) => { - if (selectedTaskId !== taskId) { - setSelectedTaskId(taskId); - navigate(`/competition/${id}/tasks/${taskId}`); - } - }; - - const currentTask = tasks.find(t => t.id === selectedTaskId); - - const handleSubmit = () => { - console.log("Submitting answer:", answer); - // Submit logic here - }; - - const handleHistoryClick = () => { - console.log("View history"); - }; - - return ( - <> -
-
-
-

{competitionTitle}

-
- -
- {tasks.map((task) => ( -
handleTaskClick(task.id)} - > - {task.number} -
- ))} -
-
-
- -
-
- {currentTask ? ( -
- {/* Left Container - Task Description */} -
-

- Задача {currentTask.number} -

- -
-

- Рассмотрим последовательность чисел 2, 3, 5, 9, 17, 33, 65, 129, ... - Каждый член этой последовательности, начиная с третьего, равен сумме двух предыдущих членов. -

-

- Найдите сумму первых 15 членов этой последовательности. -

-

- В ответе укажите целое число. -

-
-
- - {/* Right Container - Solution Area */} -
- {/* Solution Status Card */} -
-
- - Решение 12345 - - - Зачтено 5/10 баллов - -
-
- 1 марта, 08:41 -
-
- - {/* Answer Input */} -
-