Merge pull request 'Add an optional countdown to every slide that collects answers' (#122) from feature/countdown-all-types into main
Reviewed-on: #122
This commit was merged in pull request #122.
This commit is contained in:
commit
1b48ce7852
19 files changed
+480
-34
No files matched your search
@@ -794,6 +794,8 @@ body.present {
|
||||
.stage .cloud { font-size: clamp(1.4rem, 2.6vw, 2.6rem); }
|
||||
.stage .answers { columns: 340px; }
|
||||
.stage .quiz-timer { font-size: clamp(3rem, 7vw, 6rem); }
|
||||
.stage__timer:empty { display: none; }
|
||||
.stage__timer .quiz-timer { margin: .2em 0 0; }
|
||||
.stage .quiz-tile { font-size: clamp(1.2rem, 2.2vw, 2rem); }
|
||||
.stage .quiz-summary strong, .stage .bar--correct .bar__label { color: var(--stage-ok); }
|
||||
.stage .bar--correct .bar__fill { background: var(--stage-ok); }
|
||||
|
||||
+31
-6
@@ -652,7 +652,8 @@
|
||||
var active = document.activeElement;
|
||||
var focusKey = active && container.contains(active) ? active.getAttribute('data-comment-action') : null;
|
||||
container.innerHTML = '';
|
||||
if (!results) {
|
||||
if (!results || results.ready) {
|
||||
// A slide with a countdown that has not started shows only its question.
|
||||
return;
|
||||
}
|
||||
var renderer = Results[results.type];
|
||||
@@ -1512,6 +1513,7 @@
|
||||
? (allHidden ? 'Blende in der Verwaltung mindestens eine Folie ein.' : 'Lege in der Verwaltung Fragen an.')
|
||||
: (state.poll.isPaused ? '' : 'Drücke → um zu starten.');
|
||||
q('[data-results]').innerHTML = '';
|
||||
q('[data-stage-timer]').textContent = '';
|
||||
renderMedia(null);
|
||||
renderImage(null);
|
||||
root.classList.remove('stage--video');
|
||||
@@ -1524,12 +1526,18 @@
|
||||
var quizPhase = slide.type === 'quiz' && state.results ? state.results.phase : null;
|
||||
var qaStage = slide.type === 'qa' && state.results ? state.results.stage : null;
|
||||
var orderRevealed = slide.type === 'order' && state.results ? state.results.revealed : null;
|
||||
var closed = slide.isInteractive && !slide.isVotingOpen && !quizPhase && !qaStage && !orderRevealed;
|
||||
// Countdown of any slide that has one (a quiz shows its timer inside its results).
|
||||
var timer = state.results && state.results.timer ? state.results.timer : null;
|
||||
var phase = timer ? timer.phase : null;
|
||||
var timed = phase && !quizPhase ? phase : null;
|
||||
var closed = slide.isInteractive && !slide.isVotingOpen && !quizPhase && !qaStage && !orderRevealed && timed !== 'ready';
|
||||
// Status line above the question: only what the room needs to know, not the slide type.
|
||||
q('[data-status]').textContent = quizPhase
|
||||
? { ready: 'Bereit', running: 'Läuft', finished: 'Auflösung' }[quizPhase]
|
||||
: (qaStage ? Qa.labels[qaStage]
|
||||
: (orderRevealed ? 'Auflösung' : (closed ? 'Abstimmung geschlossen' : '')));
|
||||
: (orderRevealed ? 'Auflösung'
|
||||
: (timed === 'ready' ? 'Bereit' : (timed === 'running' ? 'Läuft' : (closed ? 'Abstimmung geschlossen' : '')))));
|
||||
renderStageTimer(timed === 'running' && timer.remaining !== null ? timer.remaining : null);
|
||||
q('[data-question]').textContent = slide.question;
|
||||
Format.render(q('[data-description]'), slide.description);
|
||||
root.classList.toggle('stage--content', !slide.isInteractive);
|
||||
@@ -1546,12 +1554,14 @@
|
||||
? { ready: 'Quiz starten', running: 'Quiz beenden', finished: 'Quiz erneut öffnen' }[quizPhase]
|
||||
: (qaStage
|
||||
? { collect: 'Einreichen beenden', vote: 'Abstimmung beenden', discuss: '' }[qaStage]
|
||||
: (slide.type === 'order'
|
||||
: (timed
|
||||
? { ready: 'Countdown starten', running: 'Abstimmung schließen', finished: 'Countdown erneut starten' }[timed]
|
||||
: slide.type === 'order'
|
||||
? (slide.isVotingOpen ? 'Schließen & auflösen' : 'Abstimmung wieder öffnen')
|
||||
: (slide.isVotingOpen ? 'Abstimmung schließen' : 'Abstimmung öffnen')));
|
||||
|
||||
var count = qaStage ? state.results.questions.length : (slide.isInteractive ? state.results.participants : 0);
|
||||
setText('[data-participants]', !slide.isInteractive ? '' : (qaStage
|
||||
setText('[data-participants]', !slide.isInteractive || timed === 'ready' ? '' : (qaStage
|
||||
? count + (count === 1 ? ' Frage' : ' Fragen')
|
||||
: count + ' ' + (count === 1 ? 'Antwort' : 'Antworten')));
|
||||
|
||||
@@ -1562,7 +1572,22 @@
|
||||
}
|
||||
renderResults();
|
||||
Countdown.start();
|
||||
StageAudio.sync(quizPhase === 'running' ? state.poll.audioUrl : null);
|
||||
StageAudio.sync(phase === 'running' ? state.poll.audioUrl : null);
|
||||
}
|
||||
|
||||
/** Big countdown below the question for slides that are not a quiz; null removes it. */
|
||||
function renderStageTimer(remaining) {
|
||||
var box = q('[data-stage-timer]');
|
||||
box.textContent = '';
|
||||
if (remaining === null) {
|
||||
return;
|
||||
}
|
||||
box.appendChild(el('p', {
|
||||
class: 'quiz-timer',
|
||||
role: 'timer',
|
||||
'data-countdown': '',
|
||||
'data-remaining': String(remaining)
|
||||
}, [el('strong', { 'data-countdown-value': '', text: formatSeconds(remaining) })]));
|
||||
}
|
||||
|
||||
function isPrivate() {
|
||||
|
||||
Reference in new issue
Block a user