mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-22 22:07:10 +00:00
fix test
This commit is contained in:
+1
-9
@@ -11,7 +11,6 @@ interface SolutionHistorySheetProps {
|
||||
solutions: Solution[];
|
||||
maxPoints: number;
|
||||
onSolutionSelect: (solution: Solution) => void;
|
||||
currentSolutionId?: string;
|
||||
}
|
||||
|
||||
const SolutionHistorySheet: React.FC<SolutionHistorySheetProps> = ({
|
||||
@@ -20,7 +19,6 @@ const SolutionHistorySheet: React.FC<SolutionHistorySheetProps> = ({
|
||||
solutions,
|
||||
maxPoints,
|
||||
onSolutionSelect,
|
||||
currentSolutionId
|
||||
}) => {
|
||||
return (
|
||||
<Sheet open={isOpen} onOpenChange={onOpenChange}>
|
||||
@@ -41,18 +39,12 @@ const SolutionHistorySheet: React.FC<SolutionHistorySheetProps> = ({
|
||||
solutions.map((solution, index) => (
|
||||
<div
|
||||
key={solution.id || index}
|
||||
className={`w-full cursor-pointer transition-transform hover:scale-[1.01] relative
|
||||
${solution.id === currentSolutionId ? 'ring-2 ring-blue-500 rounded-lg' : ''}`}
|
||||
className={`w-full cursor-pointer transition-transform hover:scale-[1.01] relative`}
|
||||
onClick={() => {
|
||||
onSolutionSelect(solution);
|
||||
onOpenChange(false);
|
||||
}}
|
||||
>
|
||||
{solution.id === currentSolutionId && (
|
||||
<div className="absolute top-2 right-2 z-10 bg-blue-500 text-white rounded-full p-1">
|
||||
<Check size={14} />
|
||||
</div>
|
||||
)}
|
||||
<SolutionStatus solution={solution} maxPoints={maxPoints} />
|
||||
</div>
|
||||
))
|
||||
|
||||
-1
@@ -11,7 +11,6 @@
|
||||
|
||||
const SolutionStatus: React.FC<SolutionStatusProps> = ({ solution, maxPoints }) => {
|
||||
const formattedDate = solution.timestamp ? format(parseISO(solution.timestamp), "d MMMM, HH:mm", { locale: ru }) : '';
|
||||
console.log(solution, "SOLUTION STATUS")
|
||||
return (
|
||||
<div className={`${getSolutionBgColor(solution.status, solution.earned_points, maxPoints)} rounded-lg p-4 relative`}>
|
||||
<div className="flex flex-col">
|
||||
|
||||
@@ -42,7 +42,6 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
||||
|
||||
const solutionHistory = solutionsQuery.data || [];
|
||||
|
||||
// Set initial solution to the last one (most recent) when solutions are loaded
|
||||
useEffect(() => {
|
||||
if (solutionHistory.length > 0 && !displayedSolution) {
|
||||
const latestSolution = solutionHistory[solutionHistory.length - 1];
|
||||
@@ -50,10 +49,8 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
||||
}
|
||||
}, [solutionHistory, displayedSolution]);
|
||||
|
||||
// When task changes, reset everything and load the latest solution for the new task
|
||||
useEffect(() => {
|
||||
if (prevTaskIdRef.current !== task.id) {
|
||||
// Reset states for new task
|
||||
setDisplayedSolution(null);
|
||||
setSelectedSolutionUrl(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user