A lot of cosmetic clean up and some code clean up. Also new util functions from old Svelte NPM library.

This commit is contained in:
Scott Idem
2024-06-19 14:01:15 -04:00
parent 5ef2d05e9c
commit 06add80718
6 changed files with 329 additions and 76 deletions

View File

@@ -10,7 +10,7 @@ import { liveQuery } from "dexie";
const dispatch = createEventDispatcher();
import type { key_val } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils';
import { ae_util, shorten_string } from '$lib/ae_utils';
import { api } from '$lib/api';
import Element_data_store from '$lib/element_data_store.svelte';
import Element_ae_crud from '$lib/element_ae_crud.svelte';
@@ -435,7 +435,6 @@ WARNING: The file upload and management is a work in progress. You can upload an
>{file_obj.filename}</a> -->
<button
class="btn btn-md variant-soft-primary min-w-96"
on:click={() => {
// ae_promises[event_file_obj.event_file_id_random]
ae_promises[event_file_obj.event_file_id_random] = api.download_hosted_file({
@@ -449,15 +448,13 @@ WARNING: The file upload and management is a work in progress. You can upload an
// 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-md variant-ghost-primary hover:variant-filled-primary min-w-96"
title={`Download this file: ${event_file_obj.filename} [API] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`}
>
{#await ae_promises[event_file_obj.event_file_id_random]}
<span class="mx-1">
<span class="fas fa-spinner fa-spin mx-1"></span>
<span class="fas fa-spinner fa-spin mx-1"></span>
<span class="">
Downloading
{#if $ae_sess.download[`/hosted_file/${event_file_obj.hosted_file_id_random}/download`]}
{$ae_sess.download[`/hosted_file/${event_file_obj.hosted_file_id_random}/download`].percent_completed}%
{/if}
@@ -465,10 +462,14 @@ WARNING: The file upload and management is a work in progress. You can upload an
</span>
{:then}
<span class="fas fa-download mx-1"></span>
<span class="text-sm">
Download:
</span>
{/await}
{event_file_obj.filename.slice(0, 20)}...{event_file_obj.extension}
<span class="grow">
{ae_util.shorten_filename({filename: event_file_obj.filename, max_length: 25})}
</span>
</button>
<button type="button"