fix: fix the empty state for community themes

This commit is contained in:
AdenMGB committed 2026-09-29 15:31:37 +09:30
1 parent aaf03129a5
commit 9d8f0613cb
1 file changed
+63 -21
+63 -21
View File
@@ -31,29 +31,71 @@
const description = (theme.description ?? '').toLowerCase(); const description = (theme.description ?? '').toLowerCase();
return name.includes(q) || description.includes(q); return name.includes(q) || description.includes(q);
})); }));
const isCommunity = $derived(variant === 'community');
const hasSearchQuery = $derived(searchTerm.trim().length > 0);
function openCommunityThemeBuilder() {
void import('@/seqta/utils/launchPageThemeBuilder').then(({ launchPageThemeBuilder }) =>
launchPageThemeBuilder(),
);
}
</script> </script>
<div class="relative" > <div class="relative">
<div class="grid grid-cols-1 gap-4 py-6 mx-auto sm:grid-cols-2 lg:grid-cols-3"> {#if filteredThemes.length > 0}
{#each filteredThemes as theme (theme.id)} <div class="mx-auto grid grid-cols-1 gap-4 py-6 sm:grid-cols-2 lg:grid-cols-3">
<ThemeCard {#each filteredThemes as theme (theme.id)}
{theme} <ThemeCard
onClick={() => setDisplayTheme(theme)} {theme}
{toggleFavorite} onClick={() => setDisplayTheme(theme)}
{isLoggedIn} {toggleFavorite}
{onRequestSignIn} {isLoggedIn}
{allStoreThemeRows} {onRequestSignIn}
{installedThemeIds} {allStoreThemeRows}
{variant} {installedThemeIds}
/> {variant}
{/each} />
{/each}
</div> </div>
{#if filteredThemes.length === 0} {:else if isCommunity}
<div class="absolute top-0 flex flex-col items-center justify-center w-full text-center h-96"> <div class="mx-auto flex max-w-lg flex-col items-center justify-center py-24 text-center">
<h1 class="mt-4 text-3xl font-bold tracking-tight text-zinc-900 dark:text-zinc-100 sm:text-5xl">That doesn't exist! 😭😭😭</h1> {#if hasSearchQuery}
<p class="mt-6 text-lg leading-7 text-zinc-600 dark:text-zinc-300">Sorry, we couldn't find the theme you're looking for. Maybe... you could create it?</p> <h2 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance">
<a href="https://docs.betterseqta.org/theme-creation/" class='p-2 px-3 mt-4 transition rounded-md cursor-pointer dark:text-white bg-zinc-500/10 hover:scale-105'> No themes match your search
</h2>
<p class="mt-2 text-base text-zinc-500 dark:text-zinc-400" style="text-wrap: pretty">
Try another name or keyword, or clear the search box to browse all approved community themes.
</p>
{:else}
<h2 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance">
No community themes yet
</h2>
<p class="mt-2 text-base text-zinc-500 dark:text-zinc-400" style="text-wrap: pretty">
Approved themes from other users will appear here. Create your own and submit it for review to
share it with the community.
</p>
<button
type="button"
class="mt-6 rounded-lg bg-zinc-900 px-4 py-2.5 text-sm font-medium text-white transition-all duration-200 hover:bg-zinc-700 focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:ring-offset-2 active:scale-95 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white"
onclick={openCommunityThemeBuilder}
>
Create &amp; submit a theme
</button>
{/if}
</div>
{:else}
<div class="absolute top-0 flex h-96 w-full flex-col items-center justify-center text-center">
<h1 class="mt-4 text-3xl font-bold tracking-tight text-zinc-900 dark:text-zinc-100 sm:text-5xl">
That doesn't exist! 😭😭😭
</h1>
<p class="mt-6 text-lg leading-7 text-zinc-600 dark:text-zinc-300">
Sorry, we couldn't find the theme you're looking for. Maybe... you could create it?
</p>
<a
href="https://docs.betterseqta.org/theme-creation/"
class="mt-4 cursor-pointer rounded-md bg-zinc-500/10 p-2 px-3 transition hover:scale-105 dark:text-white"
>
Show me how! Show me how!
</a> </a>
</div> </div>