diff --git a/flask_app/app/static/css/app.css b/flask_app/app/static/css/app.css index 6e1f815..bb2c21d 100644 --- a/flask_app/app/static/css/app.css +++ b/flask_app/app/static/css/app.css @@ -815,6 +815,99 @@ body.ui-legacy .test-detail-subsection__title { padding: 1.25rem 1.25rem 1rem; } +/* Модалка предпросмотра импорта документа — в духе разбора попытки */ +.import-modal.save-modal { + max-width: min(32rem, calc(100vw - 1.5rem)); + width: calc(100% - 1.5rem); +} +.import-modal__title { + margin: 0 0 0.65rem; + font-size: 1.0625rem; + font-weight: 600; + line-height: 1.3; + color: var(--ink-900, #111827); +} +.import-modal__body { + margin: 0 0 1rem; + max-height: min(75vh, 32rem); + overflow-y: auto; + padding-right: 0.2rem; + -webkit-overflow-scrolling: touch; + color: var(--ink-700, #374151); + font-size: 0.9375rem; + line-height: 1.45; +} +.import-modal__actions { + margin: 0; + padding-top: 0.75rem; + border-top: 1px solid color-mix(in srgb, var(--outline-variant, #e5e7eb) 55%, transparent); +} +.import-modal-review { + display: flex; + flex-direction: column; + gap: 0.75rem; +} +.import-modal-review__draft-title { + margin: 0; + font-size: 1.0625rem; + font-weight: 600; + line-height: 1.35; + color: var(--ink-900, #111827); +} +.import-modal-review__desc, +.import-modal-review__stats { + margin: 0; +} +.import-modal-review .attempt-review-page__params { + margin-bottom: 0; +} +.import-modal-review__stats strong { + color: var(--ink-900, #111827); + font-weight: 600; +} +.import-modal-review__list { + display: flex; + flex-direction: column; + gap: 0.75rem; + margin: 0; + padding: 0; +} +.import-modal-review__warn { + margin: 0; + padding: 0.75rem 0.95rem; + border-radius: 0.65rem; + border: 1px solid color-mix(in srgb, #d97706 38%, transparent); + background: color-mix(in srgb, #fffbeb 94%, #fff); + font-size: 0.8125rem; + line-height: 1.45; + color: #92400e; +} +.import-modal-review__alert { + margin: 0; + padding: 0.75rem 0.95rem; + border-radius: 0.65rem; + font-size: 0.875rem; + line-height: 1.45; +} +.import-modal-review__alert--error { + border: 1px solid color-mix(in srgb, #b42318 32%, transparent); + background: #fef2f2; + color: #991b1b; +} +.import-modal-review__alert--warn { + border: 1px solid color-mix(in srgb, #d97706 38%, transparent); + background: color-mix(in srgb, #fffbeb 94%, #fff); + color: #92400e; + font-size: 0.8125rem; +} +.import-modal-review__card .attempt-review-card__question { + font-size: 0.95rem; + line-height: 1.42; +} +body.ui-legacy .import-modal-review__card.attempt-review-card { + padding: 0.85rem 1rem 0.95rem; +} + .settings-grid { display: flex; flex-direction: column; @@ -1239,6 +1332,15 @@ body.ui-legacy .attempts-card-list__action { color: #b42318; } +.attempt-review-card__badge--preview { + background: color-mix(in srgb, var(--outline-variant, #c8d2cf) 42%, transparent); + color: var(--ink-600, #4b5563); + text-transform: none; + letter-spacing: 0.02em; + font-weight: 600; + font-size: 0.7rem; +} + .attempt-review-card__question { margin: 0 0 0.75rem; font-size: 1.02rem; diff --git a/flask_app/app/static/js/editor.js b/flask_app/app/static/js/editor.js index 163777a..c94235d 100644 --- a/flask_app/app/static/js/editor.js +++ b/flask_app/app/static/js/editor.js @@ -805,6 +805,42 @@ let _extractedText = ''; let _extractedFileName = ''; + /** HTML карточки вопроса в модалке предпросмотра импорта (как в разборе: текст, подсказка, все варианты). */ + function buildImportPreviewQuestionHtml(q, index) { + const hint = (q.aiHint || '').trim(); + const opts = Array.isArray(q.options) ? q.options : []; + const optionsHtml = opts.length + ? `` + : ''; + const hintHtml = hint + ? `
+ Подсказка +

${escHtml(hint)}

+
` + : ''; + return `
+
+ ${index + 1} + черновик +
+

${escHtml(q.text || '')}

+ ${hintHtml} + ${optionsHtml} +
`; + } + function openImportModal(title, bodyHtml, actions) { importModalTitle.textContent = title; importModalBody.innerHTML = bodyHtml; @@ -842,7 +878,7 @@ aiStatusEl.textContent = ''; openImportModal( 'Ошибка загрузки', - `

${escHtml(e.message || 'Не удалось загрузить файл.')}

`, + `

${escHtml(e.message || 'Не удалось загрузить файл.')}

`, [{ label: 'Закрыть', onClick: () => importModal.close() }], ); } finally { @@ -884,9 +920,7 @@ if (!g.available) { openImportModal( 'AI недоступен', - `

- ${escHtml(g.message || 'AI недоступен — ключ не настроен.')} -

`, + `

${escHtml(g.message || 'AI недоступен — ключ не настроен.')}

`, [{ label: 'Закрыть', onClick: () => importModal.close() }], ); return; @@ -894,19 +928,15 @@ const draft = g.draft || {}; const qs = draft.questions || []; - const qPreview = qs.slice(0, 4).map((q, i) => - `
  • ${i + 1}. ${escHtml((q.text || '').slice(0, 80))}${(q.text || '').length > 80 ? '…' : ''}
  • ` - ).join(''); - const moreCount = qs.length > 4 ? qs.length - 4 : 0; + const qCards = qs.map((q, i) => buildImportPreviewQuestionHtml(q, i)).join(''); const bodyHtml = ` - ${draft.title ? `

    ${escHtml(draft.title)}

    ` : ''} - ${draft.description ? `

    ${escHtml(draft.description)}

    ` : ''} -

    Вопросов: ${qs.length}

    - ${qs.length ? ` - ${moreCount ? `

    …и ещё ${moreCount}

    ` : ''}` : ''} -

    - Текущие вопросы теста будут заменены. -

    `; +
    + ${draft.title ? `

    ${escHtml(draft.title)}

    ` : ''} + ${draft.description ? `

    ${escHtml(draft.description)}

    ` : ''} +

    Вопросов в черновике: ${qs.length}

    + ${qs.length ? `
    ${qCards}
    ` : ''} +
    Текущие вопросы теста будут заменены после «Применить».
    +
    `; openImportModal( `Черновик из «${escHtml(_extractedFileName)}»`, @@ -941,7 +971,7 @@ aiStatusEl.textContent = ''; openImportModal( 'Ошибка генерации', - `

    ${escHtml(e.message || 'Не удалось сгенерировать тест.')}

    `, + `

    ${escHtml(e.message || 'Не удалось сгенерировать тест.')}

    `, [{ label: 'Закрыть', onClick: () => importModal.close() }], ); } finally { diff --git a/flask_app/app/templates/tests/editor.html b/flask_app/app/templates/tests/editor.html index f206692..cf8a13b 100644 --- a/flask_app/app/templates/tests/editor.html +++ b/flask_app/app/templates/tests/editor.html @@ -230,11 +230,11 @@ {# ── Модалка результата импорта документа ─────────────────── #} - -
    -

    -
    -
    + +
    +

    +
    +