misc: update community reuslts

This commit is contained in:
Xylight committed 2024-08-18 15:19:40 -07:00
1 parent 66edcdfd60
commit 0c02b510ee
2 files changed
+52 -23

No files matched your search

@@ -43,8 +43,8 @@
<div
class="flex
{view == 'cozy'
? 'flex-col gap-2'
: 'flex-row'} items-center max-w-full w-full"
? 'flex-col gap-2 items-center'
: 'flex-row'} max-w-full w-full"
>
<a
href="/c/{fullCommunityName(
@@ -65,16 +65,25 @@
alt={community.community.name}
/>
</slot>
<div class="flex flex-col">
<div class="font-medium text-base">
<div
class="flex flex-col overflow-hidden whitespace-nowrap flex-1 min-w-0 flex-shrink"
>
<div class="font-medium text-base overflow-hidden overflow-ellipsis">
{community.community.title}
</div>
<div class="text-sm text-slate-600 dark:text-zinc-400">
<span>{new URL(community.community.actor_id).hostname}</span>
{#if !showCounts}
•
<FormattedNumber number={community.counts.subscribers} />
{/if}
<div
class="text-sm text-slate-600 dark:text-zinc-400 flex gap-0.5"
class:justify-center={view == 'cozy'}
>
<span class="overflow-hidden overflow-ellipsis">
{new URL(community.community.actor_id).hostname}
</span>
<span class="overflow-hidden overflow-ellipsis">
{#if !showCounts}
•
<FormattedNumber number={community.counts.subscribers} />
{/if}
</span>
</div>
</div>
</div>
@@ -103,10 +112,15 @@
)
}
}}
size="custom"
title={isSubscribed(community.subscribed)
? $t('cards.community.subscribed')
: $t('cards.community.subscribe')}
color={isSubscribed(community.subscribed) ? 'elevatedLow' : 'primary'}
class={isSubscribed(community.subscribed)
class="{isSubscribed(community.subscribed)
? 'text-slate-600 dark:text-zinc-400'
: ''}
aspect-square h-8 @md:px-2 @md:min-w-32 @md:aspect-auto"
>
<Icon
src={isSubscribed(community.subscribed) ? Check : Plus}
@@ -114,11 +128,13 @@
micro
slot="prefix"
/>
{#if isSubscribed(community.subscribed)}
{$t('cards.community.subscribed')}
{:else}
{$t('cards.community.subscribe')}
{/if}
<span class="hidden @md:block">
{#if isSubscribed(community.subscribed)}
{$t('cards.community.subscribed')}
{:else}
{$t('cards.community.subscribe')}
{/if}
</span>
</Button>
</Subscribe>
</div>
+20 -7
View File
@@ -24,8 +24,13 @@
let search = data.query || ''
let instance = ''
let virtualList: HTMLDivElement
let offset: number = 0
</script>
<svelte:window bind:scrollY={offset} />
<svelte:head>
<title>{$t('routes.communities')}</title>
</svelte:head>
@@ -92,7 +97,9 @@
<Location selected={data.type} />
<Sort selected={data.sort} />
</div>
<ul class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 my-6">
<ul
class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 my-6 h-full"
>
{#if data.communities.length == 0}
<Placeholder
icon={QuestionMarkCircle}
@@ -131,13 +138,19 @@
{$t('routes.search.other')}
</SectionTitle>
{/if}
{#each data.communities.slice(data.query ?? '' != '' ? 3 : 0) as community}
<div
class="-mx-4 sm:-mx-6 px-6 hover:bg-slate-100 hover:dark:bg-zinc-800 transition-colors"
>
<CommunityItem {community} showCounts={false} class="py-3" />
{#if data.communities}
{@const sliced = data.communities.slice(data.query ?? '' != '' ? 3 : 0)}
<div class="-mx-4 sm:-mx-6 h-full" bind:this={virtualList}>
{#each sliced as community}
<div
class="px-6 hover:bg-slate-100 hover:dark:bg-zinc-900 transition-colors @container
border-b border-slate-100 dark:border-zinc-800"
>
<CommunityItem {community} showCounts={false} class="py-3" />
</div>
{/each}
</div>
{/each}
{/if}
</ul>
{#if data.communities.length > 0}
<div class="mt-2 w-full">