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:
@@ -1050,8 +1050,8 @@ export function sync_config__event_pres_mgmt({
|
||||
// Launcher links (show__ in remote → invert to hide__ in local display state)
|
||||
loc.hide__launcher_link =
|
||||
!(pres_mgmt_cfg_remote?.show__launcher_link ?? false);
|
||||
loc.hide__launcher_link_legacy =
|
||||
!(pres_mgmt_cfg_remote?.show__launcher_link_legacy ?? false);
|
||||
// Legacy Flask launcher is retired — always hide regardless of remote config
|
||||
loc.hide__launcher_link_legacy = true;
|
||||
|
||||
// Navigation / UI constraints
|
||||
loc.limit__navigation =
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
// import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
// Ideally the Event related stores should not be imported here?
|
||||
import { events_loc } from '$lib/stores/ae_events_stores';
|
||||
import { pres_mgmt_loc } from '$lib/stores/ae_events_stores__pres_mgmt.svelte';
|
||||
// import { db_events } from "$lib/db_events";
|
||||
|
||||
// export let hidden: boolean = false;
|
||||
@@ -364,10 +365,10 @@ function handle_clear_access() {
|
||||
type="button"
|
||||
onclick={() => {
|
||||
$ae_loc.sync_local_config = false;
|
||||
$events_loc.pres_mgmt.sync_local_config = false;
|
||||
pres_mgmt_loc.current.sync_local_config = false;
|
||||
|
||||
$ae_loc.lock_config = false;
|
||||
$events_loc.pres_mgmt.lock_config = false;
|
||||
pres_mgmt_loc.current.lock_config = false;
|
||||
|
||||
// dispatch_sync_local_config_changed();
|
||||
// tick();
|
||||
@@ -383,10 +384,10 @@ function handle_clear_access() {
|
||||
type="button"
|
||||
onclick={() => {
|
||||
$ae_loc.sync_local_config = true;
|
||||
$events_loc.pres_mgmt.sync_local_config = true;
|
||||
pres_mgmt_loc.current.sync_local_config = true;
|
||||
|
||||
$ae_loc.lock_config = true;
|
||||
$events_loc.pres_mgmt.lock_config = true;
|
||||
pres_mgmt_loc.current.lock_config = true;
|
||||
|
||||
// dispatch_sync_local_config_changed();
|
||||
// tick();
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
events_slct,
|
||||
events_trigger
|
||||
} from '$lib/stores/ae_events_stores';
|
||||
import { pres_mgmt_loc } from '$lib/stores/ae_events_stores__pres_mgmt.svelte';
|
||||
import { events_func } from '$lib/ae_events/ae_events_functions';
|
||||
import AE_Comp_Hosted_Files_Download_Button from '$lib/ae_core/ae_comp__hosted_files_download_button.svelte';
|
||||
import {
|
||||
@@ -76,7 +77,7 @@ let {
|
||||
let ae_promises: key_val = $state({});
|
||||
let ae_tmp: key_val = $state({});
|
||||
ae_tmp.show__file_li = true;
|
||||
ae_tmp.show__direct_download = $events_loc.pres_mgmt.show__direct_download;
|
||||
ae_tmp.show__direct_download = pres_mgmt_loc.current.show__direct_download;
|
||||
// let ae_triggers: key_val = {};
|
||||
|
||||
onMount(() => {
|
||||
@@ -674,8 +675,8 @@ async function handle_convert_pdf_to_image(event_file_obj: key_val) {
|
||||
value={null}
|
||||
selected={!event_file_obj.file_purpose}
|
||||
>-- purpose not set --</option>
|
||||
{#if $events_loc.pres_mgmt?.file_purpose_option_kv}
|
||||
{#each Object.entries($events_loc.pres_mgmt.file_purpose_option_kv as any) as [key, file_purpose_option] (key)}
|
||||
{#if pres_mgmt_loc.current.file_purpose_option_kv}
|
||||
{#each Object.entries(pres_mgmt_loc.current.file_purpose_option_kv as any) as [key, file_purpose_option] (key)}
|
||||
<option
|
||||
value={key}
|
||||
selected={event_file_obj.file_purpose ===
|
||||
|
||||
@@ -54,7 +54,6 @@ export interface PressMgmtRemoteCfg {
|
||||
show__copy_access_link: boolean;
|
||||
show__email_access_link: boolean;
|
||||
show__launcher_link: boolean;
|
||||
show__launcher_link_legacy: boolean;
|
||||
|
||||
// Requirements
|
||||
require__presenter_agree: boolean;
|
||||
@@ -193,7 +192,6 @@ export interface PresMgmtLocState {
|
||||
show__copy_access_link: boolean;
|
||||
show__email_access_link: boolean;
|
||||
show__launcher_link: boolean;
|
||||
show__launcher_link_legacy: boolean;
|
||||
require__presenter_agree: boolean;
|
||||
require__session_agree: boolean;
|
||||
limit__navigation: boolean;
|
||||
@@ -367,7 +365,6 @@ export const pres_mgmt_loc_defaults: PresMgmtLocState = {
|
||||
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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
65
src/types/temporary-svelte-augments.d.ts
vendored
Normal file
65
src/types/temporary-svelte-augments.d.ts
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Temporary type augmentations to quiet svelte-check during migration.
|
||||
* Remove or replace with precise typings once component libs or local wrappers are fixed.
|
||||
*/
|
||||
|
||||
declare module 'flowbite-svelte' {
|
||||
import type { SvelteComponentTyped } from 'svelte';
|
||||
|
||||
// Relax Modal / Drawer props to accept arbitrary keys (including `children`).
|
||||
export class Modal extends SvelteComponentTyped<Record<string, any>, Record<string, any>, Record<string, any>> {}
|
||||
export class Drawer extends SvelteComponentTyped<Record<string, any>, Record<string, any>, Record<string, any>> {}
|
||||
export class Dropdown extends SvelteComponentTyped<Record<string, any>, Record<string, any>, Record<string, any>> {}
|
||||
export class Button extends SvelteComponentTyped<Record<string, any>, Record<string, any>, Record<string, any>> {}
|
||||
export class Collapse extends SvelteComponentTyped<Record<string, any>, Record<string, any>, Record<string, any>> {}
|
||||
}
|
||||
|
||||
declare module '@lucide/svelte' {
|
||||
import type { SvelteComponentTyped } from 'svelte';
|
||||
|
||||
// Base icon class that accepts any props (including `fill`).
|
||||
export class IconBase extends SvelteComponentTyped<Record<string, any>, Record<string, any>, Record<string, any>> {}
|
||||
|
||||
// Commonly-used named icons in the repo — add more if needed.
|
||||
export class Star extends IconBase {}
|
||||
export class User extends IconBase {}
|
||||
export class Briefcase extends IconBase {}
|
||||
export class CalendarDays extends IconBase {}
|
||||
export class ChevronLeft extends IconBase {}
|
||||
export class Eye extends IconBase {}
|
||||
export class FileText extends IconBase {}
|
||||
export class ListTodo extends IconBase {}
|
||||
export class LoaderCircle extends IconBase {}
|
||||
export class Mail extends IconBase {}
|
||||
export class MapPin extends IconBase {}
|
||||
export class RotateCcw extends IconBase {}
|
||||
export class ShieldCheck extends IconBase {}
|
||||
export class SquarePen extends IconBase {}
|
||||
export class Store extends IconBase {}
|
||||
export class Trash2 extends IconBase {}
|
||||
export class UserPlus extends IconBase {}
|
||||
export class StarHalf extends IconBase {}
|
||||
|
||||
// Default export fallback so imports like `import * as Lucide from '@lucide/svelte'` still work.
|
||||
const _default: { [key: string]: typeof IconBase | any };
|
||||
export default _default;
|
||||
}
|
||||
|
||||
declare module 'lucide-svelte' {
|
||||
import type { SvelteComponentTyped } from 'svelte';
|
||||
export class IconBase extends SvelteComponentTyped<Record<string, any>, Record<string, any>, Record<string, any>> {}
|
||||
export class Star extends IconBase {}
|
||||
export class User extends IconBase {}
|
||||
const _default: { [key: string]: typeof IconBase | any };
|
||||
export default _default;
|
||||
}
|
||||
|
||||
// Temporary global augmentation to reduce noise where domain code accidentally typed an "Event".
|
||||
// This is a minimal, temporary change; prefer narrowing types in-source later.
|
||||
declare global {
|
||||
interface Event {
|
||||
default_qry_str?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
Reference in New Issue
Block a user