6.18.3: Фиксированная кнопка Начать/Завершить в тесте
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m15s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m15s
This commit is contained in:
@@ -1309,6 +1309,7 @@ function AppContent() {
|
||||
configId={tabParams.configId}
|
||||
maxCards={tabParams.maxCards}
|
||||
taskId={tabParams.taskId}
|
||||
isActive={activeTab === 'test'}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -925,7 +925,7 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
{task.name}
|
||||
{hasSubtasks && (
|
||||
<span className="task-subtasks-count">
|
||||
{task.draft_subtasks_count != null
|
||||
{task.draft_subtasks_count != null && task.draft_subtasks_count > 0
|
||||
? `(${task.draft_subtasks_count}/${task.subtasks_count})`
|
||||
: `(${task.subtasks_count})`}
|
||||
</span>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { useState, useEffect, useRef, useCallback } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { useAuth } from './auth/AuthContext'
|
||||
import LoadingError from './LoadingError'
|
||||
import './TestWords.css'
|
||||
@@ -8,7 +9,7 @@ const API_URL = '/api'
|
||||
|
||||
const DEFAULT_TEST_WORD_COUNT = 10
|
||||
|
||||
function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialConfigId, maxCards: initialMaxCards, taskId: initialTaskId }) {
|
||||
function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialConfigId, maxCards: initialMaxCards, taskId: initialTaskId, isActive }) {
|
||||
const { authFetch } = useAuth()
|
||||
const wordCount = initialWordCount || DEFAULT_TEST_WORD_COUNT
|
||||
const configId = initialConfigId || null
|
||||
@@ -610,6 +611,7 @@ function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialC
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="test-container test-container-fullscreen">
|
||||
<button className="close-x-button" onClick={handleClose}>
|
||||
✕
|
||||
@@ -636,11 +638,6 @@ function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialC
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<div className="preview-actions">
|
||||
<button className="test-start-button" onClick={handleStartTest}>
|
||||
Начать
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : showResults ? (
|
||||
<div className="test-results">
|
||||
@@ -664,15 +661,6 @@ function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialC
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<div className="results-actions">
|
||||
<button
|
||||
className="test-finish-button"
|
||||
onClick={handleFinish}
|
||||
disabled={isClosing}
|
||||
>
|
||||
{isClosing ? 'Завершение…' : 'Закончить'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="test-screen">
|
||||
@@ -804,6 +792,43 @@ function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialC
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{isActive && (showPreview || showResults) ? createPortal(
|
||||
<div style={{
|
||||
position: 'fixed',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
padding: '0.75rem 1rem',
|
||||
paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))',
|
||||
background: 'linear-gradient(to top, white 60%, rgba(255,255,255,0))',
|
||||
zIndex: 1500,
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<button
|
||||
onClick={showPreview ? handleStartTest : handleFinish}
|
||||
disabled={showResults && isClosing}
|
||||
style={{
|
||||
width: '100%',
|
||||
maxWidth: '42rem',
|
||||
padding: '0.875rem',
|
||||
background: 'linear-gradient(to right, #10b981, #059669)',
|
||||
color: 'white',
|
||||
border: 'none',
|
||||
borderRadius: '0.5rem',
|
||||
fontSize: '1rem',
|
||||
fontWeight: 600,
|
||||
cursor: (showResults && isClosing) ? 'not-allowed' : 'pointer',
|
||||
opacity: (showResults && isClosing) ? 0.6 : 1,
|
||||
transition: 'all 0.2s',
|
||||
}}
|
||||
>
|
||||
{showPreview ? 'Начать' : (isClosing ? 'Завершение…' : 'Завершить')}
|
||||
</button>
|
||||
</div>,
|
||||
document.body
|
||||
) : null}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user