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