fix: Fix lint errors (#559)
* cleanup: postactions styling * misc: fix first round of errors * pkg: remove vitest * fix: fix lint errors stage 2 * fix: fix lint errors stage 3 * fix: fix lint errors, stage 3 * misc: update eslint rules to warn for writable derived
This commit is contained in:
1 parent
1824245f13
commit
76c581123a
225 files changed
+1553
-2352
No files matched your search
@@ -1,29 +1,27 @@
|
||||
<script lang="ts">
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import { goto } from '$app/navigation'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { mediaType, postLink } from '$lib/components/lemmy/post/helpers.js'
|
||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||
import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte'
|
||||
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
||||
import { settings, type View } from '$lib/settings.svelte.js'
|
||||
import PostMeta, {
|
||||
parseTags,
|
||||
type Tag,
|
||||
} from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { Badge } from 'mono-svelte'
|
||||
import { mediaType, postLink } from '$lib/components/lemmy/post/helpers.js'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { ArrowUp, ChatBubbleOvalLeft, Icon } from 'svelte-hero-icons'
|
||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||
import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte'
|
||||
import PostBody from './PostBody.svelte'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { goto } from '$app/navigation'
|
||||
import { settings, type View } from '$lib/settings.svelte.js'
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import PostBody from './PostBody.svelte'
|
||||
|
||||
function getTagRule(tags: Tag[]): 'blur-sm' | 'hide' | undefined {
|
||||
const tagContent = tags.map((t) => t.content.toLowerCase())
|
||||
const tagContent = tags.map(t => t.content.toLowerCase())
|
||||
|
||||
let rule: 'blur-sm' | 'hide' | undefined
|
||||
if (settings.nsfwBlur && (post.post.nsfw || post.community.nsfw))
|
||||
rule = 'blur-sm'
|
||||
tagContent.forEach((tag) => {
|
||||
tagContent.forEach(tag => {
|
||||
if (settings.tagRules?.[tag]) rule = settings.tagRules?.[tag] ?? rule
|
||||
if (rule == 'hide') return rule
|
||||
})
|
||||
@@ -31,8 +29,8 @@
|
||||
return rule
|
||||
}
|
||||
|
||||
function onClick(e: any) {
|
||||
const event = e as MouseEvent
|
||||
function onClick(e: Event) {
|
||||
const event = e as Event
|
||||
const parent = document.getElementById(post.post.id.toString())
|
||||
|
||||
if (event.target == parent) {
|
||||
@@ -68,7 +66,7 @@
|
||||
})
|
||||
|
||||
let tags = $derived(parseTags(post.post.name))
|
||||
let type = $derived(mediaType(post.post.url, view))
|
||||
let type = $derived(mediaType(post.post.url))
|
||||
let rule = $derived(getTagRule(tags.tags))
|
||||
let hideTitle = $derived(
|
||||
settings.posts.deduplicateEmbed &&
|
||||
@@ -100,7 +98,6 @@
|
||||
It adapts to all kinds of form factors for different contexts, such as feeds, full post view, and crosspost list.
|
||||
-->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
||||
<div
|
||||
class={[
|
||||
@@ -111,11 +108,10 @@
|
||||
clazz,
|
||||
]}
|
||||
id={post.post.id.toString()}
|
||||
onclick={(e) => {
|
||||
onclick={e => {
|
||||
onClick(e)
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
// @ts-ignore
|
||||
onkeydown={e => {
|
||||
if (e.key == 'Enter') onClick(e)
|
||||
}}
|
||||
tabindex="0"
|
||||
@@ -128,7 +124,7 @@
|
||||
published={publishedToDate(post.post.published)}
|
||||
{badges}
|
||||
subscribed={profile.data?.user?.follows
|
||||
.map((c) => c.community.id)
|
||||
.map(c => c.community.id)
|
||||
.includes(post.community.id)
|
||||
? 'Subscribed'
|
||||
: 'NotSubscribed'}
|
||||
@@ -156,9 +152,7 @@
|
||||
<PostMediaCompact
|
||||
post={post.post}
|
||||
{type}
|
||||
class="{settings.leftAlign
|
||||
? 'mr-3'
|
||||
: 'ml-3'} shrink no-list-margin"
|
||||
class="{settings.leftAlign ? 'mr-3' : 'ml-3'} shrink no-list-margin"
|
||||
style="grid-area: media;"
|
||||
blur={rule == 'blur-sm' ? true : undefined}
|
||||
{view}
|
||||
@@ -169,7 +163,6 @@
|
||||
<PostBody
|
||||
element="section"
|
||||
body={post.post.body}
|
||||
{view}
|
||||
style="grid-area: body"
|
||||
class="relative"
|
||||
/>
|
||||
|
||||
@@ -1,43 +1,25 @@
|
||||
<script lang="ts">
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import PostVote from './PostVote.svelte'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import {
|
||||
ArrowsUpDown,
|
||||
ArrowTopRightOnSquare,
|
||||
Bookmark,
|
||||
BookmarkSlash,
|
||||
BugAnt,
|
||||
ChatBubbleOvalLeft,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
Clock,
|
||||
EllipsisHorizontal,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
Flag,
|
||||
GlobeAmericas,
|
||||
Icon,
|
||||
MapPin,
|
||||
Newspaper,
|
||||
Pencil,
|
||||
PencilSquare,
|
||||
Share,
|
||||
Trash,
|
||||
UserCircle,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { goto } from '$app/navigation'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import {
|
||||
amMod,
|
||||
isAdmin,
|
||||
report,
|
||||
} from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ModerationMenu from '$lib/components/lemmy/moderation/ModerationMenu.svelte'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import TextProps from '$lib/components/ui/text/TextProps.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import { deleteItem, markAsRead, save } from '$lib/lemmy/contentview.js'
|
||||
import { communityLink, userLink } from '$lib/lemmy/generic'
|
||||
import { setSessionStorage } from '$lib/session.js'
|
||||
import { goto } from '$app/navigation'
|
||||
import { settings, type View } from '$lib/settings.svelte.js'
|
||||
import { instanceToURL } from '$lib/util.svelte'
|
||||
import { feature } from '$lib/version'
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import {
|
||||
Button,
|
||||
Menu,
|
||||
@@ -47,17 +29,29 @@
|
||||
Spinner,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import {
|
||||
ArrowTopRightOnSquare,
|
||||
Bookmark,
|
||||
BookmarkSlash,
|
||||
BugAnt,
|
||||
ChatBubbleOvalLeft,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
EllipsisHorizontal,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
Flag,
|
||||
GlobeAmericas,
|
||||
Icon,
|
||||
MapPin,
|
||||
Newspaper,
|
||||
PencilSquare,
|
||||
Share,
|
||||
Trash,
|
||||
UserCircle,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons'
|
||||
import { hidePost, postLink } from './helpers'
|
||||
import { feature } from '$lib/version'
|
||||
import { instanceId, instanceToURL } from '$lib/util.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import TextProps from '$lib/components/ui/text/TextProps.svelte'
|
||||
import { communityLink, userLink } from '$lib/lemmy/generic'
|
||||
import RelativeDate, {
|
||||
formatRelativeDate,
|
||||
} from '$lib/components/util/RelativeDate.svelte'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import PostVote from './PostVote.svelte'
|
||||
|
||||
let editing = $state(false)
|
||||
let saving = $state(false)
|
||||
@@ -98,7 +92,7 @@
|
||||
<PostForm
|
||||
edit
|
||||
editingPost={post.post}
|
||||
onsubmit={(e) => {
|
||||
onsubmit={e => {
|
||||
editing = false
|
||||
post = e
|
||||
onedit?.(e)
|
||||
@@ -106,7 +100,6 @@
|
||||
>
|
||||
{#snippet formtitle()}
|
||||
<!-- Have the title not exist at all -->
|
||||
{''}
|
||||
{/snippet}
|
||||
</PostForm>
|
||||
{/await}
|
||||
@@ -136,7 +129,6 @@
|
||||
rounding="pill"
|
||||
target={settings.openLinksInNewTab ? '_blank' : ''}
|
||||
title={$t('post.actions.comments')}
|
||||
animations={{ scale: true, large: false }}
|
||||
>
|
||||
{@const newComment =
|
||||
publishedToDate(post.counts.newest_comment_time).getTime() >
|
||||
@@ -148,7 +140,6 @@
|
||||
<FormattedNumber number={post.counts.comments} />
|
||||
</Button>
|
||||
<div class="flex-1"></div>
|
||||
|
||||
{#if settings.debugInfo}
|
||||
{#if debug}
|
||||
{#await import('$lib/components/util/debug/DebugObject.svelte') then { default: DebugObject }}
|
||||
@@ -185,7 +176,7 @@
|
||||
onclick={async () => {
|
||||
if (!profile.data?.jwt) return
|
||||
saving = true
|
||||
post.saved = await save(post, !post.saved, profile.data?.jwt)
|
||||
post.saved = await save(post, !post.saved)
|
||||
saving = false
|
||||
}}
|
||||
size="custom"
|
||||
@@ -195,7 +186,6 @@
|
||||
loading={saving}
|
||||
disabled={saving}
|
||||
title={post.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
|
||||
animations={{ scale: true, large: true }}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={post.saved ? BookmarkSlash : Bookmark} size="16" mini />
|
||||
@@ -203,13 +193,7 @@
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
<Menu
|
||||
placement="bottom-end"
|
||||
containerClass="overflow-auto max-h-[400px]"
|
||||
class="h-8"
|
||||
targetClass="h-full"
|
||||
title={$t('post.actions.more.label')}
|
||||
>
|
||||
<Menu placement="bottom-end" class="h-8">
|
||||
{#snippet target()}
|
||||
<Button
|
||||
title={$t('post.actions.more.label')}
|
||||
@@ -224,59 +208,6 @@
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuDivider>{$t('cards.site.stats')}</MenuDivider>
|
||||
<div class="flex flex-row gap-1 items-center">
|
||||
<MenuButton class="flex-1">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Clock} size="16" micro />
|
||||
{/snippet}
|
||||
<span>
|
||||
{publishedToDate(post.post.published).toLocaleDateString(undefined, {
|
||||
dateStyle: 'short',
|
||||
})}
|
||||
</span>
|
||||
</MenuButton>
|
||||
{#if post.post.updated}
|
||||
{@const editedTime = formatRelativeDate(
|
||||
publishedToDate(post.post.updated),
|
||||
{
|
||||
style: 'long',
|
||||
},
|
||||
)}
|
||||
<MenuButton class="flex-1" aria-label={editedTime}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Pencil} size="16" micro />
|
||||
{/snippet}
|
||||
<RelativeDate date={publishedToDate(post.post.updated)} />
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</div>
|
||||
{#if post.counts.score}
|
||||
{@const ratio =
|
||||
post.counts.upvotes / (post.counts.upvotes + post.counts.downvotes)}
|
||||
<MenuButton
|
||||
aria-label={$t('aria.vote.score', { default: post.counts.score })}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowsUpDown} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('post.actions.vote.score')}
|
||||
•
|
||||
<FormattedNumber
|
||||
number={post.counts.score}
|
||||
options={{ notation: 'standard' }}
|
||||
class="font-medium"
|
||||
/>
|
||||
•
|
||||
<FormattedNumber
|
||||
number={ratio}
|
||||
options={{ style: 'percent' }}
|
||||
class="font-medium {ratio > 0.7
|
||||
? 'text-blue-700 dark:text-blue-300'
|
||||
: 'text-red-500'}"
|
||||
/>
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuDivider>{$t('post.actions.more.creator')}</MenuDivider>
|
||||
<MenuButton link href={userLink(post.creator)}>
|
||||
{#snippet prefix()}
|
||||
@@ -309,11 +240,7 @@
|
||||
<MenuButton
|
||||
onclick={async () => {
|
||||
if (profile.data?.jwt)
|
||||
post.read = await markAsRead(
|
||||
post.post,
|
||||
!post.read,
|
||||
profile.data.jwt,
|
||||
)
|
||||
post.read = await markAsRead(post.post, !post.read)
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
@@ -326,11 +253,13 @@
|
||||
{/if}
|
||||
<MenuButton
|
||||
onclick={() => {
|
||||
navigator.share?.({
|
||||
url: localShare
|
||||
? `${instanceToURL(instance.data)}/post/${post.post.id}`
|
||||
: post.post.ap_id,
|
||||
}) ??
|
||||
if (navigator.share)
|
||||
navigator.share?.({
|
||||
url: localShare
|
||||
? `${instanceToURL(instance.data)}/post/${post.post.id}`
|
||||
: post.post.ap_id,
|
||||
})
|
||||
else
|
||||
navigator.clipboard.writeText(
|
||||
localShare
|
||||
? `${instanceToURL(instance.data)}/post/${post.post.id}`
|
||||
@@ -346,11 +275,11 @@
|
||||
{$t('post.actions.more.share')}
|
||||
<div class="flex-1"></div>
|
||||
{#if !post.post.local}
|
||||
<div class="flex">
|
||||
<div class="flex gap-1">
|
||||
<Button
|
||||
color={!localShare ? 'primary' : 'secondary'}
|
||||
size="square-md"
|
||||
roundingSide="left"
|
||||
size="square-sm"
|
||||
rounding="pill"
|
||||
onclick={() => (localShare = false)}
|
||||
title={$t('filter.location.global')}
|
||||
>
|
||||
@@ -358,8 +287,8 @@
|
||||
</Button>
|
||||
<Button
|
||||
color={localShare ? 'primary' : 'secondary'}
|
||||
size="square-md"
|
||||
roundingSide="right"
|
||||
size="square-sm"
|
||||
rounding="pill"
|
||||
onclick={() => (localShare = true)}
|
||||
title={$t('filter.location.local')}
|
||||
>
|
||||
@@ -401,11 +330,7 @@
|
||||
<MenuButton
|
||||
onclick={async () => {
|
||||
if (profile.data?.jwt)
|
||||
post.post.deleted = await deleteItem(
|
||||
post,
|
||||
!post.post.deleted,
|
||||
profile.data.jwt,
|
||||
)
|
||||
post.post.deleted = await deleteItem(post, !post.post.deleted)
|
||||
}}
|
||||
color="danger-subtle"
|
||||
>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import type { View } from '$lib/settings.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { ChevronDown, Icon } from 'svelte-hero-icons'
|
||||
|
||||
@@ -16,7 +15,6 @@
|
||||
|
||||
interface Props {
|
||||
body: string
|
||||
view?: View
|
||||
clickThrough?: boolean
|
||||
element?: string
|
||||
style?: string
|
||||
@@ -25,7 +23,6 @@
|
||||
|
||||
let {
|
||||
body,
|
||||
view = 'cozy',
|
||||
clickThrough = false,
|
||||
element: htmlElement = 'div',
|
||||
style = '',
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
const newTitle = title
|
||||
.toString()
|
||||
.replace(/^(\[.[^\]]+\])|(\[.[^\]]+\])$/g, (match, content) => {
|
||||
.replace(/^(\[.[^\]]+\])|(\[.[^\]]+\])$/g, match => {
|
||||
const contents = match.split(',').map((part: string) => part.trim())
|
||||
|
||||
contents
|
||||
.map((i) => i.replaceAll(/(\[|\])/g, ''))
|
||||
.map(i => i.replaceAll(/(\[|\])/g, ''))
|
||||
.forEach((content: string) => {
|
||||
extracted.push(
|
||||
textToTag.get(content) ?? {
|
||||
@@ -44,32 +44,32 @@
|
||||
|
||||
<script lang="ts">
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import { Badge, Popover } from 'mono-svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import RelativeDate, {
|
||||
formatRelativeDate,
|
||||
} from '$lib/components/util/RelativeDate.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import { settings, type View } from '$lib/settings.svelte'
|
||||
import type { Community, Person, SubscribedType } from 'lemmy-js-client'
|
||||
import { Badge, Popover } from 'mono-svelte'
|
||||
import {
|
||||
Bookmark,
|
||||
ExclamationTriangle,
|
||||
Icon,
|
||||
LockClosed,
|
||||
Megaphone,
|
||||
PaperAirplane,
|
||||
Pencil,
|
||||
Tag,
|
||||
Trash,
|
||||
PaperAirplane,
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons'
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
import { settings, type View } from '$lib/settings.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Pencil, type IconSource } from 'svelte-hero-icons'
|
||||
import CommunityHeader from '../community/CommunityHeader.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
|
||||
interface Props {
|
||||
community?: Community | undefined
|
||||
@@ -83,7 +83,16 @@
|
||||
edited?: string | undefined
|
||||
view?: View
|
||||
// Badges
|
||||
badges?: any
|
||||
badges?: {
|
||||
nsfw: boolean
|
||||
saved: boolean
|
||||
featured: boolean
|
||||
deleted: boolean
|
||||
removed: boolean
|
||||
locked: boolean
|
||||
moderator: boolean
|
||||
admin: boolean
|
||||
}
|
||||
tags?: Tag[]
|
||||
style?: string
|
||||
titleClass?: string
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts" module>
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
export const voteColor = (vote: number, border: boolean = false) =>
|
||||
export const voteColor = (vote: number) =>
|
||||
vote == 1
|
||||
? `bg-linear-to-br from-blue-500 to-indigo-500 dark:from-blue-400 dark:to-indigo-500 text-slate-50 dark:text-zinc-900`
|
||||
: vote == -1
|
||||
@@ -17,17 +16,17 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import { ChevronDown, ChevronUp, Icon } from 'svelte-hero-icons'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { vote as voteItem } from '$lib/lemmy/contentview.js'
|
||||
import { Button, Popover, buttonColor, toast } from 'mono-svelte'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import { fade, fly } from 'svelte/transition'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import { vote as voteItem } from '$lib/lemmy/contentview.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import { buttonColor, toast } from 'mono-svelte'
|
||||
import { ChevronDown, ChevronUp, Icon } from 'svelte-hero-icons'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
interface Props {
|
||||
post: Post
|
||||
@@ -36,7 +35,7 @@
|
||||
upvotes?: number
|
||||
downvotes?: number
|
||||
showCounts?: boolean
|
||||
children?: import('svelte').Snippet<[any]>
|
||||
children?: import('svelte').Snippet<[{ vote: number; score: number }]>
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -51,17 +50,14 @@
|
||||
|
||||
let loading = $state(false)
|
||||
|
||||
let oldScore = score
|
||||
|
||||
const castVote = async (newVote: number) => {
|
||||
if (!profile.data?.jwt) {
|
||||
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||
return
|
||||
}
|
||||
loading = true
|
||||
oldScore = score
|
||||
vote = newVote
|
||||
const res = await voteItem(post, newVote, profile.data.jwt).catch((e) => {
|
||||
const res = await voteItem(post, newVote).catch(e => {
|
||||
toast({ content: errorMessage(e), type: 'error' })
|
||||
return { upvotes: 0, downvotes: 0, score: 0 }
|
||||
})
|
||||
|
||||
@@ -3,24 +3,17 @@
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import { Badge, Button } from 'mono-svelte'
|
||||
import { ArchiveBox, Icon, Minus, Plus } from 'svelte-hero-icons'
|
||||
import { Button } from 'mono-svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { ArchiveBox, Icon, Plus } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
posts: PostView[]
|
||||
community?: boolean
|
||||
feedData: any
|
||||
children?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
children?: Snippet
|
||||
}
|
||||
|
||||
let {
|
||||
posts = $bindable(),
|
||||
community = false,
|
||||
feedData,
|
||||
children,
|
||||
...rest
|
||||
}: Props = $props()
|
||||
let { posts = $bindable(), community = false, children }: Props = $props()
|
||||
</script>
|
||||
|
||||
<ul
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import VirtualList from '$lib/components/render/VirtualList.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import {
|
||||
postFeeds,
|
||||
@@ -10,10 +12,9 @@
|
||||
type PostFeedID,
|
||||
} from '$lib/lemmy/postfeed.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { onMount, tick, untrack } from 'svelte'
|
||||
import { onMount, untrack } from 'svelte'
|
||||
import {
|
||||
ArchiveBox,
|
||||
ChevronDoubleUp,
|
||||
@@ -22,7 +23,6 @@
|
||||
Plus,
|
||||
} from 'svelte-hero-icons'
|
||||
import InfiniteScroll from 'svelte-infinite-scroll'
|
||||
import VirtualList from '$lib/components/render/VirtualList.svelte'
|
||||
|
||||
interface Props {
|
||||
posts: PostView[]
|
||||
@@ -45,7 +45,7 @@
|
||||
scrollToIndex: (index: number, window?: boolean) => void
|
||||
}>()
|
||||
|
||||
let error: any = $state(undefined)
|
||||
let error = $state()
|
||||
let loading = $state(false)
|
||||
let hasMore = $state(true)
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
sort: feedData.sort,
|
||||
type_: feedData.type_,
|
||||
})
|
||||
.catch((e) => {
|
||||
.catch(e => {
|
||||
throw new Error(e)
|
||||
})
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
|
||||
const callback: IntersectionObserverCallback = (entries, observer) => {
|
||||
entries.forEach((entry) => {
|
||||
entries.forEach(entry => {
|
||||
if (!entry.isIntersecting) return
|
||||
|
||||
const element = entry.target as HTMLElement
|
||||
@@ -130,7 +130,7 @@
|
||||
const feed = document.getElementById('feed')
|
||||
if (!feed) return
|
||||
|
||||
new MutationObserver((mutations) => {
|
||||
new MutationObserver(mutations => {
|
||||
mutations.forEach(({ addedNodes, removedNodes }) => {
|
||||
addedNodes.forEach(observePost)
|
||||
removedNodes.forEach(unobservePost)
|
||||
@@ -176,7 +176,7 @@
|
||||
bind:restore={postFeeds.value[feedId].clientData}
|
||||
bind:this={listComp}
|
||||
>
|
||||
{#snippet item(_, row, __)}
|
||||
{#snippet item(row)}
|
||||
<li
|
||||
data-index={row}
|
||||
style={row < 7 ? `--anim-delay: ${row * 100}ms` : ''}
|
||||
@@ -238,7 +238,6 @@
|
||||
<div style="border-top-width: 0">
|
||||
<EndPlaceholder>
|
||||
{$t('routes.frontpage.endFeed', {
|
||||
// @ts-ignore
|
||||
community_name: feedData.community_name ?? 'undefined',
|
||||
})}
|
||||
{#snippet action()}
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export type PostViewWithCrossposts = PostView & {
|
||||
withCrossposts: true
|
||||
crossposts: PostView[]
|
||||
}
|
||||
export type PostViewWithoutCrossposts = PostView & { withCrossposts?: false }
|
||||
const addCrosspostProperty = (
|
||||
post: PostView,
|
||||
crossposts: PostView[],
|
||||
): PostViewWithCrossposts => ({
|
||||
...post,
|
||||
crossposts: crossposts,
|
||||
withCrossposts: true,
|
||||
})
|
||||
|
||||
export const combineCrossposts = (
|
||||
posts: PostView[],
|
||||
@@ -26,7 +17,7 @@ export const combineCrossposts = (
|
||||
const results: (PostViewWithCrossposts | PostViewWithoutCrossposts)[] = []
|
||||
const seenUrls = new Set<string>()
|
||||
|
||||
posts?.forEach((post) => {
|
||||
posts?.forEach(post => {
|
||||
if (
|
||||
!post ||
|
||||
(settings.hidePosts.deleted && post.post.deleted) ||
|
||||
@@ -38,7 +29,7 @@ export const combineCrossposts = (
|
||||
return
|
||||
}
|
||||
|
||||
let existing = urlMap.get(post.post.url)
|
||||
const existing = urlMap.get(post.post.url)
|
||||
if (existing) {
|
||||
existing.withCrossposts = true
|
||||
if (existing.withCrossposts) {
|
||||
|
||||
@@ -1,40 +1,44 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy'
|
||||
import { preventDefault, run } from 'svelte/legacy'
|
||||
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
|
||||
import { client, site } from '$lib/lemmy.svelte.js'
|
||||
import type { Community, Post, PostView } from 'lemmy-js-client'
|
||||
import { Select, Spinner, Switch, toast } from 'mono-svelte'
|
||||
import {
|
||||
Icon,
|
||||
Photo,
|
||||
ArrowPath,
|
||||
Sparkles,
|
||||
ChatBubbleBottomCenterText,
|
||||
Plus,
|
||||
Language,
|
||||
Link,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { placeholders, uploadImage } from '$lib/util.svelte.js'
|
||||
import { Checkbox, TextInput } from 'mono-svelte'
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { slide } from 'svelte/transition'
|
||||
import { feature } from '$lib/version'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import ErrorContainer, {
|
||||
clearErrorScope,
|
||||
pushError,
|
||||
} from '$lib/components/error/ErrorContainer.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import FreeTextInput from '$lib/components/input/FreeTextInput.svelte'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client, site } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
import { placeholders } from '$lib/util.svelte.js'
|
||||
import type { Community, Post, PostView } from 'lemmy-js-client'
|
||||
import {
|
||||
Button,
|
||||
Select,
|
||||
Spinner,
|
||||
Switch,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import {
|
||||
ArrowPath,
|
||||
ChatBubbleBottomCenterText,
|
||||
Icon,
|
||||
Language,
|
||||
Link,
|
||||
Photo,
|
||||
Plus,
|
||||
Sparkles,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons'
|
||||
import { slide } from 'svelte/transition'
|
||||
|
||||
interface Props {
|
||||
edit?: boolean
|
||||
@@ -82,7 +86,6 @@
|
||||
let data = $state(passedData)
|
||||
|
||||
// weird select menu language handling
|
||||
// @ts-ignore
|
||||
$effect(() => {
|
||||
if (data.language_id === '') data.language_id = undefined
|
||||
})
|
||||
@@ -100,7 +103,6 @@
|
||||
data.nsfw = editingPost.nsfw
|
||||
data.alt_text = editingPost.alt_text
|
||||
data.thumbnail = editingPost.thumbnail_url
|
||||
// @ts-ignore
|
||||
data.language_id = editingPost.language_id.toString()
|
||||
}
|
||||
|
||||
@@ -115,12 +117,12 @@
|
||||
limit: 40,
|
||||
})
|
||||
|
||||
communities = list.communities.map((c) => c.community)
|
||||
communities = list.communities.map(c => c.community)
|
||||
}
|
||||
})
|
||||
|
||||
onDestroy(() => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error TODO get rid of sessionStorage stuff
|
||||
if (saveDraft) setSessionStorage('postDraft', data)
|
||||
})
|
||||
|
||||
@@ -137,7 +139,7 @@
|
||||
if (data.url && data.url != '') {
|
||||
try {
|
||||
new URL(data.url)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
pushError({
|
||||
message: $t('toast.invalidURL'),
|
||||
scope: 'post-form',
|
||||
@@ -190,7 +192,7 @@
|
||||
onsubmit?.(post.post_view)
|
||||
}
|
||||
} catch (err) {
|
||||
pushError({ message: errorMessage(err as any), scope: 'post-form' })
|
||||
pushError({ message: errorMessage(err as string), scope: 'post-form' })
|
||||
data.loading = false
|
||||
}
|
||||
}
|
||||
@@ -212,7 +214,7 @@
|
||||
if (res.metadata.description)
|
||||
data.body = res.metadata.description
|
||||
.split('\n')
|
||||
.map((l) => `> ${l}`)
|
||||
.map(l => `> ${l}`)
|
||||
.join('\n')
|
||||
|
||||
toast({
|
||||
@@ -221,7 +223,7 @@
|
||||
action: () => (data = oldData),
|
||||
duration: 15 * 1000,
|
||||
})
|
||||
} catch (e) {
|
||||
} catch {
|
||||
pushError({
|
||||
message: $t('toast.failGenerateTitle'),
|
||||
scope: 'post-form',
|
||||
@@ -234,7 +236,7 @@
|
||||
if (!url) return false
|
||||
try {
|
||||
new URL(url)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -258,7 +260,7 @@
|
||||
<UploadModal
|
||||
bind:open={uploadingImage}
|
||||
multiple={false}
|
||||
onupload={(e) => {
|
||||
onupload={e => {
|
||||
if (e) data.url = e[0]
|
||||
uploadingImage = false
|
||||
}}
|
||||
@@ -282,7 +284,7 @@
|
||||
listing_type="All"
|
||||
label={$t('form.post.community')}
|
||||
required
|
||||
onselect={(e) => {
|
||||
onselect={e => {
|
||||
const c = e
|
||||
if (!c) {
|
||||
data.community = null
|
||||
@@ -399,7 +401,9 @@
|
||||
const url = new URL(await navigator.clipboard.readText())
|
||||
|
||||
data.url = url.toString()
|
||||
} catch (e) {}
|
||||
} catch {
|
||||
/* empty */
|
||||
}
|
||||
}}
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
@@ -472,9 +476,9 @@
|
||||
toast({ content: $t('toast.restoredFromDraft') })
|
||||
const draft = getSessionStorage('postDraft')
|
||||
if (draft && !edit) {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error TODO get rid of session storage
|
||||
draft.loading = false
|
||||
// @ts-ignore
|
||||
// @ts-expect-error TODO get rid of session storage
|
||||
data = draft
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
import type { View } from '$lib/settings.svelte'
|
||||
import { isImage, isVideo } from '$lib/ui/image'
|
||||
import { canParseUrl, findClosestNumber } from '$lib/util.svelte'
|
||||
import type { CommentView, PersonView, Post, PostView } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
import type { CommentView, PersonView, Post } from 'lemmy-js-client'
|
||||
|
||||
export const isCommentMutable = (comment: CommentView, me: PersonView) =>
|
||||
me.person.id == comment.creator.id
|
||||
@@ -15,6 +12,9 @@ export const bestImageURL = (
|
||||
compact: boolean = true,
|
||||
width: number = 1024,
|
||||
) => {
|
||||
if (compact) {
|
||||
/* empty */
|
||||
}
|
||||
if (post.url) return optimizeImageURL(post.url, width)
|
||||
else if (post.thumbnail_url)
|
||||
return optimizeImageURL(post.thumbnail_url, width)
|
||||
@@ -67,7 +67,7 @@ export const postLink = (post: Post) =>
|
||||
export type MediaType = 'video' | 'image' | 'iframe' | 'embed' | 'none'
|
||||
export type IframeType = 'youtube' | 'video' | 'none'
|
||||
|
||||
export const mediaType = (url?: string, view: View = 'cozy'): MediaType => {
|
||||
export const mediaType = (url?: string): MediaType => {
|
||||
if (url) {
|
||||
if (isImage(url)) return 'image'
|
||||
if (isVideo(url)) return 'iframe'
|
||||
@@ -89,7 +89,7 @@ export async function hidePost(
|
||||
hide: boolean,
|
||||
jwt: string,
|
||||
): Promise<boolean> {
|
||||
const res = await client({ auth: jwt }).hidePost({
|
||||
await client({ auth: jwt }).hidePost({
|
||||
hide: hide,
|
||||
post_ids: [id],
|
||||
})
|
||||
|
||||
@@ -1,31 +1,22 @@
|
||||
<script lang="ts">
|
||||
import Link, { parseURL } from '$lib/components/input/Link.svelte'
|
||||
import { Button, Material } from 'mono-svelte'
|
||||
import {
|
||||
CheckBadge,
|
||||
ChevronDown,
|
||||
Icon,
|
||||
Link as LinkIcon,
|
||||
} from 'svelte-hero-icons'
|
||||
import { optimizeImageURL } from '../helpers'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { parseURL } from '$lib/components/input/Link.svelte'
|
||||
import type { View } from '$lib/settings.svelte'
|
||||
import { Button, Material } from 'mono-svelte'
|
||||
import { optimizeImageURL } from '../helpers'
|
||||
|
||||
interface Props {
|
||||
url: string
|
||||
thumbnail_url?: string | undefined
|
||||
thumbnail_url?: string
|
||||
nsfw?: boolean
|
||||
embed_title?: string | undefined
|
||||
embed_description?: string | undefined
|
||||
embed_title?: string
|
||||
view?: View
|
||||
}
|
||||
|
||||
let {
|
||||
url,
|
||||
thumbnail_url = undefined,
|
||||
thumbnail_url,
|
||||
nsfw = false,
|
||||
embed_title = undefined,
|
||||
embed_description = undefined,
|
||||
embed_title,
|
||||
view = 'cozy',
|
||||
}: Props = $props()
|
||||
|
||||
|
||||
@@ -27,15 +27,14 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import {
|
||||
Icon,
|
||||
PuzzlePiece,
|
||||
VideoCamera,
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons'
|
||||
import { optimizeImageURL, type IframeType, type MediaType } from '../helpers'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { get } from 'svelte/store'
|
||||
import { optimizeImageURL, type IframeType } from '../helpers'
|
||||
|
||||
const urlToEmbed = (inputUrl: string) => {
|
||||
if (type == 'video') {
|
||||
@@ -89,7 +88,7 @@
|
||||
type?: IframeType
|
||||
thumbnail?: string | undefined
|
||||
url: string
|
||||
opened?: any
|
||||
opened?: boolean
|
||||
autoplay?: boolean
|
||||
class?: string
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { stopPropagation } from 'svelte/legacy'
|
||||
|
||||
import { settings, type View } from '$lib/settings.svelte'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import { bestImageURL, postLink } from '../helpers'
|
||||
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import { Button, modal } from 'mono-svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import { bestImageURL, postLink } from '../helpers'
|
||||
|
||||
interface Props {
|
||||
post: Post
|
||||
@@ -54,7 +52,6 @@
|
||||
srcset={bestImageURL(post, false, 1536)}
|
||||
media="(max-width: 1024px)"
|
||||
/>
|
||||
<!-- svelte-ignore a11y_missing_attribute -->
|
||||
<img
|
||||
src={bestImageURL(post, false, -1)}
|
||||
loading="lazy"
|
||||
@@ -74,11 +71,11 @@
|
||||
class="absolute bottom-0 left-0 right-0 flex justify-between items-center
|
||||
rounded-full ml-auto w-max m-2 p-0 gap-1
|
||||
*:bg-white *:border *:border-slate-200 dark:*:border-zinc-800 dark:*:bg-zinc-900"
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
onclick={e => e.stopPropagation()}
|
||||
>
|
||||
{#if post.alt_text}
|
||||
<Button
|
||||
onclick={(e) => {
|
||||
onclick={e => {
|
||||
e.stopPropagation()
|
||||
modal({
|
||||
title: 'Alt',
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
<script lang="ts">
|
||||
import Empty from '$lib/components/helper/Empty.svelte'
|
||||
import PostLink from '$lib/components/lemmy/post/link/PostLink.svelte'
|
||||
import {
|
||||
bestImageURL,
|
||||
postLink,
|
||||
type MediaType,
|
||||
iframeType,
|
||||
type MediaType,
|
||||
} from '$lib/components/lemmy/post/helpers.js'
|
||||
import ExpandableImage, {
|
||||
showImage,
|
||||
} from '$lib/components/ui/ExpandableImage.svelte'
|
||||
import PostLink from '$lib/components/lemmy/post/link/PostLink.svelte'
|
||||
import { settings, type View } from '$lib/settings.svelte.js'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import PostIframe from './PostIframe.svelte'
|
||||
import { Button, Material, modal } from 'mono-svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import { ArrowDownTray, Icon } from 'svelte-hero-icons'
|
||||
import PostImage from './PostImage.svelte'
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -7,17 +7,16 @@
|
||||
} from '$lib/components/lemmy/post/helpers.js'
|
||||
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
|
||||
import { settings, type View } from '$lib/settings.svelte.js'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { isImage } from '$lib/ui/image'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import { Material, modal, Popover } from 'mono-svelte'
|
||||
import { modal } from 'mono-svelte'
|
||||
import Button from 'mono-svelte/button/Button.svelte'
|
||||
import {
|
||||
DocumentText,
|
||||
ExclamationTriangle,
|
||||
Icon,
|
||||
Link,
|
||||
VideoCamera,
|
||||
ExclamationTriangle,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
const thumbnailSize = (view: View) =>
|
||||
@@ -68,6 +67,7 @@
|
||||
}}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
{#if post.thumbnail_url || isImage(post.url)}
|
||||
<div class="relative overflow-hidden rounded-xl">
|
||||
@@ -75,16 +75,20 @@
|
||||
<img
|
||||
src={optimizeImageURL(post.thumbnail_url || post.url || '', 256)}
|
||||
loading="lazy"
|
||||
class="object-cover relative overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl
|
||||
transition-colors {size}"
|
||||
class={[
|
||||
'object-cover relative overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl transition-colors',
|
||||
size,
|
||||
]}
|
||||
alt={post.alt_text ?? ' '}
|
||||
class:blur-xl={blur}
|
||||
/>
|
||||
{#if type != 'image'}
|
||||
<div
|
||||
class="absolute w-8 h-8 m-1 bottom-0 left-0 rounded-xl text-slate-800 dark:text-zinc-200
|
||||
bg-slate-25 dark:bg-zinc-900 border border-slate-200 dark:border-zinc-700
|
||||
grid place-items-center"
|
||||
class={[
|
||||
'absolute w-8 h-8 m-1 bottom-0 left-0 rounded-xl text-slate-800 dark:text-zinc-200',
|
||||
'bg-slate-25 dark:bg-zinc-900 border border-slate-200 dark:border-zinc-700',
|
||||
'grid place-items-center',
|
||||
]}
|
||||
>
|
||||
<Icon
|
||||
src={type == 'iframe' ? VideoCamera : Link}
|
||||
@@ -109,10 +113,13 @@
|
||||
{/if}
|
||||
{:else}
|
||||
<div
|
||||
class="object-cover overflow-hidden bg-slate-50 dark:bg-zinc-900 rounded-xl
|
||||
border border-slate-200 dark:border-zinc-800 group-hover/media:border-slate-400
|
||||
dark:group-hover/media:border-zinc-600 transition-colors text-slate-400 dark:text-zinc-600 grid
|
||||
place-items-center {size}"
|
||||
class={[
|
||||
'object-cover overflow-hidden bg-slate-50 dark:bg-zinc-900 rounded-xl',
|
||||
'border border-slate-200 dark:border-zinc-800 group-hover/media:border-slate-400',
|
||||
'dark:group-hover/media:border-zinc-600 transition-colors text-slate-400 dark:text-zinc-600 grid',
|
||||
'place-items-center',
|
||||
size,
|
||||
]}
|
||||
>
|
||||
<Icon
|
||||
src={type == 'embed'
|
||||
|
||||
Reference in new issue
Block a user