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
+39 -10

No files matched your search

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