More work on the Launcher and related
This commit is contained in:
@@ -51,7 +51,7 @@ let {
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
// import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { api } from '$lib/api';
|
||||
// import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||
@@ -104,8 +104,6 @@ let ae_promises: key_val = $state({
|
||||
"
|
||||
>
|
||||
|
||||
<!-- <h2 class="text-sm font-semibold">{$lq__event_obj?.cfg_json.short_name ?? 'loading...'}</h2> -->
|
||||
|
||||
|
||||
{#if $lq__event_event_file_obj_li}
|
||||
<div class="w-full">
|
||||
@@ -138,9 +136,32 @@ let ae_promises: key_val = $state({
|
||||
hover:preset-tonal-success
|
||||
transition-all
|
||||
"
|
||||
title={`Download this file:\n${event_file_obj.filename}\n[API] SHA256: ${event_file_obj.hash_sha256.slice(0, 10)}... Hosted ID: ${event_file_obj.hosted_file_id_random} Event File ID: ${event_file_obj.event_file_id_random}`}
|
||||
>
|
||||
<span class="fas fa-file-archive m-1 text-neutral-800/80"></span>
|
||||
{event_file_obj?.filename}
|
||||
{#await ae_promises[event_file_obj.event_file_id_random]}
|
||||
<span class="fas fa-spinner fa-spin mx-1"></span>
|
||||
<span class="">
|
||||
Downloading
|
||||
{#if $ae_sess.api_download_kv[event_file_obj.hosted_file_id_random]}
|
||||
{$ae_sess.api_download_kv[event_file_obj.hosted_file_id_random].percent_completed}%
|
||||
{/if}
|
||||
:
|
||||
</span>
|
||||
{:then}
|
||||
<!-- <span class="fas fa-download mx-1"></span> -->
|
||||
<span class="fas fa-{ae_util.file_extension_icon(event_file_obj.extension)}"></span>
|
||||
<!-- <span class="text-sm">
|
||||
Download:
|
||||
</span> -->
|
||||
{/await}
|
||||
|
||||
<span class="grow">
|
||||
{ae_util.shorten_filename({filename: event_file_obj.filename, max_length: 30})}
|
||||
</span>
|
||||
|
||||
|
||||
<!-- <span class="fas fa-file-archive m-1 text-neutral-800/80"></span>
|
||||
{event_file_obj?.filename} -->
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -156,113 +177,6 @@ let ae_promises: key_val = $state({
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- <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}×)
|
||||
{/if}
|
||||
{#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}
|
||||
</div>
|
||||
{/if} -->
|
||||
|
||||
|
||||
|
||||
{#if $lq__location_event_file_obj_li}
|
||||
<div class="w-full">
|
||||
@@ -287,6 +201,7 @@ let ae_promises: key_val = $state({
|
||||
hover:preset-tonal-success
|
||||
transition-all
|
||||
"
|
||||
title={`Download this file:\n${event_file_obj.filename}\n[API] SHA256: ${event_file_obj.hash_sha256.slice(0, 10)}... Hosted ID: ${event_file_obj.hosted_file_id_random} Event File ID: ${event_file_obj.event_file_id_random}`}
|
||||
>
|
||||
<span class="fas fa-file-archive m-1 text-neutral-800/80"></span>
|
||||
{event_file_obj?.filename}
|
||||
@@ -296,18 +211,15 @@ let ae_promises: key_val = $state({
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<!-- <div class="w-full"> -->
|
||||
|
||||
{#if $lq__event_session_obj_li}
|
||||
<Menu_session_list_menu
|
||||
data_url={data_url}
|
||||
bind:loading__session_id_status={loading__session_id_status}
|
||||
lq__event_session_obj_li={lq__event_session_obj_li}
|
||||
slct_event_session_id={$events_slct.event_session_id}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- </div> -->
|
||||
|
||||
{#if $ae_loc.edit_mode}
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user