design: use entityheaders for instance and community cards
This commit is contained in:
8 files changed
+140
-101
No files matched your search
@@ -547,6 +547,9 @@
|
|||||||
"hide": "Hide",
|
"hide": "Hide",
|
||||||
"unhide": "Unhide",
|
"unhide": "Unhide",
|
||||||
"share": "Share",
|
"share": "Share",
|
||||||
|
"share.from": "Share from",
|
||||||
|
"share.global": "Origin server",
|
||||||
|
"share.local": "Your server",
|
||||||
"crosspost": "Crosspost",
|
"crosspost": "Crosspost",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"restore": "Restore"
|
"restore": "Restore"
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
import Markdown from '$lib/app/markdown/Markdown.svelte'
|
import Markdown from '$lib/app/markdown/Markdown.svelte'
|
||||||
import { settings } from '$lib/app/settings.svelte'
|
import { settings } from '$lib/app/settings.svelte'
|
||||||
import { fullCommunityName, userLink } from '$lib/app/util.svelte'
|
import { fullCommunityName, userLink } from '$lib/app/util.svelte'
|
||||||
import Avatar from '$lib/ui/generic/Avatar.svelte'
|
|
||||||
import Entity from '$lib/ui/generic/Entity.svelte'
|
|
||||||
import ItemList from '$lib/ui/generic/ItemList.svelte'
|
import ItemList from '$lib/ui/generic/ItemList.svelte'
|
||||||
import LabelStat from '$lib/ui/info/LabelStat.svelte'
|
import LabelStat from '$lib/ui/info/LabelStat.svelte'
|
||||||
import EndPlaceholder from '$lib/ui/layout/EndPlaceholder.svelte'
|
import EndPlaceholder from '$lib/ui/layout/EndPlaceholder.svelte'
|
||||||
@@ -108,6 +106,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import EntityHeader from '$lib/ui/generic/EntityHeader.svelte'
|
||||||
|
|
||||||
let loading = $state({
|
let loading = $state({
|
||||||
blocking: false,
|
blocking: false,
|
||||||
subscribing: false,
|
subscribing: false,
|
||||||
@@ -170,24 +170,19 @@
|
|||||||
clazz,
|
clazz,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<div class="px-3 overflow-hidden">
|
<EntityHeader
|
||||||
<Entity
|
|
||||||
name={community_view.community.title}
|
name={community_view.community.title}
|
||||||
label="!{fullCommunityName(
|
avatar={community_view.community.icon}
|
||||||
|
banner={community_view.community.banner}
|
||||||
|
avatarCircle={false}
|
||||||
|
>
|
||||||
|
{#snippet nameDetail()}
|
||||||
|
!{fullCommunityName(
|
||||||
community_view.community.name,
|
community_view.community.name,
|
||||||
community_view.community.actor_id,
|
community_view.community.actor_id,
|
||||||
)}"
|
)}
|
||||||
>
|
|
||||||
{#snippet customIcon()}
|
|
||||||
<Avatar
|
|
||||||
width={32}
|
|
||||||
url={community_view.community.icon}
|
|
||||||
alt={community_view.community.name}
|
|
||||||
circle={false}
|
|
||||||
/>
|
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Entity>
|
</EntityHeader>
|
||||||
</div>
|
|
||||||
|
|
||||||
<EndPlaceholder size="xs" margin="sm">
|
<EndPlaceholder size="xs" margin="sm">
|
||||||
{$t('form.post.community')}
|
{$t('form.post.community')}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
import Markdown from '$lib/app/markdown/Markdown.svelte'
|
import Markdown from '$lib/app/markdown/Markdown.svelte'
|
||||||
import { settings } from '$lib/app/settings.svelte'
|
import { settings } from '$lib/app/settings.svelte'
|
||||||
import { userLink } from '$lib/app/util.svelte'
|
import { userLink } from '$lib/app/util.svelte'
|
||||||
import Avatar from '$lib/ui/generic/Avatar.svelte'
|
import EntityHeader from '$lib/ui/generic/EntityHeader.svelte'
|
||||||
import ItemList from '$lib/ui/generic/ItemList.svelte'
|
import ItemList from '$lib/ui/generic/ItemList.svelte'
|
||||||
import LabelStat from '$lib/ui/info/LabelStat.svelte'
|
import LabelStat from '$lib/ui/info/LabelStat.svelte'
|
||||||
import EndPlaceholder from '$lib/ui/layout/EndPlaceholder.svelte'
|
import EndPlaceholder from '$lib/ui/layout/EndPlaceholder.svelte'
|
||||||
import SidebarButton from '$lib/ui/sidebar/SidebarButton.svelte'
|
import SidebarButton from '$lib/ui/sidebar/SidebarButton.svelte'
|
||||||
import { Badge, Expandable } from 'mono-svelte'
|
import { Badge, Expandable, Popover } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
BuildingOffice,
|
BuildingOffice,
|
||||||
Icon,
|
Icon,
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
ServerStack,
|
ServerStack,
|
||||||
} from 'svelte-hero-icons/dist'
|
} from 'svelte-hero-icons/dist'
|
||||||
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
||||||
import { optimizeImageURL } from '../post'
|
|
||||||
|
|
||||||
interface Props extends HTMLAttributes<HTMLDivElement> {
|
interface Props extends HTMLAttributes<HTMLDivElement> {
|
||||||
site: SiteView
|
site: SiteView
|
||||||
@@ -36,20 +35,13 @@
|
|||||||
clazz,
|
clazz,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{#if site.site.banner}
|
<EntityHeader
|
||||||
<div class="rounded-xl bg-slate-100 dark:bg-zinc-925">
|
name={site.site.name}
|
||||||
<img
|
avatar={site.site.icon}
|
||||||
src={optimizeImageURL(site.site.banner, 512)}
|
banner={site.site.banner}
|
||||||
alt="Site banner"
|
compact="always"
|
||||||
class="h-32 object-cover w-full"
|
avatarCircle={false}
|
||||||
style="border-radius: inherit;"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class="mx-3 space-y-3">
|
|
||||||
<Avatar width={32} url={site.site.icon} alt="" circle={false} />
|
|
||||||
<h2 class="font-medium text-lg -my-2">{site.site.name}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
{#if taglines && taglines.length > 0}
|
{#if taglines && taglines.length > 0}
|
||||||
<Markdown
|
<Markdown
|
||||||
@@ -96,11 +88,34 @@
|
|||||||
content={site.counts.comments.toString()}
|
content={site.counts.comments.toString()}
|
||||||
formatted
|
formatted
|
||||||
/>
|
/>
|
||||||
|
<Popover openOnHover placement="bottom-end">
|
||||||
|
{#snippet target(attachment)}
|
||||||
|
<button class="text-left cursor-pointer" {@attach attachment}>
|
||||||
<LabelStat
|
<LabelStat
|
||||||
label={$t('cards.community.activeDay')}
|
label={$t('cards.community.activeDay')}
|
||||||
content={site.counts.users_active_day.toString()}
|
content={site.counts.users_active_day.toString()}
|
||||||
formatted
|
formatted
|
||||||
/>
|
/>
|
||||||
|
</button>
|
||||||
|
{/snippet}
|
||||||
|
<div class="flex flex-row gap-4 flex-wrap px-3">
|
||||||
|
<LabelStat
|
||||||
|
label={$t('filter.sort.top.time.week')}
|
||||||
|
content={site.counts.users_active_week.toString()}
|
||||||
|
formatted
|
||||||
|
/>
|
||||||
|
<LabelStat
|
||||||
|
label={$t('filter.sort.top.time.month')}
|
||||||
|
content={site.counts.users_active_month.toString()}
|
||||||
|
formatted
|
||||||
|
/>
|
||||||
|
<LabelStat
|
||||||
|
label={$t('filter.sort.top.time.6months')}
|
||||||
|
content={site.counts.users_active_half_year.toString()}
|
||||||
|
formatted
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Popover>
|
||||||
<LabelStat
|
<LabelStat
|
||||||
label={$t('content.communities')}
|
label={$t('content.communities')}
|
||||||
content={site.counts.communities.toString()}
|
content={site.counts.communities.toString()}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
onclick={() => castVote(vote == targetNum ? 0 : targetNum)}
|
onclick={() => castVote(vote == targetNum ? 0 : targetNum)}
|
||||||
class={[
|
class={[
|
||||||
'flex items-center gap-0.5 transition-colors relative cursor-pointer h-full p-2 active:brightness-90',
|
'flex items-center gap-0.5 transition-colors relative cursor-pointer h-full p-2 active:brightness-90',
|
||||||
'first:rounded-l-3xl last:rounded-r-3xl',
|
'first:rounded-l-[inherit] last:rounded-r-[inherit]',
|
||||||
'last:flex-row-reverse',
|
'last:flex-row-reverse',
|
||||||
vote == targetNum
|
vote == targetNum
|
||||||
? shouldShowVoteColor(
|
? shouldShowVoteColor(
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
buttonColor.ghost,
|
buttonColor.ghost,
|
||||||
'rounded-3xl h-full font-medium flex relative hover:bg-transparent!',
|
'rounded-full h-full font-medium flex relative hover:bg-transparent!',
|
||||||
voteRatio < 85 && settings.voteRatioBar && 'vote-ratio',
|
voteRatio < 85 && settings.voteRatioBar && 'vote-ratio',
|
||||||
]}
|
]}
|
||||||
aria-label={$t('aria.vote.group')}
|
aria-label={$t('aria.vote.group')}
|
||||||
|
|||||||
@@ -3,10 +3,19 @@
|
|||||||
import { profile } from '$lib/app/auth.svelte'
|
import { profile } from '$lib/app/auth.svelte'
|
||||||
import { t } from '$lib/app/i18n'
|
import { t } from '$lib/app/i18n'
|
||||||
import { settings, type View } from '$lib/app/settings.svelte'
|
import { settings, type View } from '$lib/app/settings.svelte'
|
||||||
|
import { instanceToURL } from '$lib/app/util.svelte'
|
||||||
import { save } from '$lib/feature/legacy/contentview'
|
import { save } from '$lib/feature/legacy/contentview'
|
||||||
import { publishedToDate } from '$lib/ui/util/date'
|
import { publishedToDate } from '$lib/ui/util/date'
|
||||||
import FormattedNumber from '$lib/ui/util/FormattedNumber.svelte'
|
import FormattedNumber from '$lib/ui/util/FormattedNumber.svelte'
|
||||||
import { Button, Menu, Modal, Spinner } from 'mono-svelte'
|
import {
|
||||||
|
Button,
|
||||||
|
Menu,
|
||||||
|
MenuButton,
|
||||||
|
MenuDivider,
|
||||||
|
Modal,
|
||||||
|
Spinner,
|
||||||
|
toast,
|
||||||
|
} from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
Bookmark,
|
Bookmark,
|
||||||
BookmarkSlash,
|
BookmarkSlash,
|
||||||
@@ -14,7 +23,10 @@
|
|||||||
ChatBubbleOvalLeft,
|
ChatBubbleOvalLeft,
|
||||||
ChatBubbleOvalLeftEllipsis,
|
ChatBubbleOvalLeftEllipsis,
|
||||||
EllipsisHorizontal,
|
EllipsisHorizontal,
|
||||||
|
GlobeAlt,
|
||||||
Icon,
|
Icon,
|
||||||
|
MapPin,
|
||||||
|
Share,
|
||||||
ShieldCheck,
|
ShieldCheck,
|
||||||
} from 'svelte-hero-icons/dist'
|
} from 'svelte-hero-icons/dist'
|
||||||
import { PostVote } from '..'
|
import { PostVote } from '..'
|
||||||
@@ -42,6 +54,21 @@
|
|||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
let buttonHeight = $derived(view == 'compact' ? 'h-7.5' : 'h-8')
|
let buttonHeight = $derived(view == 'compact' ? 'h-7.5' : 'h-8')
|
||||||
let buttonSquare = $derived(view == 'compact' ? 'w-7.5 h-7.5' : 'w-8 h-8')
|
let buttonSquare = $derived(view == 'compact' ? 'w-7.5 h-7.5' : 'w-8 h-8')
|
||||||
|
|
||||||
|
function share(global: boolean = true) {
|
||||||
|
const link = global
|
||||||
|
? post.post.ap_id
|
||||||
|
: `${instanceToURL(profile.current.instance)}/post/${post.post.id}`
|
||||||
|
|
||||||
|
if (navigator.share)
|
||||||
|
navigator.share?.({
|
||||||
|
url: link,
|
||||||
|
})
|
||||||
|
else {
|
||||||
|
navigator.clipboard.writeText(link)
|
||||||
|
toast({ content: $t('toast.copied') })
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if editing}
|
{#if editing}
|
||||||
@@ -116,6 +143,7 @@
|
|||||||
<FormattedNumber number={post.counts.comments} />
|
<FormattedNumber number={post.counts.comments} />
|
||||||
</Button>
|
</Button>
|
||||||
<div class="flex-1"></div>
|
<div class="flex-1"></div>
|
||||||
|
|
||||||
{#if settings.debugInfo}
|
{#if settings.debugInfo}
|
||||||
{#if debug}
|
{#if debug}
|
||||||
{#await import('$lib/ui/util/debug/DebugObject.svelte') then { default: DebugObject }}
|
{#await import('$lib/ui/util/debug/DebugObject.svelte') then { default: DebugObject }}
|
||||||
@@ -170,6 +198,30 @@
|
|||||||
></Button>
|
></Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<Menu placement="bottom-end">
|
||||||
|
{#snippet target(attachment)}
|
||||||
|
<Button
|
||||||
|
{@attach post.post.local ? () => {} : attachment}
|
||||||
|
rounding="pill"
|
||||||
|
color="ghost"
|
||||||
|
size="custom"
|
||||||
|
class={buttonSquare}
|
||||||
|
onclick={() => {
|
||||||
|
if (post.post.local) share()
|
||||||
|
}}
|
||||||
|
icon={Share}
|
||||||
|
title={$t('post.actions.more.share')}
|
||||||
|
/>
|
||||||
|
{/snippet}
|
||||||
|
<MenuDivider showLabel>{$t('post.actions.more.share.from')}</MenuDivider>
|
||||||
|
<MenuButton onclick={() => share(true)} icon={GlobeAlt}>
|
||||||
|
{$t('post.actions.more.share.global')}
|
||||||
|
</MenuButton>
|
||||||
|
<MenuButton onclick={() => share(false)} icon={MapPin}>
|
||||||
|
{$t('post.actions.more.share.local')}
|
||||||
|
</MenuButton>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
<Menu placement="bottom-end">
|
<Menu placement="bottom-end">
|
||||||
{#snippet target(popover)}
|
{#snippet target(popover)}
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -7,20 +7,15 @@
|
|||||||
import { t } from '$lib/app/i18n'
|
import { t } from '$lib/app/i18n'
|
||||||
import { setSessionStorage } from '$lib/app/session'
|
import { setSessionStorage } from '$lib/app/session'
|
||||||
import { settings } from '$lib/app/settings.svelte'
|
import { settings } from '$lib/app/settings.svelte'
|
||||||
import { instanceToURL } from '$lib/app/util.svelte'
|
|
||||||
import { deleteItem, markAsRead } from '$lib/feature/legacy/contentview'
|
import { deleteItem, markAsRead } from '$lib/feature/legacy/contentview'
|
||||||
import { report } from '$lib/feature/moderation/moderation'
|
import { report } from '$lib/feature/moderation/moderation'
|
||||||
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
|
import { MenuButton } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
ArrowTopRightOnSquare,
|
ArrowTopRightOnSquare,
|
||||||
EllipsisHorizontal,
|
|
||||||
Eye,
|
Eye,
|
||||||
EyeSlash,
|
EyeSlash,
|
||||||
Flag,
|
Flag,
|
||||||
GlobeAlt,
|
|
||||||
MapPin,
|
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
Share,
|
|
||||||
Trash,
|
Trash,
|
||||||
XMark,
|
XMark,
|
||||||
} from 'svelte-hero-icons/dist'
|
} from 'svelte-hero-icons/dist'
|
||||||
@@ -33,21 +28,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let { post = $bindable(), onhide, editing = $bindable() }: Props = $props()
|
let { post = $bindable(), onhide, editing = $bindable() }: Props = $props()
|
||||||
|
|
||||||
function share(global: boolean = true) {
|
|
||||||
const link = global
|
|
||||||
? post.post.ap_id
|
|
||||||
: `${instanceToURL(profile.current.instance)}/post/${post.post.id}`
|
|
||||||
|
|
||||||
if (navigator.share)
|
|
||||||
navigator.share?.({
|
|
||||||
url: link,
|
|
||||||
})
|
|
||||||
else {
|
|
||||||
navigator.clipboard.writeText(link)
|
|
||||||
toast({ content: $t('toast.copied') })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id}
|
{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id}
|
||||||
@@ -68,36 +48,6 @@
|
|||||||
: $t('post.actions.more.markRead')}
|
: $t('post.actions.more.markRead')}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="flex flex-row">
|
|
||||||
<MenuButton
|
|
||||||
onclick={() => share()}
|
|
||||||
class={['flex-1', !post.post.local && 'rounded-r-lg']}
|
|
||||||
icon={Share}
|
|
||||||
>
|
|
||||||
{$t('post.actions.more.share')}
|
|
||||||
</MenuButton>
|
|
||||||
{#if !post.post.local}
|
|
||||||
<Menu>
|
|
||||||
{#snippet target(attachment)}
|
|
||||||
<Button
|
|
||||||
{@attach attachment}
|
|
||||||
aria-label={$t('post.actions.more.label')}
|
|
||||||
color="tertiary"
|
|
||||||
size="custom"
|
|
||||||
class="w-6 h-6 self-center"
|
|
||||||
data-autoclose="false"
|
|
||||||
icon={EllipsisHorizontal}
|
|
||||||
></Button>
|
|
||||||
{/snippet}
|
|
||||||
<MenuButton onclick={() => share(true)} icon={GlobeAlt}>
|
|
||||||
{$t('filter.location.global')}
|
|
||||||
</MenuButton>
|
|
||||||
<MenuButton onclick={() => share(false)} icon={MapPin}>
|
|
||||||
{$t('filter.location.local')}
|
|
||||||
</MenuButton>
|
|
||||||
</Menu>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{#if profile.current?.jwt}
|
{#if profile.current?.jwt}
|
||||||
<MenuButton
|
<MenuButton
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { Material } from 'mono-svelte'
|
import { Material } from 'mono-svelte'
|
||||||
import type { ClassValue } from 'svelte/elements'
|
import type { ClassValue } from 'svelte/elements'
|
||||||
import LabelStat from '../info/LabelStat.svelte'
|
import LabelStat from '../info/LabelStat.svelte'
|
||||||
|
import TextProps from '../text/TextProps.svelte'
|
||||||
import Avatar from './Avatar.svelte'
|
import Avatar from './Avatar.svelte'
|
||||||
import Blobs from './Blobs.svelte'
|
import Blobs from './Blobs.svelte'
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
url?: string | undefined
|
url?: string | undefined
|
||||||
stats?: {
|
stats?: {
|
||||||
name: string
|
name: string
|
||||||
value: string
|
value: string | number
|
||||||
format?: boolean
|
format?: boolean
|
||||||
}[]
|
}[]
|
||||||
class?: ClassValue
|
class?: ClassValue
|
||||||
@@ -42,55 +43,69 @@
|
|||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div {...rest} class={['z-10 text-sm contents w-full space-y-4', clazz]}>
|
<div {...rest} class={['z-10 text-sm w-full space-y-4 @container', clazz]}>
|
||||||
<Material padding="xl" rounding="3xl" class="flex flex-col gap-4">
|
<Material padding="xl" rounding="3xl" class="flex flex-col gap-2 @lg:gap-4">
|
||||||
<div
|
<div
|
||||||
class="relative overflow-hidden rounded-t-[inherit] -m-6 mask-b-from-0"
|
class="relative overflow-hidden rounded-t-[inherit] -m-6 mask-b-from-0 h-32 @lg:h-48"
|
||||||
>
|
>
|
||||||
{#if banner}
|
{#if banner}
|
||||||
<img
|
<img
|
||||||
src={banner}
|
src={banner}
|
||||||
class="w-full object-cover h-48 bg-white dark:bg-zinc-900"
|
class="w-full object-cover h-full bg-white dark:bg-zinc-900"
|
||||||
height="192"
|
height="192"
|
||||||
alt="User banner"
|
alt="User banner"
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="scale-150">
|
<div class="scale-150 h-full">
|
||||||
<Blobs seed={name} />
|
<Blobs seed={name} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#snippet icon(width: number)}
|
||||||
<Avatar
|
<Avatar
|
||||||
width={72}
|
{width}
|
||||||
url={avatar}
|
url={avatar}
|
||||||
alt={name}
|
alt={name}
|
||||||
circle={avatarCircle}
|
circle={avatarCircle}
|
||||||
class={[
|
class={[
|
||||||
'ring-slate-25 bg-slate-25 dark:bg-zinc-925 ring-6 relative dark:ring-zinc-950',
|
'ring-slate-25 bg-slate-25 dark:bg-zinc-925 ring-2 relative dark:ring-zinc-950',
|
||||||
'-mt-8',
|
'-mt-8',
|
||||||
!avatarCircle && 'rounded-3xl!',
|
!avatarCircle && 'rounded-xl @md:rounded-3xl!',
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
<div class="contents @md:hidden">
|
||||||
|
{@render icon(48)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hidden @md:contents">
|
||||||
|
{@render icon(72)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<svelte:element
|
<svelte:element
|
||||||
this={url ? 'a' : 'h1'}
|
this={url ? 'a' : 'h1'}
|
||||||
href={url}
|
href={url}
|
||||||
class="text-2xl font-medium tracking-tight {url
|
class="text-xl @md:text-2xl font-medium tracking-tight {url
|
||||||
? 'hover:underline hover:text-primary-900 dark:hover:text-primary-100'
|
? 'hover:underline hover:text-primary-900 dark:hover:text-primary-100'
|
||||||
: ''}"
|
: ''}"
|
||||||
>
|
>
|
||||||
{name}
|
{name}
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
|
{#if nameDetail}
|
||||||
<p
|
<p
|
||||||
class="flex items-center gap-0 text-sm text-slate-600 dark:text-zinc-400 max-w-full w-max"
|
class="flex items-center gap-0 text-sm text-slate-600 dark:text-zinc-400 max-w-full w-max"
|
||||||
>
|
>
|
||||||
|
<TextProps wrap="no-wrap">
|
||||||
{@render nameDetail?.()}
|
{@render nameDetail?.()}
|
||||||
|
</TextProps>
|
||||||
</p>
|
</p>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</Material>
|
</Material>
|
||||||
{#if actions || stats}
|
{#if actions || stats.length > 0}
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="flex flex-col flex-1">
|
<div class="flex flex-col flex-1">
|
||||||
{#if actions}
|
{#if actions}
|
||||||
|
|||||||
@@ -84,7 +84,8 @@
|
|||||||
open = newOpen
|
open = newOpen
|
||||||
}
|
}
|
||||||
|
|
||||||
const mouseLeave = () => openOnHover && toggle(false)
|
const mouseover = () => openOnHover && toggle(true)
|
||||||
|
const mouseleave = () => openOnHover && toggle(false)
|
||||||
const focus = () => openOnHover && toggle(true)
|
const focus = () => openOnHover && toggle(true)
|
||||||
const focusout = () => openOnHover && toggle(false)
|
const focusout = () => openOnHover && toggle(false)
|
||||||
const click = () => {
|
const click = () => {
|
||||||
@@ -112,7 +113,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e.addEventListener('mouseleave', mouseLeave)
|
e.addEventListener('mouseover', mouseover)
|
||||||
|
e.addEventListener('mouseleave', mouseleave)
|
||||||
e.addEventListener('focus', focus)
|
e.addEventListener('focus', focus)
|
||||||
e.addEventListener('focusout', focusout)
|
e.addEventListener('focusout', focusout)
|
||||||
e.addEventListener('click', click)
|
e.addEventListener('click', click)
|
||||||
@@ -121,7 +123,8 @@
|
|||||||
floatingRef(e)
|
floatingRef(e)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
e.removeEventListener('mouseleave', mouseLeave)
|
e.addEventListener('mouseover', mouseover)
|
||||||
|
e.removeEventListener('mouseleave', mouseleave)
|
||||||
e.removeEventListener('focus', focus)
|
e.removeEventListener('focus', focus)
|
||||||
e.removeEventListener('focusout', focusout)
|
e.removeEventListener('focusout', focusout)
|
||||||
e.removeEventListener('click', click)
|
e.removeEventListener('click', click)
|
||||||
@@ -149,7 +152,13 @@
|
|||||||
{#if popover}
|
{#if popover}
|
||||||
{@render popover(open)}
|
{@render popover(open)}
|
||||||
{:else}
|
{:else}
|
||||||
<Material elevation="high" color="distinct" class="flex flex-col">
|
<Material
|
||||||
|
elevation="high"
|
||||||
|
color="distinct"
|
||||||
|
rounding="xl"
|
||||||
|
padding="sm"
|
||||||
|
class="flex flex-col"
|
||||||
|
>
|
||||||
{@render children?.(open)}
|
{@render children?.(open)}
|
||||||
</Material>
|
</Material>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in new issue
Block a user