lct-39: пауза занятия с пульта, таймеры и очередь ДДС стоят на время простоя

This commit is contained in:
kaifarikman 2026-09-27 16:35:13 +03:00
commit b77d65c82e
23 changed files with 410 additions and 20 deletions

View file

@ -233,6 +233,7 @@ export function Dds() {
const [checkText, setCheckText] = useState("");
const [error, setError] = useState("");
const [ended, setEnded] = useState(false);
const [paused, setPaused] = useState(false);
// Разбор просим только после `score.ready`; новая карточка снимает флаг.
const [scoreReady, setScoreReady] = useState(false);
const { report, loading: reportLoading, error: reportError, refetch: refetchReport } =
@ -252,6 +253,7 @@ export function Dds() {
if (event.type === "station.state") {
const snapshot = event.snapshot as DdsSnapshot;
setStation(snapshot);
setPaused(snapshot.paused ?? false);
setZone(snapshot.zone_decision ?? null);
if (snapshot.card_id == null && (snapshot.pending_cards_count ?? 0) > 0) {
activeCardId.current = null;
@ -298,6 +300,7 @@ export function Dds() {
} else if (event.type === "timer.tick") setTimers(event.timers);
else if (event.type === "error") { setError(event.message); setDialing(false); setAdvancePending(false); }
else if (event.type === "session.ended") { setEnded(true); setDialing(false); setAdvancePending(false); setPane(null); setView("registry"); }
else if (event.type === "session.paused") setPaused(event.paused);
else if (event.type === "score.ready") setScoreReady(true);
else if (event.type === "phone.report") {
setLastReport(event);
@ -368,6 +371,7 @@ export function Dds() {
АРМ {role}: {isConnected ? "на связи" : status}
</span>
{error && <div className="dds-alert" role="alert">Действие не принято: {error}</div>}
{paused && !ended && <div className="dds-alert dds-paused">Пауза, ждите преподавателя</div>}
{ended && <div className="dds-alert dds-done">Занятие завершено. Оценка появится после расчёта.</div>}
{(ended || scoreReady) && <section className="dds-panel" aria-live="polite">
<div className="dds-panel-title"><h2>Итог упражнения</h2></div>

View file

@ -695,7 +695,15 @@ export function Instructor() {
{sessionId && session.title && (
<p>
{session.ended ? "занятие завершено" : (
<button type="button" onClick={control.stop}>Завершить занятие</button>
<>
<button type="button" onClick={control.stop}>Завершить занятие</button>{" "}
{session.paused ? (
<button type="button" onClick={control.resume}>Возобновить</button>
) : (
<button type="button" onClick={control.pause}>Пауза</button>
)}
{session.paused && <small className="ref" role="status">Занятие на паузе — время не идёт</small>}
</>
)}
</p>
)}

View file

@ -126,6 +126,7 @@ export function Call() {
placeholder="Ваша реплика…" onChange={(event) => setTextTurn(event.target.value)} />
<button type="submit" disabled={call.status !== "open" || !textTurn.trim() || call.cardSubmitted}>Отправить</button>
</form>
{call.paused && <p role="status" className="state-warn">Пауза, ждите преподавателя</p>}
{call.error && <p role="alert" className="state-violated">{call.error}</p>}
</section>
<div className="arm-card-wrap">
@ -190,6 +191,7 @@ export function Call() {
: "Ожидайте входящего вызова"}</span>
</div>
{call.paused && <p className="state-warn arm-message" role="status">Пауза, ждите преподавателя</p>}
{call.error && <p className="violated arm-message" role="alert">{call.error}</p>}
<div className="arm-card-wrap">