From 1285c2a9ced7f18dc80f99536b974618c3ec97ac Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sat, 3 Dec 2022 16:59:33 +0100 Subject: [PATCH] feat: file upload status improvements --- .../dashboard/DashboardUploadCard.svelte | 19 ++++++--- .../lib/components/dashboard/FileType.svelte | 4 +- .../dashboard/StatusNotificationBig.svelte | 42 +++++++++++++++++++ ...on.svelte => StatusNotificationDot.svelte} | 12 +++--- .../lib/components/layout/FullLayout.svelte | 11 +++-- .../(authenticated)/dashboard/+page.svelte | 2 +- 6 files changed, 71 insertions(+), 19 deletions(-) create mode 100644 frontend/src/lib/components/dashboard/StatusNotificationBig.svelte rename frontend/src/lib/components/dashboard/{StatusNotification.svelte => StatusNotificationDot.svelte} (68%) diff --git a/frontend/src/lib/components/dashboard/DashboardUploadCard.svelte b/frontend/src/lib/components/dashboard/DashboardUploadCard.svelte index 76ae502..4438317 100644 --- a/frontend/src/lib/components/dashboard/DashboardUploadCard.svelte +++ b/frontend/src/lib/components/dashboard/DashboardUploadCard.svelte @@ -3,9 +3,9 @@ import FileDrop from 'filedrop-svelte'; import { submissionProgress, UploadStatus, type Status } from '$lib/stores/portfolio'; import { createEventDispatcher } from 'svelte'; - import StatusNotification from './StatusNotification.svelte'; import ProgressBar from './ProgressBar.svelte'; import type { AxiosProgressEvent } from 'axios'; + import StatusNotificationDot from './StatusNotificationDot.svelte'; const dispatch = createEventDispatcher(); @@ -22,7 +22,8 @@ $: if ($submissionProgress) { status = getStatus(); - console.log('type' + fileType + ' status: ' + status); + // console.log('type' + fileType + ' status: ' + status); + fileDropped = status === 'uploaded' || status === 'submitted'; } const getStatus = (): Status => { @@ -86,22 +87,28 @@

{title}

-
+
+ +
{#if fileDropped}
-

Nahráno {((bytesTotal / 1_000_000) * progress).toFixed(1)} MB

-

z {(bytesTotal / 1_000_000).toFixed(1)} MB

+ {#if bytesTotal === 0} +

{status === 'submitted' ? "Odesláno" : "Nahráno"}

+ {:else} +

Nahráno {((bytesTotal / 1_000_000) * progress).toFixed(1)} MB

+

z {(bytesTotal / 1_000_000).toFixed(1)} MB

+ {/if}
-

{Math.round(progress * 100) + "%"}

+

{Math.round(progress * 100)} %

diff --git a/frontend/src/lib/components/dashboard/FileType.svelte b/frontend/src/lib/components/dashboard/FileType.svelte index 49d0cdf..2a1a01d 100644 --- a/frontend/src/lib/components/dashboard/FileType.svelte +++ b/frontend/src/lib/components/dashboard/FileType.svelte @@ -4,9 +4,9 @@
- {filetype} + {filetype} / - Max {filesize} + Max {filesize}
+ diff --git a/frontend/src/lib/components/dashboard/StatusNotification.svelte b/frontend/src/lib/components/dashboard/StatusNotificationDot.svelte similarity index 68% rename from frontend/src/lib/components/dashboard/StatusNotification.svelte rename to frontend/src/lib/components/dashboard/StatusNotificationDot.svelte index c99b615..436633b 100644 --- a/frontend/src/lib/components/dashboard/StatusNotification.svelte +++ b/frontend/src/lib/components/dashboard/StatusNotificationDot.svelte @@ -19,22 +19,22 @@ -
- -

{title}

+
+ +