design: use entityheaders for instance and community cards
This commit is contained in:
8 files changed
+161
-122
No files matched your search
@@ -93,7 +93,7 @@
|
||||
onclick={() => castVote(vote == targetNum ? 0 : targetNum)}
|
||||
class={[
|
||||
'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',
|
||||
vote == targetNum
|
||||
? shouldShowVoteColor(
|
||||
@@ -137,7 +137,7 @@
|
||||
<div
|
||||
class={[
|
||||
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',
|
||||
]}
|
||||
aria-label={$t('aria.vote.group')}
|
||||
|
||||
@@ -3,10 +3,19 @@
|
||||
import { profile } from '$lib/app/auth.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { settings, type View } from '$lib/app/settings.svelte'
|
||||
import { instanceToURL } from '$lib/app/util.svelte'
|
||||
import { save } from '$lib/feature/legacy/contentview'
|
||||
import { publishedToDate } from '$lib/ui/util/date'
|
||||
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 {
|
||||
Bookmark,
|
||||
BookmarkSlash,
|
||||
@@ -14,7 +23,10 @@
|
||||
ChatBubbleOvalLeft,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
EllipsisHorizontal,
|
||||
GlobeAlt,
|
||||
Icon,
|
||||
MapPin,
|
||||
Share,
|
||||
ShieldCheck,
|
||||
} from 'svelte-hero-icons/dist'
|
||||
import { PostVote } from '..'
|
||||
@@ -42,6 +54,21 @@
|
||||
}: Props = $props()
|
||||
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')
|
||||
|
||||
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>
|
||||
|
||||
{#if editing}
|
||||
@@ -116,6 +143,7 @@
|
||||
<FormattedNumber number={post.counts.comments} />
|
||||
</Button>
|
||||
<div class="flex-1"></div>
|
||||
|
||||
{#if settings.debugInfo}
|
||||
{#if debug}
|
||||
{#await import('$lib/ui/util/debug/DebugObject.svelte') then { default: DebugObject }}
|
||||
@@ -170,6 +198,30 @@
|
||||
></Button>
|
||||
{/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">
|
||||
{#snippet target(popover)}
|
||||
<Button
|
||||
|
||||
@@ -7,20 +7,15 @@
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { setSessionStorage } from '$lib/app/session'
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
import { instanceToURL } from '$lib/app/util.svelte'
|
||||
import { deleteItem, markAsRead } from '$lib/feature/legacy/contentview'
|
||||
import { report } from '$lib/feature/moderation/moderation'
|
||||
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
|
||||
import { MenuButton } from 'mono-svelte'
|
||||
import {
|
||||
ArrowTopRightOnSquare,
|
||||
EllipsisHorizontal,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
Flag,
|
||||
GlobeAlt,
|
||||
MapPin,
|
||||
PencilSquare,
|
||||
Share,
|
||||
Trash,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons/dist'
|
||||
@@ -33,21 +28,6 @@
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
{#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')}
|
||||
</MenuButton>
|
||||
{/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}
|
||||
<MenuButton
|
||||
onclick={() => {
|
||||
|
||||
Reference in new issue
Block a user