pres_mgmt config: remove legacy launcher option, add back button + dirty state to config UI
- Remove show__launcher_link_legacy from PressMgmtRemoteCfg, PresMgmtLocState, and
pres_mgmt_loc_defaults — the Flask/legacy launcher is retired
- Sync function now hardcodes hide__launcher_link_legacy=true (always hidden)
- Config page: back button to pres_mgmt, save buttons disabled until changes made
- Fix {#each} key expressions in config page
- Migrate e_app_access_type and element_manage_event_file_li to pres_mgmt_loc store
- Add temporary svelte type augments file (src/types/)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import { api } from '$lib/api/api';
|
||||
import type { PressMgmtRemoteCfg } from '$lib/stores/ae_events_stores__pres_mgmt_defaults';
|
||||
import {
|
||||
AlertTriangle,
|
||||
ArrowLeft,
|
||||
Check,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
@@ -69,7 +70,6 @@ const cfg_defaults: PressMgmtRemoteCfg = {
|
||||
show__copy_access_link: false,
|
||||
show__email_access_link: false,
|
||||
show__launcher_link: false,
|
||||
show__launcher_link_legacy: false,
|
||||
require__presenter_agree: false,
|
||||
require__session_agree: false,
|
||||
limit__navigation: false,
|
||||
@@ -83,16 +83,20 @@ let draft: PressMgmtRemoteCfg = $state({ ...cfg_defaults });
|
||||
// Draft is initialized from event data once on load; user edits from there.
|
||||
// Intentionally NOT reactive after init — prevents live overwrites while editing.
|
||||
let draft_initialized = $state(false);
|
||||
let initial_json = $state('');
|
||||
$effect(() => {
|
||||
const event_cfg = $lq__event_obj?.mod_pres_mgmt_json;
|
||||
if (event_cfg && !draft_initialized) {
|
||||
untrack(() => {
|
||||
draft = { ...cfg_defaults, ...event_cfg };
|
||||
initial_json = JSON.stringify(draft);
|
||||
draft_initialized = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let is_dirty = $derived(draft_initialized && JSON.stringify(draft) !== initial_json);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// JSON fields (file_purpose_option_kv, hide__report_kv) as textarea strings
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -167,6 +171,7 @@ async function save() {
|
||||
event_id: event_id,
|
||||
log_lvl: 1
|
||||
});
|
||||
initial_json = JSON.stringify(draft); // reset dirty baseline
|
||||
save_status = 'success';
|
||||
setTimeout(() => (save_status = 'idle'), 3000);
|
||||
} catch (e) {
|
||||
@@ -210,6 +215,11 @@ function toggle(key: string) {
|
||||
<!-- Header -->
|
||||
<header class="flex items-center justify-between gap-4">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="/events/{event_id}/pres_mgmt"
|
||||
class="btn btn-sm preset-tonal-surface"
|
||||
title="Back to Pres Mgmt">
|
||||
<ArrowLeft size="1em" />
|
||||
</a>
|
||||
<Settings size="1.2em" class="text-primary-500" />
|
||||
<h1 class="text-xl font-bold">Pres Mgmt Config</h1>
|
||||
</div>
|
||||
@@ -227,7 +237,7 @@ function toggle(key: string) {
|
||||
type="button"
|
||||
class="btn preset-filled-primary-500"
|
||||
onclick={save}
|
||||
disabled={save_status === 'saving'}>
|
||||
disabled={!is_dirty || save_status === 'saving'}>
|
||||
<Save size="1em" class="mr-1" />
|
||||
{save_status === 'saving' ? 'Saving...' : 'Save'}
|
||||
</button>
|
||||
@@ -340,7 +350,7 @@ function toggle(key: string) {
|
||||
{ field: 'hide__location_code' as const, label: 'Hide Location Code' },
|
||||
{ field: 'hide__presenter_code' as const, label: 'Hide Presenter Code' },
|
||||
{ field: 'hide__presentation_code' as const, label: 'Hide Presentation Code' }
|
||||
] as item}
|
||||
] as item (item.field)}
|
||||
<label class="flex items-center gap-2">
|
||||
<input type="checkbox" class="checkbox" bind:checked={draft[item.field]} />
|
||||
<span class="text-sm">{item.label}</span>
|
||||
@@ -371,7 +381,7 @@ function toggle(key: string) {
|
||||
{ field: 'hide__session_poc_biography' as const, label: 'Hide POC Biography' },
|
||||
{ field: 'hide__session_poc_profile' as const, label: 'Hide POC Profile' },
|
||||
{ field: 'hide__session_poc_profile_pic' as const, label: 'Hide POC Profile Pic' }
|
||||
] as item}
|
||||
] as item (item.field)}
|
||||
<label class="flex items-center gap-2">
|
||||
<input type="checkbox" class="checkbox" bind:checked={draft[item.field]} />
|
||||
<span class="text-sm">{item.label}</span>
|
||||
@@ -443,9 +453,8 @@ function toggle(key: string) {
|
||||
{#each [
|
||||
{ field: 'show__copy_access_link' as const, label: 'Copy Access Link' },
|
||||
{ field: 'show__email_access_link' as const, label: 'Email Access Link' },
|
||||
{ field: 'show__launcher_link' as const, label: 'Launcher Link (SvelteKit)' },
|
||||
{ field: 'show__launcher_link_legacy' as const, label: 'Launcher Link (Legacy Flask)' }
|
||||
] as item}
|
||||
{ field: 'show__launcher_link' as const, label: 'Launcher Link' }
|
||||
] as item (item.field)}
|
||||
<label class="flex items-center gap-2">
|
||||
<input type="checkbox" class="checkbox" bind:checked={draft[item.field]} />
|
||||
<span class="text-sm">{item.label}</span>
|
||||
@@ -573,7 +582,7 @@ function toggle(key: string) {
|
||||
type="button"
|
||||
class="btn preset-filled-primary-500"
|
||||
onclick={save}
|
||||
disabled={save_status === 'saving'}>
|
||||
disabled={!is_dirty || save_status === 'saving'}>
|
||||
<Save size="1em" class="mr-1" />
|
||||
{save_status === 'saving' ? 'Saving...' : 'Save Config'}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user