Sprint 2: attempt cards, file import button, question layout, radio/check, sticky save
- Replace attempts table with attempts-card-list cards - Custom import: sr-only file input + btn-styled label - question-editor-block: stack header on mobile, row from 520px - option marks: radio for single correct, checkbox for multiple - Fixed bottom actions on max-width 640px with draft status; hide in-flow panel - Update СПРИНТЫ_МОБИЛЬНЫЙ_ДИЗАЙН.md and DOC/ШАГИ/ШАГ_2026-04-27_003.md Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
# Шаг 2026-04-27 — спринт 2 (мобильный UI)
|
||||||
|
|
||||||
|
- См. [`docs/СПРИНТЫ_МОБИЛЬНЫЙ_ДИЗАЙН.md`](../../docs/СПРИНТЫ_МОБИЛЬНЫЙ_ДИЗАЙН.md): пункты 2.1–2.5 отмечены выполненными.
|
||||||
|
- Реализация: `TestDetail.jsx` (прогоны карточками, импорт через label+input, заголовок вопроса, radio/checkbox, фикс-футер), `cabinet-theme.css` (классы спринта 2).
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
# Спринты: мобильный UI кабинета тестов
|
# Спринты: мобильный UI кабинета тестов
|
||||||
|
|
||||||
Рядом с: [`ПРЕДЛОЖЕНИЕ_ДИЗАЙН_СОЗДАНИЕ_ТЕСТА.md`](./ПРЕДЛОЖЕНИЕ_ДИЗАЙН_СОЗДАНИЕ_ТЕСТА.md).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Спринт 1 — быстрые исправления (текущий)
|
## Спринт 1 — быстрые исправления
|
||||||
|
|
||||||
**Цель:** выровнять кнопки, мета-строку списка, историю версий, назначение и safe-area; без смены контентной модели страниц.
|
**Цель:** выровнять кнопки, мета-строку списка, историю версий, назначение и safe-area; без смены контентной модели страниц.
|
||||||
|
|
||||||
@@ -21,13 +19,15 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Спринт 2 — бэклог (следующий)
|
## Спринт 2 — карточки, импорт, вопрос, радио/чек, фикс-футер
|
||||||
|
|
||||||
- [ ] **2.1** «Прогоны и разбор»: на мобилке заменить таблицу на карточки или гориз. скролл с фиксированными колонками
|
- [x] **2.1** «Прогоны и разбор»: таблица заменена на список карточек (`.attempts-card-list`)
|
||||||
- [ ] **2.2** «Импорт из файла»: кастомная кнопка (скрытый `input` + стилизованный `label` под `.btn`)
|
- [x] **2.2** «Импорт из файла»: скрытый `input` + `label` с `.btn` (`.import-file-input` / `.import-file-label`)
|
||||||
- [ ] **2.3** «Вопрос 1» + «Сгенерировать вопрос (ИИ)» — не в одной строке на узком экране; явная иерархия primary/secondary
|
- [x] **2.3** «Вопрос N» + «Сгенерировать вопрос (ИИ)»: колонка на мобилке, ряд от `min-width: 520px` (`.question-editor-block__header`)
|
||||||
- [ ] **2.4** Радио vs чекбокс у вариантов ответа при «несколько верных» — визуальная метафора (квадраты vs круги)
|
- [x] **2.4** Варианты: `type="radio"` при одном верном, `checkbox` при нескольких
|
||||||
- [ ] **2.5** Закреплённый футер с действиями «Сохранить» (опционально)
|
- [x] **2.5** Моб. фикс-футер `≤640px` с «Сохранить» / «К списку» + статус черновика; панель в потоке скрыта
|
||||||
|
|
||||||
|
**Файлы:** `frontend/src/styles/cabinet-theme.css`, `frontend/src/pages/TestDetail.jsx`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -622,7 +622,7 @@ export default function TestDetail() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="test-detail-page">
|
<div className="test-detail-page test-detail-page--with-fixed-actions">
|
||||||
<div className="cabinet-brick cabinet-brick--hero">
|
<div className="cabinet-brick cabinet-brick--hero">
|
||||||
<p className="link-back" style={{ marginTop: 0 }}>
|
<p className="link-back" style={{ marginTop: 0 }}>
|
||||||
<Link to="/tests">← к списку</Link>
|
<Link to="/tests">← к списку</Link>
|
||||||
@@ -792,22 +792,23 @@ export default function TestDetail() {
|
|||||||
{draftQuestions.map((q, qi) => (
|
{draftQuestions.map((q, qi) => (
|
||||||
<div
|
<div
|
||||||
key={q.key}
|
key={q.key}
|
||||||
|
className="question-editor-block"
|
||||||
style={{
|
style={{
|
||||||
borderTop: '1px solid var(--border-subtle, #2a2a2a)',
|
borderTop: '1px solid var(--border-subtle, #2a2a2a)',
|
||||||
marginTop: '1rem',
|
marginTop: '1rem',
|
||||||
paddingTop: '1rem',
|
paddingTop: '1rem',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div className="question-editor-block__header">
|
||||||
className="inline-actions"
|
<label
|
||||||
style={{ marginBottom: 6, flexWrap: 'wrap', alignItems: 'center' }}
|
className="form-label question-editor-block__title"
|
||||||
>
|
htmlFor={`qtext-${q.key}`}
|
||||||
<label className="form-label" htmlFor={`qtext-${q.key}`} style={{ marginBottom: 0 }}>
|
>
|
||||||
Вопрос {qi + 1}
|
Вопрос {qi + 1}
|
||||||
</label>
|
</label>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-ghost btn--sm"
|
className="btn btn-ghost btn--sm question-editor-block__ai-btn"
|
||||||
disabled={aiQBusy != null}
|
disabled={aiQBusy != null}
|
||||||
onClick={() => runAiGenerateQuestion(qi)}
|
onClick={() => runAiGenerateQuestion(qi)}
|
||||||
>
|
>
|
||||||
@@ -845,14 +846,18 @@ export default function TestDetail() {
|
|||||||
<p className="muted" style={{ marginBottom: 6, fontSize: 13 }}>
|
<p className="muted" style={{ marginBottom: 6, fontSize: 13 }}>
|
||||||
Варианты
|
Варианты
|
||||||
</p>
|
</p>
|
||||||
<ul style={{ listStyle: 'none', padding: 0, margin: 0 }}>
|
<ul className="question-options-list" style={{ listStyle: 'none', padding: 0, margin: 0 }}>
|
||||||
{q.options.map((o, oi) => (
|
{q.options.map((o, oi) => (
|
||||||
<li
|
<li
|
||||||
key={o.key}
|
key={o.key}
|
||||||
|
className="question-option-row"
|
||||||
style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 8, marginBottom: 8 }}
|
style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 8, marginBottom: 8 }}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
key={`${o.key}-${q.hasMultipleAnswers ? 'm' : 's'}`}
|
||||||
|
className="question-option-row__mark"
|
||||||
|
type={q.hasMultipleAnswers ? 'checkbox' : 'radio'}
|
||||||
|
name={q.hasMultipleAnswers ? undefined : `q-${q.key}-correct`}
|
||||||
checked={o.isCorrect}
|
checked={o.isCorrect}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const v = e.target.checked;
|
const v = e.target.checked;
|
||||||
@@ -936,7 +941,7 @@ export default function TestDetail() {
|
|||||||
</div>
|
</div>
|
||||||
</AccSection>
|
</AccSection>
|
||||||
|
|
||||||
<div className="cabinet-brick" style={{ marginTop: 0 }}>
|
<div className="cabinet-brick editor-actions-flow" style={{ marginTop: 0 }}>
|
||||||
<div
|
<div
|
||||||
className="actions-bar"
|
className="actions-bar"
|
||||||
style={{ marginBottom: draftStatus ? '0.35rem' : 0 }}
|
style={{ marginBottom: draftStatus ? '0.35rem' : 0 }}
|
||||||
@@ -949,7 +954,7 @@ export default function TestDetail() {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
{draftStatus && (
|
{draftStatus && (
|
||||||
<p className="muted" style={{ marginTop: 0, marginBottom: 0 }}>
|
<p className="muted editor-actions-status--flow" style={{ marginTop: 0, marginBottom: 0 }}>
|
||||||
{draftStatus}
|
{draftStatus}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
@@ -999,61 +1004,55 @@ export default function TestDetail() {
|
|||||||
{attemptsErr}
|
{attemptsErr}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<div className="surface-card" style={{ padding: 0, overflow: 'auto' }}>
|
<ul className="attempts-card-list" aria-label="Список прогонов">
|
||||||
<table className="table-cabinet">
|
{attemptsList.map((a) => {
|
||||||
<thead>
|
const when = a.completedAt
|
||||||
<tr>
|
? fmtDt(a.completedAt)
|
||||||
<th>Когда</th>
|
: a.startedAt
|
||||||
<th>Участник</th>
|
? fmtDt(a.startedAt)
|
||||||
<th>v</th>
|
: '—';
|
||||||
<th>Результат</th>
|
const result =
|
||||||
<th />
|
a.status === 'completed' && a.totalQuestions != null ? (
|
||||||
</tr>
|
<>
|
||||||
</thead>
|
{a.correctCount}/{a.totalQuestions}
|
||||||
<tbody>
|
{a.passed ? ' · зачёт' : ' · незачёт'}
|
||||||
{attemptsList.map((a) => (
|
</>
|
||||||
<tr key={a.id}>
|
) : (
|
||||||
<td className="mono" style={{ whiteSpace: 'nowrap' }}>
|
a.status
|
||||||
{a.completedAt
|
);
|
||||||
? fmtDt(a.completedAt)
|
return (
|
||||||
: a.startedAt
|
<li key={a.id} className="surface-card attempts-card-list__item">
|
||||||
? fmtDt(a.startedAt)
|
<div className="attempts-card-list__row">
|
||||||
: '—'}
|
<div className="attempts-card-list__main">
|
||||||
</td>
|
<p className="muted attempts-card-list__when mono" style={{ margin: 0, fontSize: '0.8rem' }}>
|
||||||
<td>
|
{when}
|
||||||
{a.attempterName || '—'}
|
</p>
|
||||||
{a.attempterLogin && (
|
<p className="attempts-card-list__who" style={{ margin: '0.35rem 0 0', fontWeight: 600 }}>
|
||||||
<span className="code-inline" style={{ fontSize: 11, marginLeft: 6 }}>
|
{a.attempterName || '—'}
|
||||||
{a.attempterLogin}
|
{a.attempterLogin && (
|
||||||
</span>
|
<span className="code-inline" style={{ fontSize: 11, marginLeft: 6 }}>
|
||||||
)}
|
{a.attempterLogin}
|
||||||
</td>
|
</span>
|
||||||
<td>v{a.testVersion}</td>
|
)}
|
||||||
<td>
|
</p>
|
||||||
{a.status === 'completed' && a.totalQuestions != null ? (
|
<p className="muted" style={{ margin: '0.25rem 0 0', fontSize: '0.85rem' }}>
|
||||||
<>
|
v{a.testVersion} ·{' '}
|
||||||
{a.correctCount}/{a.totalQuestions}
|
<span className="attempts-card-list__result">{result}</span>
|
||||||
{a.passed ? ' · зачёт' : ' · незачёт'}
|
</p>
|
||||||
</>
|
</div>
|
||||||
) : (
|
{a.status === 'completed' && (
|
||||||
a.status
|
<Link
|
||||||
)}
|
to={`/tests/${id}/attempts/${a.id}/review`}
|
||||||
</td>
|
className="btn btn-ghost btn--sm attempts-card-list__action"
|
||||||
<td>
|
>
|
||||||
{a.status === 'completed' && (
|
Разбор
|
||||||
<Link
|
</Link>
|
||||||
to={`/tests/${id}/attempts/${a.id}/review`}
|
)}
|
||||||
className="btn btn-ghost btn--sm"
|
</div>
|
||||||
>
|
</li>
|
||||||
Разбор
|
);
|
||||||
</Link>
|
})}
|
||||||
)}
|
</ul>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</AccSection>
|
</AccSection>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -1085,15 +1084,23 @@ export default function TestDetail() {
|
|||||||
</AccSection>
|
</AccSection>
|
||||||
|
|
||||||
<AccSection title="Импорт из файла" defaultOpen={false}>
|
<AccSection title="Импорт из файла" defaultOpen={false}>
|
||||||
<div className="inline-actions" style={{ marginBottom: '0.5rem' }}>
|
<div className="import-file-row" style={{ marginBottom: '0.5rem' }}>
|
||||||
<input
|
<input
|
||||||
|
id="import-test-file"
|
||||||
|
className="import-file-input"
|
||||||
type="file"
|
type="file"
|
||||||
accept=".pdf,.docx,.txt,.md,application/pdf"
|
accept=".pdf,.docx,.txt,.md,application/pdf"
|
||||||
onChange={onImportFile}
|
onChange={onImportFile}
|
||||||
disabled={importBusy}
|
disabled={importBusy}
|
||||||
aria-label="Выбрать файл для импорта"
|
aria-label="Выбрать файл для импорта"
|
||||||
/>
|
/>
|
||||||
{importBusy && <span className="text-muted">Обработка…</span>}
|
<label
|
||||||
|
htmlFor="import-test-file"
|
||||||
|
className={`btn btn-ghost import-file-label${importBusy ? ' is-busy' : ''}`}
|
||||||
|
style={importBusy ? { pointerEvents: 'none' } : undefined}
|
||||||
|
>
|
||||||
|
{importBusy ? 'Обработка…' : 'Выбрать файл'}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{importErr && (
|
{importErr && (
|
||||||
<p className="error-text" role="alert">
|
<p className="error-text" role="alert">
|
||||||
@@ -1241,6 +1248,28 @@ export default function TestDetail() {
|
|||||||
{assignMsg && <p className="text-muted">{assignMsg}</p>}
|
{assignMsg && <p className="text-muted">{assignMsg}</p>}
|
||||||
</AccSection>
|
</AccSection>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="test-detail-fixed-actions"
|
||||||
|
role="region"
|
||||||
|
aria-label="Быстрые действия с черновиком"
|
||||||
|
>
|
||||||
|
<div className="test-detail-fixed-actions__inner">
|
||||||
|
{draftStatus && (
|
||||||
|
<p className="muted test-detail-fixed-actions__status" role="status">
|
||||||
|
{draftStatus}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<div className="actions-bar">
|
||||||
|
<button type="button" className="btn btn-primary" onClick={saveDraft}>
|
||||||
|
Сохранить черновик
|
||||||
|
</button>
|
||||||
|
<Link to="/tests" className="btn btn-ghost">
|
||||||
|
К списку
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -900,3 +900,161 @@ code,
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- Спринт 2: редактор вопроса, прогоны, импорт, фикс. футер --- */
|
||||||
|
|
||||||
|
.question-editor-block__header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 0.5rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-editor-block__title {
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-editor-block__ai-btn {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-self: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 520px) {
|
||||||
|
.question-editor-block__header {
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-editor-block__ai-btn {
|
||||||
|
width: auto;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Спринт 2.4: radio = один верный, checkbox = несколько (нативная метафора) */
|
||||||
|
.question-option-row__mark {
|
||||||
|
width: 1.15rem;
|
||||||
|
height: 1.15rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-top: 0.1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
accent-color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Список прогонов: карточки */
|
||||||
|
.attempts-card-list {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempts-card-list__item {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempts-card-list__row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempts-card-list__main {
|
||||||
|
flex: 1 1 12rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempts-card-list__action {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 520px) {
|
||||||
|
.attempts-card-list__row {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempts-card-list__action {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Импорт: скрытый input + кнопка-стиль */
|
||||||
|
.import-file-input {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.import-file-row {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.import-file-label {
|
||||||
|
margin: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
width: auto;
|
||||||
|
display: inline-block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Мобилка: закреплённый футер с «Сохранить» (дубль панели скрыт) */
|
||||||
|
.test-detail-fixed-actions {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.test-detail-page--with-fixed-actions {
|
||||||
|
padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
|
||||||
|
}
|
||||||
|
|
||||||
|
.test-detail-page--with-fixed-actions .editor-actions-flow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.test-detail-fixed-actions {
|
||||||
|
display: block;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 30;
|
||||||
|
padding: 0.65rem 1.25rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
|
||||||
|
background: color-mix(in srgb, var(--surface) 96%, #fff);
|
||||||
|
border-top: 1px solid color-mix(in srgb, var(--outline-variant) 45%, transparent);
|
||||||
|
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.test-detail-fixed-actions__inner {
|
||||||
|
max-width: var(--max-content);
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.test-detail-fixed-actions__status {
|
||||||
|
margin: 0 0 0.45rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
max-height: 3.2rem;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user