fix history

This commit is contained in:
rngsurrounded
2025-03-03 23:19:08 +09:00
parent 70acce4b9f
commit c6bd18e9ba
4 changed files with 5 additions and 6 deletions
@@ -59,14 +59,14 @@ const CompetitionPage = () => {
}; };
const handleViewResults = () => { const handleViewResults = () => {
navigate(`/competition/${competitionId}/results`); console.log("sorryan")
}; };
// Check if competition has ended // Check if competition has ended
const isCompetitionEnded = () => { const isCompetitionEnded = () => {
if (!competitionQuery.data?.end_date) return false; if (!competition?.end_date) return false;
const endDate = new Date(competitionQuery.data.end_date); const endDate = new Date(competition.end_date);
const now = new Date(); const now = new Date();
return now > endDate; return now > endDate;
@@ -27,7 +27,7 @@ const TaskContent: React.FC<TaskContentProps> = ({ task }) => {
return ( return (
<div className="flex-1 bg-white rounded-lg p-6"> <div className="flex-1 bg-white rounded-lg p-6">
<h2 className="text-3xl font-semibold mb-6 font-hse-sans"> <h2 className="text-3xl font-semibold mb-6 font-hse-sans">
Задача {task.in_competition_position} {task.title}
</h2> </h2>
<div className="prose prose-lg max-w-none text-gray-700 font-hse-sans mb-6"> <div className="prose prose-lg max-w-none text-gray-700 font-hse-sans mb-6">
@@ -8,7 +8,6 @@ import { getCompetition } from "@/shared/api/competitions";
import { Loader2 } from "lucide-react"; import { Loader2 } from "lucide-react";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { TaskType } from "@/shared/types/task"; import { TaskType } from "@/shared/types/task";
import { CompetitionType } from "@/shared/types/task";
const CompetitionSession = () => { const CompetitionSession = () => {
const { id, taskId } = useParams<{ id: string; taskId?: string }>(); const { id, taskId } = useParams<{ id: string; taskId?: string }>();
@@ -54,7 +54,7 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
const latestSolution = solutionHistory[solutionHistory.length - 1]; const latestSolution = solutionHistory[solutionHistory.length - 1];
setDisplayedSolution(latestSolution); setDisplayedSolution(latestSolution);
} }
}, [solutionHistory, displayedSolution]); }, [solutionHistory]);
useEffect(() => { useEffect(() => {
if (prevTaskIdRef.current !== task.id) { if (prevTaskIdRef.current !== task.id) {