Duplicated screen mode: /present shows the projector view with the admin in a drawer (Gérer); both modes offered on the links page and the share tab
This commit is contained in:
@@ -116,6 +116,10 @@
|
||||
<div><b>Lien projecteur</b><span class="muted">Révoque le précédent</span></div>
|
||||
<button id="screen-rotate" class="small" type="button">Nouveau lien</button>
|
||||
</div>
|
||||
<div class="share-row">
|
||||
<div><b>Écran dupliqué</b><span class="muted">Projection et gestion sur le même écran</span></div>
|
||||
<a id="open-present" class="btn small" href="#" target="_blank" rel="noopener">Ouvrir</a>
|
||||
</div>
|
||||
<div class="share-row">
|
||||
<div><b>Résultats</b><span class="muted">Bulletins anonymes et décomptes</span></div>
|
||||
<button id="export" class="small" type="button">Exporter</button>
|
||||
|
||||
@@ -184,3 +184,5 @@ details.advanced { margin-top: 14px; }
|
||||
details.advanced summary { font-size: .82rem; color: var(--ink-3); cursor: pointer; width: fit-content; padding: 4px 0; }
|
||||
details.advanced summary:hover { color: var(--ink-2); }
|
||||
details.advanced[open] summary { color: var(--ink-2); }
|
||||
.mode-title { font-size: 1.05rem; margin: 22px 0 2px; }
|
||||
.mode-title + .hint { margin: 0 0 8px; }
|
||||
|
||||
@@ -142,3 +142,16 @@ body.entry-q-on { --dock-qr: clamp(160px, min(46vh, 30vw), 520px); }
|
||||
.s-main > section, .entry, #focus.enter *, #voters.bump { animation: none !important; }
|
||||
.turnout .progress > div { transition: none; }
|
||||
}
|
||||
|
||||
/* duplicated screen: the admin slides in over the projection, the room sees it while it's open */
|
||||
.ctl {
|
||||
position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(480px, 94vw); display: grid; grid-template-rows: auto 1fr;
|
||||
background: var(--bg); box-shadow: -12px 0 40px rgba(28, 32, 54, .18); translate: 105% 0; transition: translate .35s cubic-bezier(.2, .7, .2, 1);
|
||||
}
|
||||
.ctl.open { translate: 0 0; }
|
||||
.ctl-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font: 700 1rem var(--round); }
|
||||
.ctl iframe { width: 100%; height: 100%; border: 0; background: var(--bg); }
|
||||
/* the manage button stays reachable in full screen, faint until hovered */
|
||||
:fullscreen .s-tools .ctl-btn { display: inline-flex; opacity: .3; }
|
||||
:fullscreen .s-tools .ctl-btn:hover, :fullscreen .s-tools .ctl-btn:focus-visible { opacity: 1; }
|
||||
@media (prefers-reduced-motion: reduce) { .ctl { transition: none; } }
|
||||
|
||||
@@ -75,6 +75,8 @@
|
||||
<section id="done" class="card" hidden>
|
||||
<h1>Scrutin créé</h1>
|
||||
<div class="notice warn">Conservez le lien d'administration : il ne pourra pas être récupéré.</div>
|
||||
<h2 class="mode-title">Écran splitté</h2>
|
||||
<p class="hint">L'administration sur votre écran, le projecteur sur l'écran étendu.</p>
|
||||
<div class="duo stack">
|
||||
<div class="pane">
|
||||
<div class="pane-head"><svg class="icon" viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 5h16v11H4z"/><path d="M2 19.5h20"/><path d="M8 9h8"/><path d="M8 12.5h5"/></svg><p><b>Administration</b><span>Sur votre écran</span></p></div>
|
||||
@@ -87,6 +89,19 @@
|
||||
<a id="go-screen" class="btn block" href="#" target="_blank" rel="noopener">Ouvrir le projecteur</a>
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="mode-title">Écran dupliqué</h2>
|
||||
<p class="hint">Un seul écran, recopié sur le projecteur. Le bouton « Gérer » ouvre l'administration par-dessus.</p>
|
||||
<div class="duo stack">
|
||||
<div class="pane">
|
||||
<div class="pane-head"><svg class="icon" viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 5h16v11H4z"/><path d="M2 19.5h20"/><path d="M8 9h8"/><path d="M8 12.5h5"/></svg><p><b>Administration</b><span>Sur votre écran</span></p></div>
|
||||
<div class="linkbox"><input id="admin-link" type="text" readonly aria-label="Lien d'administration"><button id="copy-admin" class="small" type="button">Copier</button></div>
|
||||
<a id="go-admin" class="btn primary block" href="#" target="_blank" rel="noopener">Ouvrir l'administration</a>
|
||||
</div>
|
||||
<div class="pane">
|
||||
<div class="pane-head"><svg class="icon" viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 4h20"/><path d="M4 4v10h16V4"/><path d="M12 14v3"/><path d="M8.5 21l3.5-4 3.5 4"/></svg><p><b>Écran unique</b><span>Projection et gestion au même endroit</span></p></div>
|
||||
<a id="go-present" class="btn block" href="#" target="_blank" rel="noopener">Ouvrir l'écran dupliqué</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
@@ -321,3 +321,6 @@ liveSocket(`/ws/${pid}/admin`, {
|
||||
c.textContent = "Reconnexion…";
|
||||
},
|
||||
});
|
||||
|
||||
// duplicated screen: the projector view with this admin in a drawer, same admin key
|
||||
$("#open-present").href = `/present/${pid}#${encodeURIComponent(key)}`;
|
||||
|
||||
@@ -28,6 +28,7 @@ $("#form").addEventListener("submit", async (e) => {
|
||||
$("#screen-link").value = screen;
|
||||
$("#go-admin").href = admin;
|
||||
$("#go-screen").href = screen;
|
||||
$("#go-present").href = `${location.origin}/present/${res.id}#${res.admin_key}`;
|
||||
$("#create").hidden = true;
|
||||
$("#try-link").hidden = true;
|
||||
$("#done").hidden = false;
|
||||
|
||||
+23
-1
@@ -2,7 +2,9 @@ import { $, h, pollId, takeKey, liveSocket, drawQR, resultsView, pct } from "./c
|
||||
import { render as drawRing, DISC } from "./ringcode.js";
|
||||
|
||||
const pid = pollId();
|
||||
const key = takeKey(`rv_screen_${pid}`);
|
||||
// /present/: duplicated screen, the laptop shows what the projector shows. admin key, admin in a drawer
|
||||
const present = location.pathname.startsWith("/present/");
|
||||
const key = takeKey(present ? `rv_present_${pid}` : `rv_screen_${pid}`);
|
||||
let st = null;
|
||||
let qr = null; // current code message, qr or ring
|
||||
let raf = 0;
|
||||
@@ -224,3 +226,23 @@ liveSocket(`/ws/${pid}/screen`, {
|
||||
if (s !== "online") { qr = null; const cv = $("#qr"); cv.getContext("2d").clearRect(0, 0, cv.width, cv.height); }
|
||||
},
|
||||
});
|
||||
|
||||
if (present) {
|
||||
const btn = h("button", { class: "small ctl-btn", type: "button", "aria-expanded": "false" }, "Gérer");
|
||||
const close = h("button", { class: "small", type: "button" }, "Fermer");
|
||||
const drawer = h("aside", { class: "ctl", "aria-label": "Gestion du scrutin" },
|
||||
h("div", { class: "ctl-head" }, h("b", {}, "Gestion"), close));
|
||||
document.body.append(drawer);
|
||||
$(".s-tools").prepend(btn);
|
||||
const toggle = (open) => {
|
||||
// the admin page loads on first open only, and keeps its state when the drawer closes
|
||||
if (open && !drawer.querySelector("iframe")) {
|
||||
drawer.append(h("iframe", { src: `/admin/${pid}#${encodeURIComponent(key)}`, title: "Administration" }));
|
||||
}
|
||||
drawer.classList.toggle("open", open);
|
||||
btn.setAttribute("aria-expanded", String(open));
|
||||
};
|
||||
btn.addEventListener("click", () => toggle(!drawer.classList.contains("open")));
|
||||
close.addEventListener("click", () => toggle(false));
|
||||
document.addEventListener("keydown", (e) => { if (e.key === "Escape") toggle(false); });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user