83 lines
2.3 KiB
Svelte
83 lines
2.3 KiB
Svelte
<script lang="ts">
|
|
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
|
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
|
import { publishedToDate } from '$lib/components/util/date.js'
|
|
import { t } from '$lib/i18n/translations'
|
|
import { settings, type View } from '$lib/settings.svelte.js'
|
|
import type { CommentView } from 'lemmy-js-client'
|
|
import { Button, Material } from 'mono-svelte'
|
|
import { ArrowUturnUp, Icon } from 'svelte-hero-icons'
|
|
|
|
interface Props {
|
|
comment: CommentView
|
|
view?: View
|
|
community?: boolean
|
|
meta?: boolean
|
|
class?: string
|
|
commentClass?: string
|
|
}
|
|
|
|
let {
|
|
comment,
|
|
view = settings.view,
|
|
community = false,
|
|
meta = true,
|
|
class: clazz = '',
|
|
commentClass = '',
|
|
...rest
|
|
}: Props = $props()
|
|
</script>
|
|
|
|
<Material
|
|
class="flex flex-col flex-1 rounded-none
|
|
{view == 'compact' ? 'py-4' : 'py-5'} {clazz}"
|
|
color="none"
|
|
padding="none"
|
|
>
|
|
{#if meta}
|
|
<div class="flex flex-row justify-between items-center gap-2">
|
|
<div class="flex flex-col gap-2">
|
|
<PostMeta
|
|
badges={{
|
|
nsfw: comment.post.nsfw,
|
|
removed: comment.post.removed,
|
|
admin: false,
|
|
moderator: false,
|
|
saved: false,
|
|
deleted: comment.post.deleted,
|
|
featured:
|
|
comment.post.featured_community || comment.post.featured_local,
|
|
locked: comment.post.locked,
|
|
}}
|
|
published={publishedToDate(comment.comment.published)}
|
|
community={community ? comment.community : undefined}
|
|
title={comment.post.name}
|
|
id={comment.post.id}
|
|
titleClass="text-sm"
|
|
/>
|
|
</div>
|
|
<Button
|
|
color="primary"
|
|
rounding="pill"
|
|
size="sm"
|
|
href="/post/{comment.post.id}?thread={comment.comment.path}#{comment
|
|
.comment.id}"
|
|
class="self-start"
|
|
>
|
|
{$t('common.jump')}
|
|
<Icon src={ArrowUturnUp} size="14" micro />
|
|
</Button>
|
|
</div>
|
|
{/if}
|
|
<div class="list-none">
|
|
<Comment
|
|
postId={comment.post.id}
|
|
node={{ children: [], comment_view: comment, depth: 1, expanded: true }}
|
|
replying={false}
|
|
{meta}
|
|
{...rest}
|
|
class={commentClass}
|
|
/>
|
|
</div>
|
|
</Material>
|