From 30d02c638c8a51449da21c09c830245232e6c0c1 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Fri, 11 Apr 2025 15:34:21 -0700 Subject: [PATCH] refac: banners --- src/lib/components/chat/Chat.svelte | 50 +---- src/lib/components/chat/Navbar.svelte | 281 +++++++++++++++----------- 2 files changed, 169 insertions(+), 162 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index cbd6a72c4..4f40c6b13 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1957,61 +1957,13 @@ timestamp: Date.now() } }} + {history} title={$chatTitle} bind:selectedModels shareEnabled={!!history.currentId} {initNewChat} /> - {#if !history.currentId && !$chatId && selectedModels.length <= 1 && ($banners.length > 0 || ($config?.license_metadata?.type ?? null) === 'trial' || (($config?.license_metadata?.seats ?? null) !== null && $config?.user_count > $config?.license_metadata?.seats))} -
-
- {#if ($config?.license_metadata?.type ?? null) === 'trial'} - - {/if} - - {#if ($config?.license_metadata?.seats ?? null) !== null && $config?.user_count > $config?.license_metadata?.seats} - - {/if} - - {#each $banners.filter( (b) => (b.dismissible ? !JSON.parse(localStorage.getItem('dismissedBannerIds') ?? '[]').includes(b.id) : true) ) as banner} - { - const bannerId = e.detail; - - localStorage.setItem( - 'dismissedBannerIds', - JSON.stringify( - [ - bannerId, - ...JSON.parse(localStorage.getItem('dismissedBannerIds') ?? '[]') - ].filter((id) => $banners.find((b) => b.id === id)) - ) - ); - }} - /> - {/each} -
-
- {/if} -
{#if $settings?.landingPageMode === 'chat' || createMessagesList(history, history.currentId).length > 0}
-
+ + {#if !history.currentId && !$chatId && ($banners.length > 0 || ($config?.license_metadata?.type ?? null) === 'trial' || (($config?.license_metadata?.seats ?? null) !== null && $config?.user_count > $config?.license_metadata?.seats))} +
+
+ {#if ($config?.license_metadata?.type ?? null) === 'trial'} + + {/if} + + {#if ($config?.license_metadata?.seats ?? null) !== null && $config?.user_count > $config?.license_metadata?.seats} + + {/if} + + {#each $banners.filter( (b) => (b.dismissible ? !JSON.parse(localStorage.getItem('dismissedBannerIds') ?? '[]').includes(b.id) : true) ) as banner} + { + const bannerId = e.detail; + + localStorage.setItem( + 'dismissedBannerIds', + JSON.stringify( + [ + bannerId, + ...JSON.parse(localStorage.getItem('dismissedBannerIds') ?? '[]') + ].filter((id) => $banners.find((b) => b.id === id)) + ) + ); + }} + /> + {/each} +
+
+ {/if}