From f3eda31c48db2ec993c14042e7d39d503b68709c Mon Sep 17 00:00:00 2001 From: Silas Date: Sun, 9 Apr 2023 18:22:05 -0400 Subject: [PATCH] show loading screen --- src/routes/+page.svelte | 83 ++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 1dcbf80..a6ff450 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -6,9 +6,9 @@ let files: FileList | null; let url: string = ''; - let urlInput: HTMLInputElement; let fileForm: HTMLFormElement; let hasFile = true; + let loading = false; $: if (files && files.length >= 0) { hasFile = true; @@ -44,6 +44,7 @@ const summarize = async () => { try { + loading = true; let result; if (hasFile) { if (!files) throw new Error('File missing'); @@ -53,6 +54,7 @@ result = await submitUrl(url); } summary.set(JSON.stringify(result.response)); + loading = false; return goto('chat'); } catch (error) { alert((error as App.Error).message); @@ -63,43 +65,46 @@
-

Please Sumi

-

Enter the URL you'd like to have summarized.

-
- -
-

-
-

Or you can submit a text file instead:

-
-
- - {#if hasFile} - - {/if} -
-
-
-
- -
+ {#if loading} +

Please wait while Sumi tries to make sense of this garbage.

+ {:else} +

Please Sumi

+

Enter the URL you'd like to have summarized.

+
+ +
+

+
+

Or you can submit a text file instead:

+
+
+ + {#if hasFile} + + {/if} +
+
+
+
+ +
+ {/if}