From dc55a0cc26546c980fd580ea02876066b07c0c4f Mon Sep 17 00:00:00 2001 From: Chukwuma Nwaugha Date: Tue, 26 Nov 2024 10:23:50 +0000 Subject: [PATCH] use consistent page dimensions and reusable components --- .../lib/components/AudiocastPageHeader.svelte | 14 +++++++------- .../AudiocastPageSkeletonLoader.svelte | 3 +-- .../[sessionId=sessionId]/+page.svelte | 19 ++++++++++++------- .../chat/[sessionId=sessionId]/+page.svelte | 14 ++++---------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/app/src/lib/components/AudiocastPageHeader.svelte b/app/src/lib/components/AudiocastPageHeader.svelte index 80a4348..95a6e95 100644 --- a/app/src/lib/components/AudiocastPageHeader.svelte +++ b/app/src/lib/components/AudiocastPageHeader.svelte @@ -1,16 +1,16 @@ -
+
- {session.category} + {category} - {#if session.metadata?.title} -

{session.metadata.title}

- {/if} +

{title}

diff --git a/app/src/lib/components/AudiocastPageSkeletonLoader.svelte b/app/src/lib/components/AudiocastPageSkeletonLoader.svelte index 797466f..d33ed2e 100644 --- a/app/src/lib/components/AudiocastPageSkeletonLoader.svelte +++ b/app/src/lib/components/AudiocastPageSkeletonLoader.svelte @@ -1,5 +1,4 @@ -
- +
diff --git a/app/src/routes/audiocast/[sessionId=sessionId]/+page.svelte b/app/src/routes/audiocast/[sessionId=sessionId]/+page.svelte index b9b5160..396eaeb 100644 --- a/app/src/routes/audiocast/[sessionId=sessionId]/+page.svelte +++ b/app/src/routes/audiocast/[sessionId=sessionId]/+page.svelte @@ -25,7 +25,7 @@ import AudiocastPageSkeletonLoader from '@/components/AudiocastPageSkeletonLoader.svelte'; import RenderAudioSources from '@/components/RenderAudioSources.svelte'; import AudiocastPageHeader from '@/components/AudiocastPageHeader.svelte'; - import { startWith, tap } from 'rxjs'; + import { startWith, tap, switchMap, of } from 'rxjs'; export let data; @@ -38,6 +38,7 @@ $: sessionModel = data.sessionModel; $: sessionModel$.pipe( + switchMap((v) => of(v)), tap((v) => v && (sessionModel = v)), startWith(data.sessionModel) ); @@ -63,7 +64,7 @@ return fetch(`${env.API_BASE_URL}/audiocast/${sessionId}`).then((res) => { if (res.ok) return res.json(); else if (res.status === 404 && $session$?.summary) { - return generateAudiocast(sessionId, $session$.category, $session$.summary); + return generateAudiocast(sessionId, sessionModel.category, $session$.summary); } throw new Error('Failed to get audiocast'); @@ -71,11 +72,13 @@ } -
- +
+ {#await getAudiocast(sessionId)} -
+
{#if generating} @@ -93,7 +96,7 @@ {/if}
{:then} -
+