Bug fix for IDAA Archive Content edit button. Updates related to new Launcher.

This commit is contained in:
Scott Idem
2025-07-22 15:56:07 -04:00
parent 7d07879e21
commit 1e94043e19
6 changed files with 256 additions and 246 deletions

View File

@@ -590,10 +590,15 @@ $effect(() => {
</title>
</svelte:head>
<!-- max-w-(--breakpoint-xl) -->
<div
class="
static max-w-(--breakpoint-xl) m-auto border border-gray-200 dark:border-gray-600 mt-12 mb-14 sm:mb-12
h-full
static
m-auto
border border-gray-200 dark:border-gray-600
mt-12 mb-14 sm:mb-12
h-full w-full max-w-7xl
"
>
@@ -632,7 +637,7 @@ $effect(() => {
<!-- The menu should be to the left of the main session view. -->
<div
class="
container h-full min-w-full w-full
h-full min-w-full w-full max-w-full
flex flex-col sm:flex-row flex-wrap sm:flex-nowrap gap-0
items-center
justify-center
@@ -644,14 +649,14 @@ $effect(() => {
<section
id="Main-Nav-Menu"
class="event_launcher_menu
container h-full
flex flex-col flex-wrap gap-1 items-center justify-start py-1 px-0.5
h-full
basis-1/5
min-w-56 md:min-w-64 lg:min-w-72
max-w-xs
border-gray-200
overflow-x-auto
py-1 px-0.5
flex flex-col gap-1 items-center justify-start
overflow-y-auto
border-r border-gray-300 dark:border-gray-600
"
class:hidden={$events_loc.launcher.hide__launcher_menu}
>
@@ -690,12 +695,16 @@ $effect(() => {
<section
id="Main-Content"
class="event_launcher_main
container h-full flex flex-col gap-1 py-1 px-2
items-center
basis-4/5
h-full
min-w-xs
max-w-full
py-1 px-1
basis-4/5
flex flex-col gap-1
items-center
justify-center
overflow-y-auto
"
>

View File

@@ -1,10 +1,47 @@
<script lang="ts">
export let log_lvl: number = 0;
interface Props {
log_lvl?: number;
// *** Export/Exposed variables and functions for component
event_file_obj: any;
// export let os: string = null;
max_filename_length?: number;
hide_launch_icon?: boolean;
hide_meta?: boolean;
hide_created_on?: boolean;
hide_os?: boolean;
hide_size?: boolean;
show_bak_download?: boolean;
// export let hide_api_download: boolean = true;
btn_size?: string;
session_type?: string; // oral, poster, workshop, symposium, roundtable, other
open_method?: null|string; // modal, download, native open (download, cache, copy, open), URL
modal_title?: string;
}
// *** Import Svelte core
let {
log_lvl = 0,
event_file_obj,
max_filename_length = 50,
hide_launch_icon = false,
hide_meta = false,
hide_created_on = false,
hide_os = false,
hide_size = false,
show_bak_download = false,
btn_size = 'btn_md',
session_type = 'oral',
open_method = 'download',
modal_title = $bindable('')
}: Props = $props();
// *** Import Svelte specific
import { preventDefault } from 'svelte/legacy';
import { onMount, tick } from 'svelte';
import { fade, scale, fly } from 'svelte/transition';
// *** Import other supporting libraries
// *** Import Aether specific variables and functions
import type { key_val } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { api } from '$lib/api';
@@ -15,47 +52,16 @@ import { events_func } from '$lib/ae_events_functions';
import Element_ae_crud from '$lib/element_ae_crud.svelte';
// *** Import Aether core variables and functions
// import { ae } from 'aether_npm_lib';
// import { } from '../../mods/electron.js';
// import { ae_event_launcher, event_file_obj_def, open_event_file_as_modal, screen_saver_img_kv } from '../../stores_mod_events';
// *** Import Aether core components
// *** Import Aether module variables and functions
// import { download_event_file } from '../stores_event_api.js';
// *** Import Aether module components
// *** Export/Exposed variables and functions for component
export let event_file_obj: any;
// export let use_os: boolean = false;
// export let os: string = null;
export let max_filename_length: number = 50;
export let hide_launch_icon: boolean = false;
export let hide_meta: boolean = false;
export let hide_created_on: boolean = false;
export let hide_os: boolean = false;
export let hide_size: boolean = false;
export let show_bak_download: boolean = false;
// export let hide_api_download: boolean = true;
export let btn_size: string = 'btn_md';
export let session_type: string = 'oral'; // oral, poster, workshop, symposium, roundtable, other
export let open_method: null|string = 'download'; // modal, download, native open (download, cache, copy, open), URL
export let modal_title: string = '';
// *** Set initial variables
// *** Functions and Logic
let ae_downloads: key_val = {};
let ae_promises: key_val = {};
let ae_tmp: key_val = {};
let ae_triggers: key_val = {};
let ae_promises: key_val = $state({});
let ae_tmp: key_val = $state({});
let ae_triggers: key_val = $state({});
let open_file_clicked: null|boolean = null;
let open_file_status: null|string = null; // null, 'checking_cache', 'checking_cache_failed', 'downloading_file', 'downloading_file_failed', 'opening_file', 'opening_file_failed', 'opening_file_success'
let open_file_status_message: null|string = null;
let open_file_clicked: null|boolean = $state(null);
let open_file_status: null|string = $state(null); // null, 'checking_cache', 'checking_cache_failed', 'downloading_file', 'downloading_file_failed', 'opening_file', 'opening_file_failed', 'opening_file_success'
let open_file_status_message: null|string = $state(null);
if (!$events_loc.launcher.screen_saver_img_kv) {
$events_loc.launcher.screen_saver_img_kv = {};
@@ -264,7 +270,7 @@ async function handle_open_file() {
<p>Please close the file when finished.</p>
{:else}
<strong>*** Please wait while this file downloads... ***</strong>
<p>Onsite in the Speaker Ready Room and conference session rooms:
<p>Onsite in the Speaker Ready Room and conference session rooms:</p>
<ul>
<li>Most files will automatically be opened full screen.</li>
<li>PowerPoint or KeyNote will attempt to display in presenter view.</li>
@@ -292,7 +298,7 @@ async function handle_open_file() {
<span class="fas fa-paper-plane" class:hidden="{hide_launch_icon}"></span> {ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
</a> -->
<button
on:click={() => {
onclick={() => {
$events_sess.launcher.modal__open = event_file_obj.event_file_id_random;
if (!modal_title) {
modal_title = event_file_obj.filename;
@@ -367,7 +373,7 @@ async function handle_open_file() {
href="/event/file/{event_file_obj.event_file_id_random}/download?use_os=true"
download
class="ae_btn btn_info {btn_size}"
on:click|preventDefault={() => {handle_open_file();}}
onclick={preventDefault(() => {handle_open_file();})}
data-hash_sha256={event_file_obj.hash_sha256}
data-filename={event_file_obj.filename}
title={`${event_file_obj.filename} [A] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`}
@@ -393,7 +399,7 @@ async function handle_open_file() {
<!-- Last [WORKING!] - Handle opening a file. This applies to all Launcher app modes (default, onsite, native) -->
{:else}
<button
on:click={() => {
onclick={() => {
let new_filename = event_file_obj.filename;
if ($events_loc.launcher.app_mode == 'onsite' && (event_file_obj.extension == 'ppt' || event_file_obj.extension == 'pptx') && event_file_obj.open_in_os == 'win') {
@@ -466,18 +472,6 @@ async function handle_open_file() {
{event_file_obj.file_purpose}
</span>
</button>
<!-- <a
href="/event/file/{event_file_obj.event_file_id_random}/download"
download
class="ae_btn btn_info {btn_size}"
on:click={() => {handle_open_file();}}
data-hash_sha256={event_file_obj.hash_sha256}
data-filename={event_file_obj.filename}
title={event_file_obj.filename}
>
<span class="fas fa-paper-plane" class:hidden="{hide_launch_icon}"></span> {ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
</a> -->
{/if}
</span>
@@ -489,7 +483,7 @@ async function handle_open_file() {
>
<button
on:click={() => {
onclick={() => {
// let new_filename = event_file_obj.filename;
// if ($events_loc.launcher.app_mode == 'onsite' && (event_file_obj.extension == 'ppt' || event_file_obj.extension == 'pptx') && event_file_obj.open_in_os == 'win') {
@@ -548,7 +542,7 @@ async function handle_open_file() {
>
<!-- {(event_file_obj?.open_in_os ? 'Hidden' : 'Not Hidden')} -->
<button
on:click={() => {
onclick={() => {
// Go from null to win, win to mac, mac to null, null to win, etc.
if (!event_file_obj?.open_in_os) {
ae_tmp.value__open_in_os = 'win';
@@ -564,7 +558,7 @@ async function handle_open_file() {
// $events_slct.exhibit_tracking_obj.open_in_os = !event_file_obj?.open_in_os;
ae_triggers.open_in_os = true;
}}
class="btn btn-sm transition-all hover:transition-all *:hover:inline"
class="btn btn-sm transition-all group"
class:preset-tonal-success={event_file_obj?.open_in_os=='win'}
class:preset-tonal-warning={event_file_obj?.open_in_os=='mac'}
disabled={!$ae_loc.trusted_access}
@@ -572,18 +566,20 @@ async function handle_open_file() {
>
{#if event_file_obj?.open_in_os == 'win'}
<span class="fab fa-windows m-1"></span>
<span class="hidden group-hover:inline-block">
Windows
</span>
{:else if event_file_obj?.open_in_os == 'mac'}
<!-- <span class="fas fa-toggle-off m-1"></span> -->
<span class="fab fa-apple m-1"></span>
<span class="hidden">
<span class="hidden group-hover:inline-block">
macOS
</span>
{:else}
<span class="fas fa-folder-open m-1"></span>
<!-- <span class="hidden">
<span class="hidden group-hover:inline-block">
Default
</span> -->
</span>
{/if}
<!-- {@html (event_file_obj?.hide ? '<span class="fas fa-eye m-1"></span> Unhide?' : '<span class="fas fa-eye-slash m-1"></span> Hide?')} -->
</button>

View File

@@ -76,11 +76,12 @@ let ae_promises: key_val = $state({
</script>
<section
<div
class="
flex flex-col gap-1 items-center justify-center
text-center
w-full max-w-full
event_launcher_menu
shrink h-full w-full max-w-full
flex flex-col flex-wrap gap-1 items-center justify-start
overflow-x-clip
"
>
@@ -88,7 +89,7 @@ let ae_promises: key_val = $state({
{#if $lq__event_event_file_obj_li}
<div class="w-full text-center">
<div class="w-full">
<!-- <div class="text-xs text-neutral-800/80">
<strong>
Event Files:
@@ -128,143 +129,149 @@ let ae_promises: key_val = $state({
{#if $ae_loc.edit_mode}
{#if $lq__event_location_obj_li && $lq__event_location_obj_li.length > 0}
<div class="text-xs text-neutral-800/80"><strong>
Locations:
{#if $ae_loc.administrator_access}
({$lq__event_location_obj_li?.length}&times;)
<div
class="
w-full max-w-full
flex flex-row gap-1 items-center justify-center
"
>
{#if $lq__event_location_obj_li && $lq__event_location_obj_li.length > 0}
<div class="text-xs text-neutral-800/80"><strong>
Location:
{#if $ae_loc.administrator_access}
({$lq__event_location_obj_li?.length}&times;)
{/if}
<!-- This should fade out once the data is loaded. -->
{#await ae_promises[slct_event_location_id]}
<span class="fas fa-spinner fa-spin text-blue-500"></span>
{:then result}
<span class="fas fa-check text-green-500/80"></span>
{/await}
</strong></div>
<select
class="select text-xs p-1 w-42"
bind:value={slct_event_location_id}
onchange={async () => {
// console.log(`slct_event_location_id:`, slct_event_location_id);
console.log('Remove fields from the URL.');
// data_url.searchParams.delete('location_id');
data_url.searchParams.delete('presentation_id');
data_url.searchParams.delete('presenter_id');
data_url.searchParams.delete('session_id');
// let url_location_id = slct_event_location_id;
// data_url.searchParams.set('location_id', url_location_id);
let new_url = `/events/${$events_slct.event_id}/launcher`;
if (slct_event_location_id) {
$events_loc.launcher.slct.event_location_id = slct_event_location_id;
$events_slct.event_location_id = slct_event_location_id;
$events_slct.id_li__event_session = [];
ae_promises[slct_event_location_id] = events_func.load_ae_obj_li__event_session({
api_cfg: $ae_api,
for_obj_type: 'event_location',
for_obj_id: $events_slct.event_location_id,
inc_file_li: true,
inc_presentation_li: true,
inc_presenter_li: true,
enabled: $events_loc.launcher.show_content__enabled_sessions ? 'all' : 'enabled',
hidden: $events_loc.launcher.show_content__hidden_sessions ? 'all' : 'not_hidden',
limit: 49,
try_cache: true,
log_lvl: 1,
})
.then(async function (load_results) {
console.log(`load_results = `, load_results);
let event_session_id_li = [];
let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
for (let i = 0; i < load_results.length; i++) {
let event_session_obj = load_results[i];
let event_session_id_random = event_session_obj.event_session_id_random;
tmp_li.push(event_session_id_random);
}
event_session_id_li = tmp_li;
console.log(`event_session_id_li:`, event_session_id_li);
$events_slct.id_li__event_session = event_session_id_li;
return load_results;
});
new_url = `/events/${$events_slct.event_id}/launcher/${$events_slct.event_location_id}`;
} else {
// This will hide the selected session if the location is changed to false.
// WARNING: This may need to be commented out later.
// slct_event_session_id = null;
$events_loc.launcher.slct.event_location_id = null;
$events_slct.event_location_id = null;
$events_loc.launcher.slct.event_session_id = null;
$events_slct.event_session_id = null;
// WARNING: This may need to be commented out later.
}
goto(new_url, {replaceState: true});
// goto(new_url, {replaceState: false});
}}
>
<option value="">Select a location</option>
{#each $lq__event_location_obj_li as event_location_obj}
<option
value={event_location_obj?.id}
>
{event_location_obj?.name}
</option>
{/each}
</select>
{:else}
<div class="text-sm">
No locations found.
(Event ID: {$lq__event_obj?.id})
</div>
{/if}
<!-- This should fade out once the data is loaded. -->
{#await ae_promises[slct_event_location_id]}
<span class="fas fa-spinner fa-spin text-blue-500"></span>
{:then result}
<span class="fas fa-check text-green-500/80"></span>
{/await}
</strong></div>
<select
class="select text-xs p-1"
bind:value={slct_event_location_id}
onchange={async () => {
// console.log(`slct_event_location_id:`, slct_event_location_id);
console.log('Remove fields from the URL.');
// data_url.searchParams.delete('location_id');
data_url.searchParams.delete('presentation_id');
data_url.searchParams.delete('presenter_id');
data_url.searchParams.delete('session_id');
// let url_location_id = slct_event_location_id;
// data_url.searchParams.set('location_id', url_location_id);
let new_url = `/events/${$events_slct.event_id}/launcher`;
if (slct_event_location_id) {
$events_loc.launcher.slct.event_location_id = slct_event_location_id;
$events_slct.event_location_id = slct_event_location_id;
$events_slct.id_li__event_session = [];
ae_promises[slct_event_location_id] = events_func.load_ae_obj_li__event_session({
api_cfg: $ae_api,
for_obj_type: 'event_location',
for_obj_id: $events_slct.event_location_id,
inc_file_li: true,
inc_presentation_li: true,
inc_presenter_li: true,
enabled: $events_loc.launcher.show_content__enabled_sessions ? 'all' : 'enabled',
hidden: $events_loc.launcher.show_content__hidden_sessions ? 'all' : 'not_hidden',
limit: 49,
try_cache: true,
log_lvl: 1,
})
.then(async function (load_results) {
console.log(`load_results = `, load_results);
let event_session_id_li = [];
let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
for (let i = 0; i < load_results.length; i++) {
let event_session_obj = load_results[i];
let event_session_id_random = event_session_obj.event_session_id_random;
tmp_li.push(event_session_id_random);
}
event_session_id_li = tmp_li;
console.log(`event_session_id_li:`, event_session_id_li);
$events_slct.id_li__event_session = event_session_id_li;
return load_results;
});
new_url = `/events/${$events_slct.event_id}/launcher/${$events_slct.event_location_id}`;
} else {
// This will hide the selected session if the location is changed to false.
// WARNING: This may need to be commented out later.
// slct_event_session_id = null;
$events_loc.launcher.slct.event_location_id = null;
$events_slct.event_location_id = null;
$events_loc.launcher.slct.event_session_id = null;
$events_slct.event_session_id = null;
// WARNING: This may need to be commented out later.
}
goto(new_url, {replaceState: true});
// goto(new_url, {replaceState: false});
}}
>
<option value="">Select a location</option>
{#each $lq__event_location_obj_li as event_location_obj}
<option
value={event_location_obj?.id}
>
{event_location_obj?.name}
</option>
{/each}
</select>
{:else}
<div class="text-sm">
No locations found.
(Event ID: {$lq__event_obj?.id})
</div>
{/if}
{/if}
{#if $lq__location_event_file_obj_li}
<div class="w-full text-center">
{#each $lq__location_event_file_obj_li as event_file_obj, index}
<button
disabled={!$ae_loc.trusted_access}
onclick={() => {
// ae_promises[event_file_obj.event_file_id_random]
ae_promises[event_file_obj?.event_file_id_random] = api.download_hosted_file({
api_cfg: $ae_api,
hosted_file_id: event_file_obj?.hosted_file_id_random,
return_file: true,
filename: event_file_obj?.filename,
auto_download: true,
log_lvl: 0
});
}}
class="
btn btn-sm
text-xs w-full
preset-tonal-primary
hover:preset-tonal-success
transition-all
"
>
<span class="fas fa-file-archive m-1 text-neutral-800/80"></span>
{event_file_obj?.filename}
</button>
{/each}
<div class="w-full">
{#each $lq__location_event_file_obj_li as event_file_obj, index}
<button
disabled={!$ae_loc.trusted_access}
onclick={() => {
// ae_promises[event_file_obj.event_file_id_random]
ae_promises[event_file_obj?.event_file_id_random] = api.download_hosted_file({
api_cfg: $ae_api,
hosted_file_id: event_file_obj?.hosted_file_id_random,
return_file: true,
filename: event_file_obj?.filename,
auto_download: true,
log_lvl: 0
});
}}
class="
btn btn-sm
text-xs w-full
preset-tonal-primary
hover:preset-tonal-success
transition-all
"
>
<span class="fas fa-file-archive m-1 text-neutral-800/80"></span>
{event_file_obj?.filename}
</button>
{/each}
</div>
{/if}
</section>
<section class="text-center w-full max-w-full">
<!-- <div class="w-full"> -->
{#if $lq__event_session_obj_li}
<Menu_session_list_menu
@@ -273,10 +280,15 @@ let ae_promises: key_val = $state({
/>
{/if}
</section>
<!-- </div> -->
{#if $ae_loc.edit_mode}
<section class="flex flex-row gap-2 items-center justify-center w-full max-w-full">
<div
class="
w-full max-w-full
flex flex-row gap-1 items-center justify-center
"
>
<button
onclick={() => {
$events_loc.launcher.show_content__hidden_files = !$events_loc.launcher.show_content__hidden_files;
@@ -320,5 +332,8 @@ let ae_promises: key_val = $state({
All Sessions
{/if}
</button>
</section>
{/if}
</div>
{/if}
</div>

View File

@@ -144,9 +144,14 @@ ae_promises[$events_slct.event_session_id] = events_func.load_ae_obj_li__event_p
</script>
<!-- {$events_slct.event_session_id} -->
<section class="event_launcher_session_view grow w-full space-y-2">
<div
class="
event_launcher_session_view
grow h-full w-full
space-y-1
"
>
<!-- <slot name="event_session_message">event session message</slot> -->
{#if $lq__event_session_obj && $lq__event_session_obj.event_session_id_random}
@@ -377,30 +382,8 @@ ae_promises[$events_slct.event_session_id] = events_func.load_ae_obj_li__event_p
<span class="fas fa-spinner fa-spin"></span>
No session selected
{/if}
</section>
<!-- {#if show_modal_upload_files}
<Element_modal_v3
show = { true }
modal_cover_body = { true }
on:close={ () => {show_modal_upload_files=false;} }
>
<span slot="header_title">Upload New File(s)</span>
<span slot="body">
<Event_file_upload_form
link_to_type={link_to_type}
link_to_id={link_to_id}
display_minimal={true}
on:event_file_obj_li_updated={handle_event_file_obj_li_updated}
/>
</span>
</Element_modal_v3>
{/if} -->
</div>
<style>

View File

@@ -48,9 +48,14 @@ let hover_timer: any = $state(null);
</span> -->
<div
class="
w-full max-w-full
flex flex-col flex-wrap items-center justify-start
"
>
{#if $lq__event_session_obj_li && $lq__event_session_obj_li.length > 0}
<div class="text-xs text-neutral-800/80 w-full max-w-full"><strong>
<div class="text-xs text-neutral-800/80"><strong>
Sessions:
{#if $ae_loc.administrator_access}
({$lq__event_session_obj_li?.length}&times;)
@@ -63,7 +68,7 @@ let hover_timer: any = $state(null);
{/await}
</strong></div>
<ul
class="space-y-1 w-full max-w-full"
class="space-y-1"
>
{#each $lq__event_session_obj_li as event_session_obj}
<li>
@@ -180,7 +185,8 @@ let hover_timer: any = $state(null);
{/each}
</ul>
{:else}
<p class="text-sm">
<div class="text-sm">
No sessions found.
</p>
</div>
{/if}
</div>

View File

@@ -179,6 +179,17 @@ let ae_promises: key_val = $state({});
</a> -->
{/if}
{:else}
<span
class="text-sm text-gray-500 italic"
title="No file linked."
>
<span class="fas fa-exclamation-triangle text-warning"></span>
No file linked.
<span class="fas fa-exclamation-triangle text-warning"></span>
</span>
{/if}
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
<button
type="button"
@@ -196,16 +207,6 @@ let ae_promises: key_val = $state({});
<span class="fas fa-edit m-1"></span> Edit Content
</button>
{/if}
{:else}
<span
class="text-sm text-gray-500 italic"
title="No file linked."
>
<span class="fas fa-exclamation-triangle text-warning"></span>
No file linked.
<span class="fas fa-exclamation-triangle text-warning"></span>
</span>
{/if}
</div>
<section class="ae_section archive_content__content">