6.18.3: Фиксированная кнопка Начать/Завершить в тесте
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m15s

This commit is contained in:
poignatov
2026-03-15 19:55:50 +03:00
parent 8749f21ac8
commit a4dcc62a37
5 changed files with 44 additions and 18 deletions

View File

@@ -1 +1 @@
6.18.2 6.18.3

View File

@@ -1,6 +1,6 @@
{ {
"name": "play-life-web", "name": "play-life-web",
"version": "6.18.2", "version": "6.18.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -1309,6 +1309,7 @@ function AppContent() {
configId={tabParams.configId} configId={tabParams.configId}
maxCards={tabParams.maxCards} maxCards={tabParams.maxCards}
taskId={tabParams.taskId} taskId={tabParams.taskId}
isActive={activeTab === 'test'}
/> />
</div> </div>
</div> </div>

View File

@@ -925,7 +925,7 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
{task.name} {task.name}
{hasSubtasks && ( {hasSubtasks && (
<span className="task-subtasks-count"> <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.draft_subtasks_count}/${task.subtasks_count})`
: `(${task.subtasks_count})`} : `(${task.subtasks_count})`}
</span> </span>

View File

@@ -1,4 +1,5 @@
import React, { useState, useEffect, useRef, useCallback } from 'react' import React, { useState, useEffect, useRef, useCallback } from 'react'
import { createPortal } from 'react-dom'
import { useAuth } from './auth/AuthContext' import { useAuth } from './auth/AuthContext'
import LoadingError from './LoadingError' import LoadingError from './LoadingError'
import './TestWords.css' import './TestWords.css'
@@ -8,7 +9,7 @@ const API_URL = '/api'
const DEFAULT_TEST_WORD_COUNT = 10 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 { authFetch } = useAuth()
const wordCount = initialWordCount || DEFAULT_TEST_WORD_COUNT const wordCount = initialWordCount || DEFAULT_TEST_WORD_COUNT
const configId = initialConfigId || null const configId = initialConfigId || null
@@ -610,6 +611,7 @@ function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialC
return ( return (
<>
<div className="test-container test-container-fullscreen"> <div className="test-container test-container-fullscreen">
<button className="close-x-button" onClick={handleClose}> <button className="close-x-button" onClick={handleClose}>
@@ -636,11 +638,6 @@ function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialC
) )
})} })}
</div> </div>
<div className="preview-actions">
<button className="test-start-button" onClick={handleStartTest}>
Начать
</button>
</div>
</div> </div>
) : showResults ? ( ) : showResults ? (
<div className="test-results"> <div className="test-results">
@@ -664,15 +661,6 @@ function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialC
) )
})} })}
</div> </div>
<div className="results-actions">
<button
className="test-finish-button"
onClick={handleFinish}
disabled={isClosing}
>
{isClosing ? 'Завершение…' : 'Закончить'}
</button>
</div>
</div> </div>
) : ( ) : (
<div className="test-screen"> <div className="test-screen">
@@ -804,6 +792,43 @@ function TestWords({ onNavigate, wordCount: initialWordCount, configId: initialC
</div> </div>
)} )}
</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}
</>
) )
} }