mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-22 22:07:10 +00:00
minor fixes
This commit is contained in:
+13
-3
@@ -1,19 +1,21 @@
|
||||
import React from 'react';
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Loader2 } from "lucide-react";
|
||||
import { Loader2, CheckCircle } from "lucide-react";
|
||||
|
||||
interface ActionButtonsProps {
|
||||
onSubmit: () => void;
|
||||
onHistoryClick: () => void;
|
||||
isSubmitting?: boolean;
|
||||
hasSubmissionsLeft?: boolean;
|
||||
isCleared: boolean;
|
||||
}
|
||||
|
||||
const ActionButtons: React.FC<ActionButtonsProps> = ({
|
||||
onSubmit,
|
||||
onHistoryClick,
|
||||
isSubmitting = false,
|
||||
hasSubmissionsLeft = true
|
||||
hasSubmissionsLeft = true,
|
||||
isCleared
|
||||
}) => {
|
||||
return (
|
||||
<div className="flex gap-8">
|
||||
@@ -26,7 +28,15 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
|
||||
История
|
||||
</Button>
|
||||
|
||||
{hasSubmissionsLeft ? (
|
||||
{isCleared ? (
|
||||
<Button
|
||||
className="font-hse-sans flex-grow bg-green-600 hover:bg-green-700"
|
||||
disabled={true}
|
||||
>
|
||||
<CheckCircle className="mr-2 h-4 w-4" />
|
||||
Задача сдана!
|
||||
</Button>
|
||||
) : hasSubmissionsLeft ? (
|
||||
<Button
|
||||
onClick={onSubmit}
|
||||
className="font-hse-sans flex-grow"
|
||||
|
||||
@@ -44,6 +44,10 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
||||
|
||||
const solutionHistory = solutionsQuery.data || [];
|
||||
|
||||
let lastSolutionPoints = 0;
|
||||
if (solutionHistory.length > 0) {
|
||||
lastSolutionPoints = solutionHistory[solutionHistory.length - 1].earned_points
|
||||
}
|
||||
const maxAttempts = task.max_attempts || -1;
|
||||
const submissionsUsed = solutionHistory.length;
|
||||
const submissionsLeft = Math.max(0, maxAttempts - submissionsUsed);
|
||||
@@ -174,6 +178,7 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
||||
onHistoryClick={handleOpenHistory}
|
||||
isSubmitting={isSubmitting}
|
||||
hasSubmissionsLeft={hasSubmissionsLeft}
|
||||
isCleared={task.points === lastSolutionPoints}
|
||||
/>
|
||||
|
||||
<SolutionHistorySheet
|
||||
|
||||
Reference in New Issue
Block a user