Lots of work on the new Launcher. Also general reorganizing of files.

This commit is contained in:
Scott Idem
2024-09-24 16:55:23 -04:00
parent bd2583fde3
commit 476b303da4
23 changed files with 2221 additions and 684 deletions

View File

@@ -0,0 +1,114 @@
<script lang="ts">
import type { key_val } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils';
import { api } from '$lib/api';
import { liveQuery } from "dexie";
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { db_events } from "$lib/db_events";
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
import { events_func } from '$lib/ae_events_functions';
// export let slct_event_presentation_id: string;
// export let slct_event_presenter_id: string;
export let lq__event_presenter_obj: any;
let ae_promises: key_val = {
get_li__event_file: null,
};
// Event File
let lq__event_file_obj_li = liveQuery(
() => db_events.files
// .where('event_session_id_random')
.where('for_id_random')
.equals(lq__event_presenter_obj?.event_presenter_id)
.sortBy('name')
);
</script>
<strong>
<span class="fas fa-user"></span>
{#if lq__event_presenter_obj?.full_name }{lq__event_presenter_obj?.full_name}{:else }{lq__event_presenter_obj?.given_name}{/if }
</strong>
{#if !lq__event_presenter_obj?.file_count}
<p class="text-sm text-center text-gray-400">
<!-- <span class="fas fa-exclamation"></span> -->
No files to show for this presenter at this time.
<!-- <span class="fas fa-exclamation"></span> -->
</p>
{/if}
{#if $lq__event_file_obj_li && $lq__event_file_obj_li.length }
<section class="event_session_file_list">
<div>
<div class="text-xs"><strong>
<span class="fas fa-file-archive"></span>
Presenter Files:
{#if $ae_loc.administrator_access}
({$lq__event_file_obj_li?.length})
{/if}
</strong></div>
</div>
<ul class="space-y-1">
{#each $lq__event_file_obj_li as event_file_obj, index}
<li
class="flex flex-row justify-center gap-1"
class:hidden={!$events_loc.launcher.show_content__hidden_files && event_file_obj.hide}
>
<button
disabled={!$ae_loc.trusted_access}
on:click={() => {
// 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
});
// window.postMessage({ type: 'download_event_file', event_file_id: event_file_obj.event_file_id_random, filename: event_file_obj.filename, auto_download: true }, '*');
}}
class="btn btn-sm lg:btn-md variant-soft-primary hover:variant-filled-primary min-w-72 lg:min-w-96"
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}`}
>
{#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="badge variant-glass-success hover:variant-filled-success text-sm"
class:hidden={!event_file_obj.file_purpose}
>
{event_file_obj.file_purpose}
</span>
</button>
</li>
{/each}
</ul>
</section>
{/if}