pres_mgmt: fix session QR never showing for POCs/presenters

The condition (show__session_qr || trusted_access) && show_content__session_qr
required the local per-browser toggle to also be true. Non-trusted users
(POCs, presenters) have no way to set it, so QR never appeared even when
admin had enabled it in Config.

New logic: show__session_qr alone is sufficient to generate and display the QR.
show_content__session_qr is now a staff-only override for when admin has NOT
enabled QR globally (allows trusted users to force it on per-browser).

Also: add QR Code toggle to session page Options modal (Display section),
visible to trusted staff only when admin has not already enabled it globally.
This commit is contained in:
Scott Idem
2026-06-16 12:02:03 -04:00
parent d75c4bbb9f
commit 2e4547f433
2 changed files with 34 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ let {
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { Modal } from 'flowbite-svelte'; import { Modal } from 'flowbite-svelte';
import { Clock, Info, Send, Settings, ToggleLeft, ToggleRight, X } from '@lucide/svelte'; import { Clock, Info, QrCode, Send, Settings, ToggleLeft, ToggleRight, X } from '@lucide/svelte';
import { ae_loc, ae_api } from '$lib/stores/ae_stores'; import { ae_loc, ae_api } from '$lib/stores/ae_stores';
import { events_slct } from '$lib/stores/ae_events_stores'; import { events_slct } from '$lib/stores/ae_events_stores';
import { pres_mgmt_loc } from '$lib/stores/ae_events_stores__pres_mgmt.svelte'; import { pres_mgmt_loc } from '$lib/stores/ae_events_stores__pres_mgmt.svelte';
@@ -191,6 +191,33 @@ async function toggle_hide_launcher() {
{pres_mgmt_loc.current.use_12h ? '12-Hour Time' : '24-Hour Time'} {pres_mgmt_loc.current.use_12h ? '12-Hour Time' : '24-Hour Time'}
</span> </span>
</button> </button>
<!-- QR Code toggle — only shown to trusted staff and only when
admin has NOT already enabled QR globally (if they have,
it shows automatically without needing this toggle) -->
{#if $ae_loc.trusted_access && !pres_mgmt_loc.current.show__session_qr}
<button
type="button"
onclick={() => {
pres_mgmt_loc.current.show_content__session_qr =
!pres_mgmt_loc.current.show_content__session_qr;
}}
class="btn btn-sm mt-1 w-full justify-between"
class:ae_btn_surface={pres_mgmt_loc.current.show_content__session_qr}
class:ae_btn_surface_outlined={!pres_mgmt_loc.current.show_content__session_qr}>
{#if pres_mgmt_loc.current.show_content__session_qr}<ToggleRight
size="1em"
class="mr-1" />{:else}<ToggleLeft
size="1em"
class="mr-1" />{/if}
<span class="grow">
<QrCode size="1em" class="mr-1" />
{pres_mgmt_loc.current.show_content__session_qr
? 'Hide QR Code'
: 'Show QR Code'}
</span>
</button>
{/if}
</section> </section>
<!-- Launcher Settings --> <!-- Launcher Settings -->

View File

@@ -175,10 +175,13 @@ let poc_is_authed = $derived(
// QR Code Generation Logic // QR Code Generation Logic
$events_sess.pres_mgmt.session__updated_on = null; $events_sess.pres_mgmt.session__updated_on = null;
$effect(() => { $effect(() => {
// Generate QR when admin has enabled it (show__session_qr) OR trusted staff
// has turned on their local override (show_content__session_qr).
// show_content__session_qr is NOT required when show__session_qr is true —
// non-trusted users (POCs, presenters) have no way to toggle it.
if ( if (
$lq__event_session_obj?.id && $lq__event_session_obj?.id &&
(pres_mgmt_loc.current.show__session_qr || $ae_loc.trusted_access) && (pres_mgmt_loc.current.show__session_qr || ($ae_loc.trusted_access && pres_mgmt_loc.current.show_content__session_qr)) &&
pres_mgmt_loc.current.show_content__session_qr &&
!$events_sess.pres_mgmt.session_qr_url[$lq__event_session_obj.id] !$events_sess.pres_mgmt.session_qr_url[$lq__event_session_obj.id]
) { ) {
$events_sess.pres_mgmt.session_qr_url[$lq__event_session_obj.id] = true; $events_sess.pres_mgmt.session_qr_url[$lq__event_session_obj.id] = true;
@@ -237,7 +240,7 @@ async function send_poc_email_link() {
<!-- QR code: floats top-right, compact by default, toggle to enlarge. <!-- QR code: floats top-right, compact by default, toggle to enlarge.
Only rendered once the async URL is resolved (string), never while Only rendered once the async URL is resolved (string), never while
it is still the boolean `true` loading placeholder. --> it is still the boolean `true` loading placeholder. -->
{#if $lq__event_session_obj && (pres_mgmt_loc.current.show__session_qr || $ae_loc.trusted_access) && typeof $events_sess.pres_mgmt.session_qr_url?.[$lq__event_session_obj.id] === 'string'} {#if $lq__event_session_obj && (pres_mgmt_loc.current.show__session_qr || ($ae_loc.trusted_access && pres_mgmt_loc.current.show_content__session_qr)) && typeof $events_sess.pres_mgmt.session_qr_url?.[$lq__event_session_obj.id] === 'string'}
<div class="float-right mb-1 ml-3 flex flex-col items-center gap-1"> <div class="float-right mb-1 ml-3 flex flex-col items-center gap-1">
<button <button
type="button" type="button"