fix: dont auto close

This commit is contained in:
Xylight committed 2024-09-07 11:58:03 -07:00
1 parent 87649204ba
commit 22335e92c1
8 files changed
+1052 -1177

No files matched your search

@@ -7,6 +7,7 @@
import type {
Community,
CommunityAggregates,
CommunityModeratorView,
SubscribedType,
} from 'lemmy-js-client'
import { Button, toast } from 'mono-svelte'
@@ -18,16 +19,23 @@
Plus,
} from 'svelte-hero-icons'
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import { userSettings } from '$lib/settings'
import ShieldIcon from '../moderation/ShieldIcon.svelte'
import ItemList from '../generic/ItemList.svelte'
import { userLink } from '$lib/lemmy/generic'
export let community: Community
export let subscribed: SubscribedType
export let counts: CommunityAggregates | undefined = undefined
export let moderators: CommunityModeratorView[] = []
</script>
<EntityHeader
banner={community.banner}
avatar={community.icon}
name={community.title}
url="/c/{fullCommunityName(community.name, community.actor_id)}"
stats={counts
? [
{
@@ -58,6 +66,26 @@
>
!{fullCommunityName(community.name, community.actor_id)}
</button>
{#if moderators.length > 0}
<Expandable
bind:open={$userSettings.expand.team}
class="py-2 border-y border-slate-200 dark:border-zinc-800"
>
<svelte:fragment slot="title">
<ShieldIcon width={15} filled />
{$t('cards.community.moderators')}
</svelte:fragment>
<ItemList
items={moderators.map((m) => ({
id: m.moderator.id,
name: m.moderator.name,
url: userLink(m.moderator),
avatar: m.moderator.avatar,
instance: new URL(m.moderator.actor_id).hostname,
}))}
/>
</Expandable>
{/if}
<div class="flex items-center gap-2 h-max">
{#if $profile?.jwt}
<Subscribe
@@ -96,15 +124,6 @@
</Subscribe>
{/if}
<!-- <Button
size="lg"
color="secondary"
class="flex-1"
on:click={() => (sidebar = !sidebar)}
>
<Icon src={InformationCircle} size="16" micro />
{$t('cards.site.about')}
</Button> -->
{#if $profile?.user && $profile.user.moderates
.map((c) => c.community.id)
.includes(community.id)}
+11 -7
View File
@@ -100,6 +100,10 @@
title = result.title
}
}
let popoverOpen = false
$: console.log(popoverOpen)
</script>
<!--
@@ -113,8 +117,9 @@
style={$$props.style ?? ''}
>
{#if showCommunity && community && subscribed}
<Popover>
<div
<Popover bind:open={popoverOpen} manual>
<button
on:click={() => (popoverOpen = !popoverOpen)}
class="relative cursor-pointer pr-2 row-span-2 flex-shrink-0 group/community"
slot="target"
>
@@ -122,19 +127,18 @@
url={community.icon}
width={32}
alt={community.name}
class="group-hover/community:ring-1 transition-all ring-offset-1 ring-primary-900 dark:ring-primary-100"
class="group-hover/community:ring-2 transition-all ring-offset-1 ring-primary-900 dark:ring-primary-100"
/>
</div>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
</button>
<div
slot="popover"
class="max-w-md rounded-2xl bg-white dark:bg-zinc-950"
on:click|stopPropagation={() => {}}
>
<CommunityHeader bind:community bind:subscribed />
</div>
</Popover>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
{/if}
{#if showCommunity && community}
<CommunityLink
+9 -2
View File
@@ -9,6 +9,7 @@
export let name: string
export let bio: string | undefined = undefined
export let banner: string | undefined = undefined
export let url: string | undefined = undefined
export let stats: {
name: string
value: string
@@ -51,9 +52,15 @@
class="ring-4 ring-slate-25 dark:ring-zinc-925 bg-slate-25 dark:bg-zinc-925"
/>
<div>
<span class="text-lg font-medium">
<svelte:element
this={url ? 'a' : 'span'}
href={url}
class="text-lg font-medium {url
? 'hover:underline hover:text-primary-900 hover:dark:text-primary-100'
: ''}"
>
{name}
</span>
</svelte:element>
<span
class="flex items-center gap-0 text-sm text-slate-600 dark:text-zinc-400"
>
+1 -1
View File
@@ -11,7 +11,7 @@
<div
slot="summary"
class="font-medium w-full text-left flex flex-row items-center justify-between hover:text-primary-900
hover:dark:text-primary-100 transition-colors"
hover:dark:text-primary-100 transition-colors h-full"
>
<div class="flex flex-row gap-1 items-center w-full">
<slot name="title" />