Big entry qr beside the ring as an admin option (corner again once a question is up); admin lists questions newest first, open vote on top

This commit is contained in:
2026-11-17 14:12:26 +01:00
parent 70d09b1008
commit d761d8b510
7 changed files with 31 additions and 5 deletions
+5
View File
@@ -47,6 +47,11 @@
<option value="ring">Cercle animé</option>
<option value="qr">QR classique</option>
</select>
<label for="s-entry-big">QR d'entrée</label>
<select id="s-entry-big">
<option value="0">Dans le coin</option>
<option value="1">Grand, à côté du cercle</option>
</select>
<div class="row">
<div>
<label for="s-interval">Rotation du code</label>
+10
View File
@@ -30,6 +30,12 @@ body.split-on { --dock-qr: clamp(130px, min(26vh, 19vw), 380px); }
.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; }
body.has-entry .s-main:not(.split) .s-steps, body.has-entry .s-main.split #focus { padding-bottom: var(--dock-h); }
/* big mode: the entry qr takes the right column beside the ring, the steps give it the room.
translate, not transform: the entrance animation owns transform */
body.entry-big { --dock-qr: clamp(180px, min(58vh, 34vw), 640px); }
body.entry-big .entry { top: 50%; bottom: auto; right: max(4vw, calc((50vw - var(--dock-qr)) / 2 - 2vw)); translate: 0 -46%; padding: 2vh; gap: 1.2vh; }
body.entry-big .entry div { font-size: clamp(.9rem, 1.4vw, 1.6rem); }
body.entry-big .s-main:not(.split) .s-steps { visibility: hidden; }
/* 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... */
#qr { width: 100%; height: 100%; min-width: 0; min-height: 0; contain: size; image-rendering: pixelated; image-rendering: crisp-edges; object-fit: contain; }
@@ -95,6 +101,10 @@ body.has-entry .s-main:not(.split) .s-steps, body.has-entry .s-main.split #focus
.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; }
body.has-entry .s-main:not(.split) .s-steps { padding-bottom: 0; padding-right: calc(var(--dock-qr) + 6vw); }
/* no room beside the ring on an upright screen: the big qr stays a (bigger) corner one */
body.entry-big { --dock-qr: clamp(140px, min(26vh, 40vw), 400px); }
body.entry-big .entry { top: auto; bottom: 1.5vh; right: 1.2vw; translate: none; }
body.entry-big .s-main:not(.split) .s-steps { visibility: visible; }
/* upright + question: ring and title 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 .qr-wrap { height: auto; width: 100%; max-height: 38vh; justify-self: center; }
+5 -2
View File
@@ -78,6 +78,8 @@ function renderSettings(p) {
if (active !== $("#s-max")) $("#s-max").value = p.max_voters ?? "";
if (active !== $("#s-vote-scans")) $("#s-vote-scans").value = String(p.vote_scans);
if (active !== $("#s-code-style")) $("#s-code-style").value = p.code_style;
if (active !== $("#s-entry-big")) $("#s-entry-big").value = p.entry_big ? "1" : "0";
$("#s-entry-big").disabled = p.code_style !== "ring";
$("#s-code").checked = p.require_code;
$("#access-row").hidden = !p.require_code && !state.codes.access.total;
const sum = (c, none) => (c.total ? `${c.used} utilisé${c.used > 1 ? "s" : ""} sur ${c.total}` : none);
@@ -92,8 +94,8 @@ function renderQuestions() {
box.append(h("p", { class: "empty" }, "Aucune question pour l'instant."));
return;
}
const order = { open: 0, draft: 1, closed: 2 };
const qs = [...state.questions].sort((a, b) => order[a.state] - order[b.state] || a.id - b.id);
// the open vote first, then newest first: a question just created or just closed stays at the top
const qs = [...state.questions].sort((a, b) => (b.state === "open") - (a.state === "open") || b.id - a.id);
for (const q of qs) box.append(questionCard(q));
}
@@ -207,6 +209,7 @@ const SETTINGS = {
"#s-code": (el) => ({ require_code: el.checked }),
"#s-vote-scans": (el) => ({ vote_scans: +el.value }),
"#s-code-style": (el) => ({ code_style: el.value }),
"#s-entry-big": (el) => ({ entry_big: el.value === "1" }),
};
for (const [sel, build] of Object.entries(SETTINGS)) {
$(sel).addEventListener("change", async (e) => {
+4
View File
@@ -49,6 +49,10 @@ function layout() {
const entryOn = !!(ring && st.enrollment_open && entry);
reveal($("#entry"), entryOn);
document.body.classList.toggle("has-entry", entryOn);
// big entry qr next to the ring (start of a meeting), back to the corner once a question is up
const big = entryOn && st.entry_big && !focus;
document.body.classList.toggle("entry-big", big);
$("#entry-hint").textContent = big ? "Scannez ici, puis visez le cercle" : "Pas encore sur la page ?";
$(".qr-wrap").classList.toggle("ring", ring);
}
+1 -1
View File
@@ -49,7 +49,7 @@
<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>
<div><b id="entry-hint">Pas encore sur la page ?</b><span id="entry-url"></span></div>
</aside>
<footer class="s-foot">