Projector: entry qr docks bottom right outside the layout so the ring keeps its size; projected code choice on the create page

This commit is contained in:
2026-11-17 12:18:49 +01:00
parent 3efb80b802
commit 553af09df4
6 changed files with 38 additions and 23 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
<div class="card"> <div class="card">
<label for="s-code-style">Code projeté</label> <label for="s-code-style">Code projeté</label>
<select id="s-code-style"> <select id="s-code-style">
<option value="ring">Code circulaire</option> <option value="ring">Cercle animé</option>
<option value="qr">QR classique</option> <option value="qr">QR classique</option>
</select> </select>
<div class="row"> <div class="row">
+23 -17
View File
@@ -17,10 +17,17 @@ body.screen {
background: #fff; border-radius: 28px; padding: 2vh; gap: 1.4vh; background: #fff; border-radius: 28px; padding: 2vh; gap: 1.4vh;
} }
.qr-wrap.ring { background: transparent; padding: 0; } .qr-wrap.ring { background: transparent; padding: 0; }
.entry { display: flex; align-items: center; gap: 1.2vw; margin-top: 3vh; background: var(--surface); border-radius: 18px; padding: 1.2vh 1.2vw; width: fit-content; } /* the entry qr docks in the bottom right corner, outside the layout: the ring never shrinks for it.
.entry canvas { width: clamp(140px, min(21vw, 34vh), 420px); height: auto; aspect-ratio: 1; image-rendering: pixelated; flex: none; } the column under it keeps that much room free (body.has-entry) */
.entry div { display: grid; gap: .3vh; font-size: clamp(.8rem, 1.1vw, 1.2rem); color: var(--ink-2); min-width: 0; overflow-wrap: break-word; } body.screen { --dock-qr: clamp(110px, min(19vh, 15vw), 300px); --dock-h: calc(var(--dock-qr) + 2.4vh + 2.9rem); }
.entry {
position: fixed; right: 3vw; bottom: 2.5vh; z-index: 5; display: grid; justify-items: center; gap: .8vh;
background: var(--surface); border-radius: 18px; padding: 1.2vh; text-align: center; max-width: 40vw;
}
.entry canvas { width: var(--dock-qr); height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.entry div { display: grid; gap: .2vh; font-size: clamp(.7rem, .95vw, 1rem); color: var(--ink-2); overflow-wrap: break-word; }
.entry b { color: var(--ink); font-weight: 700; } .entry b { color: var(--ink); font-weight: 700; }
body.has-entry .s-main:not(.split) .s-steps, body.has-entry .s-main.split #focus { padding-bottom: var(--dock-h); }
/* the ring loop resizes the canvas bitmap every frame: its intrinsic size must not feed the layout, /* the ring loop resizes the canvas bitmap every frame: its intrinsic size must not feed the layout,
or safari widens the column, which grows the bitmap, which widens the column... */ or safari widens the column, which grows the bitmap, which widens the column... */
#qr { width: 100%; height: 100%; min-width: 0; min-height: 0; contain: size; image-rendering: pixelated; image-rendering: crisp-edges; object-fit: contain; } #qr { width: 100%; height: 100%; min-width: 0; min-height: 0; contain: size; image-rendering: pixelated; image-rendering: crisp-edges; object-fit: contain; }
@@ -39,17 +46,20 @@ body.screen {
} }
/* a question on screen while the ring is up (vote with presence scans, late enrollment). the back rows read /* a question on screen while the ring is up (vote with presence scans, late enrollment). the back rows read
the ring, so it keeps the wider column and as much height as possible: title and entry qr share one line */ the ring, so it keeps the wider column and as much height as possible */
.s-main.split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 4vw; } .s-main.split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 4vw; }
.s-main.split .s-enroll { grid-template-columns: 1fr; justify-items: center; gap: 3vh; } .s-main.split .s-enroll { grid-template-columns: 1fr; justify-items: center; gap: 3vh; }
.s-main.split .s-enroll { grid-template-rows: minmax(0, 1fr) auto; gap: 1.5vh; height: 100%; } .s-main.split .s-enroll { grid-template-rows: minmax(0, 1fr) auto; gap: 1.5vh; height: 100%; }
.s-main.split .qr-wrap { height: 100%; width: auto; max-width: 100%; max-height: none; } .s-main.split .qr-wrap { height: 100%; width: auto; max-width: 100%; max-height: none; }
.s-main.split #qr-steps { display: none; } .s-main.split #qr-steps { display: none; }
.s-main.split .s-steps { display: flex; align-items: center; justify-content: center; gap: 2vw; text-align: left; } .s-main.split .s-steps { text-align: center; }
.s-main.split .s-steps h2 { font-size: clamp(1.2rem, 2.1vw, 2.4rem); margin: 0; } .s-main.split .s-steps h2 { font-size: clamp(1.2rem, 2.1vw, 2.4rem); margin: 0; }
.s-main.split .entry { margin: 0; padding: .8vh .8vw; gap: .8vw; } /* the question side scales with height too, so it still fits above the docked qr on short screens */
.s-main.split .entry canvas { width: clamp(70px, min(7vw, 11vh), 160px); } .s-main.split .s-focus .q-text { font-size: clamp(1.3rem, min(3.2vw, 6.5vh), 3.6rem); margin-bottom: 2.5vh; }
.s-main.split .entry div { font-size: clamp(.7rem, .9vw, 1rem); } .s-main.split .s-focus .opts { gap: 1vh; margin-bottom: 2.5vh; }
.s-main.split .s-focus .opts li { font-size: clamp(.95rem, min(1.8vw, 3.6vh), 2rem); padding: 1.1vh 1.5vw; }
.s-main.split .s-focus .turnout { font-size: clamp(.9rem, min(1.5vw, 3vh), 1.7rem); }
.s-main.split .s-focus .results .bar-row { font-size: clamp(.95rem, min(1.8vw, 3.6vh), 2rem); margin: 1.2vh 0; }
.s-main.split .s-steps li { font-size: clamp(1rem, 1.5vw, 1.6rem); } .s-main.split .s-steps li { font-size: clamp(1rem, 1.5vw, 1.6rem); }
.s-focus { align-self: center; max-width: 1400px; width: 100%; margin: 0 auto; } .s-focus { align-self: center; max-width: 1400px; width: 100%; margin: 0 auto; }
@@ -78,19 +88,15 @@ body.screen {
@media (max-aspect-ratio: 1/1) { @media (max-aspect-ratio: 1/1) {
.s-enroll, .s-main.split { grid-template-columns: 1fr; } .s-enroll, .s-main.split { grid-template-columns: 1fr; }
.qr-wrap { max-height: 50vh; justify-self: center; } .qr-wrap { max-height: 50vh; justify-self: center; }
/* upright screen: the ring takes what the text leaves, the entry qr sits next to the steps */ /* upright screen: the ring takes what the text leaves, the docked entry qr sits right of the steps */
body.screen { --dock-qr: clamp(100px, min(16vh, 26vw), 240px); }
.s-main:not(.split) .s-enroll { grid-template-rows: minmax(0, 1fr) auto; gap: 3vh; height: 100%; } .s-main:not(.split) .s-enroll { grid-template-rows: minmax(0, 1fr) auto; gap: 3vh; height: 100%; }
.s-main:not(.split) .qr-wrap { height: 100%; width: auto; max-width: 100%; max-height: none; } .s-main:not(.split) .qr-wrap { height: 100%; width: auto; max-width: 100%; max-height: none; }
.s-steps { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 4vw; align-items: center; } body.has-entry .s-main:not(.split) .s-steps { padding-bottom: 0; padding-right: calc(var(--dock-qr) + 6vw); }
.s-steps > * { grid-column: 1; } /* upright + question: ring and title share one row above the question */
.s-steps .entry { grid-column: 2; grid-row: 1 / span 3; flex-direction: column; gap: .8vh; margin: 0; padding: 1.2vh; text-align: center; }
.s-steps .entry div { font-size: clamp(.7rem, 2.2vw, 1.1rem); overflow-wrap: normal; white-space: nowrap; }
.s-steps .entry canvas { width: clamp(110px, min(30vw, 17vh), 300px); }
/* upright + question: ring and entry share one row above the question */
.s-main.split .s-enroll { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: none; height: auto; align-items: center; justify-items: stretch; } .s-main.split .s-enroll { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: none; height: auto; align-items: center; justify-items: stretch; }
.s-main.split .qr-wrap { height: auto; width: 100%; max-height: 38vh; justify-self: center; } .s-main.split .qr-wrap { height: auto; width: 100%; max-height: 38vh; justify-self: center; }
.s-main.split .s-steps { display: grid; grid-template-columns: auto; justify-items: center; row-gap: 1vh; text-align: center; } .s-main.split .s-steps { display: grid; grid-template-columns: auto; justify-items: center; row-gap: 1vh; text-align: center; max-width: 42vw; }
.s-main.split .s-steps .entry { grid-column: 1; grid-row: auto; }
} }
.qr-wrap.ring .tick { display: none; } .qr-wrap.ring .tick { display: none; }
+5
View File
@@ -38,6 +38,11 @@
<details class="advanced"> <details class="advanced">
<summary>Réglages du code</summary> <summary>Réglages du code</summary>
<label for="code-style">Code projeté</label>
<select id="code-style">
<option value="ring" selected>Cercle animé</option>
<option value="qr">QR classique</option>
</select>
<div class="row"> <div class="row">
<div> <div>
<label for="interval">Rotation du code</label> <label for="interval">Rotation du code</label>
+1
View File
@@ -14,6 +14,7 @@ $("#form").addEventListener("submit", async (e) => {
title: $("#title").value, title: $("#title").value,
interval_ms: +$("#interval").value, interval_ms: +$("#interval").value,
scans_required: +$("#scans").value, scans_required: +$("#scans").value,
code_style: $("#code-style").value,
expected: $("#expected").value ? +$("#expected").value : null, expected: $("#expected").value ? +$("#expected").value : null,
max_voters: $("#maxv").value ? +$("#maxv").value : null, max_voters: $("#maxv").value ? +$("#maxv").value : null,
require_code: $("#codes-on").checked, require_code: $("#codes-on").checked,
+3 -1
View File
@@ -45,7 +45,9 @@ function layout() {
$("#qr-steps").hidden = !st.enrollment_open; $("#qr-steps").hidden = !st.enrollment_open;
// rings can't be opened by the camera app, so a small fixed qr leads to the page // rings can't be opened by the camera app, so a small fixed qr leads to the page
$("#step1").textContent = ring ? "Ouvrez la page de vote" : "Scannez ce code"; $("#step1").textContent = ring ? "Ouvrez la page de vote" : "Scannez ce code";
reveal($("#entry"), !!(ring && st.enrollment_open && entry)); const entryOn = !!(ring && st.enrollment_open && entry);
reveal($("#entry"), entryOn);
document.body.classList.toggle("has-entry", entryOn);
$(".qr-wrap").classList.toggle("ring", ring); $(".qr-wrap").classList.toggle("ring", ring);
} }
+5 -4
View File
@@ -35,10 +35,6 @@
<li><span id="step1">Scannez ce code</span></li> <li><span id="step1">Scannez ce code</span></li>
<li><span>Visez l'écran <b id="secs">5</b>&nbsp;s</span></li> <li><span>Visez l'écran <b id="secs">5</b>&nbsp;s</span></li>
</ol> </ol>
<div id="entry" class="entry" hidden>
<canvas id="entry-qr" aria-label="QR code de la page de vote"></canvas>
<div><b>Pas encore sur la page ?</b><span id="entry-url"></span></div>
</div>
<p id="url-warn" class="notice warn" hidden></p> <p id="url-warn" class="notice warn" hidden></p>
</div> </div>
</section> </section>
@@ -51,6 +47,11 @@
</section> </section>
</main> </main>
<aside id="entry" class="entry" hidden>
<canvas id="entry-qr" aria-label="QR code de la page de vote"></canvas>
<div><b>Pas encore sur la page ?</b><span id="entry-url"></span></div>
</aside>
<footer class="s-foot"> <footer class="s-foot">
<div class="s-count"><b id="voters">0</b> <span id="voters-label">inscriptions</span></div> <div class="s-count"><b id="voters">0</b> <span id="voters-label">inscriptions</span></div>
</footer> </footer>