minor fixes

This commit is contained in:
rngsurrounded
2025-03-04 09:40:55 +09:00
parent ed9f95b591
commit 6621babd5e
3 changed files with 7 additions and 3 deletions
@@ -74,7 +74,11 @@ const TaskContent: React.FC<TaskContentProps> = ({ task }) => {
const getFileNameFromUrl = (url: string): string => { const getFileNameFromUrl = (url: string): string => {
try { try {
const parts = url.split('/'); const parts = url.split('/');
return parts[parts.length - 1]; const fullFileName = parts[parts.length - 1]
const fileName = fullFileName.length > 20
? fullFileName.substring(0, 20) + '...'
: fullFileName;
return fileName;
} catch (e) { } catch (e) {
return 'Файл'; return 'Файл';
} }
@@ -35,7 +35,7 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
> >
Задача сдана! Задача сдана!
</Button> </Button>
) : hasSubmissionsLeft ? ( ) : hasSubmissionsLeft? (
<Button <Button
onClick={onSubmit} onClick={onSubmit}
className="font-hse-sans flex-grow" className="font-hse-sans flex-grow"
@@ -51,7 +51,7 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
const maxAttempts = task.max_attempts || -1; const maxAttempts = task.max_attempts || -1;
const submissionsUsed = solutionHistory.length; const submissionsUsed = solutionHistory.length;
const submissionsLeft = Math.max(0, maxAttempts - submissionsUsed); const submissionsLeft = Math.max(0, maxAttempts - submissionsUsed);
const hasSubmissionsLeft = submissionsLeft > 0; const hasSubmissionsLeft = submissionsLeft > 0 || maxAttempts === -1;
useEffect(() => { useEffect(() => {
if (solutionHistory.length > 0 && !displayedSolution) { if (solutionHistory.length > 0 && !displayedSolution) {