feat: Add comment scores
This commit is contained in:
1 parent
981d1581a4
commit
4412169602
2 files changed
+15
-10
No files matched your search
@@ -9,18 +9,14 @@
|
|||||||
Minus,
|
Minus,
|
||||||
Plus,
|
Plus,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
|
||||||
import type { CommentNodeI } from './comments'
|
import type { CommentNodeI } from './comments'
|
||||||
import SvelteMarkdown from 'svelte-markdown'
|
|
||||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||||
import { getClient, authData } from '$lib/lemmy.js'
|
|
||||||
import { Color } from '$lib/ui/colors.js'
|
import { Color } from '$lib/ui/colors.js'
|
||||||
import CommentForm from './CommentForm.svelte'
|
import CommentForm from './CommentForm.svelte'
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
import UserLink from '$lib/components/user/UserLink.svelte'
|
import UserLink from '$lib/components/user/UserLink.svelte'
|
||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
import CommentVote from '$lib/components/lemmy/comment/CommentVote.svelte'
|
import CommentVote from '$lib/components/lemmy/comment/CommentVote.svelte'
|
||||||
import Button from '$lib/components/input/Button.svelte'
|
|
||||||
|
|
||||||
export let node: CommentNodeI
|
export let node: CommentNodeI
|
||||||
export let postId: number
|
export let postId: number
|
||||||
@@ -40,7 +36,7 @@
|
|||||||
>
|
>
|
||||||
<details bind:open class="flex flex-col gap-1">
|
<details bind:open class="flex flex-col gap-1">
|
||||||
<summary
|
<summary
|
||||||
class="flex flex-row cursor-pointer arrow gap-2 items-center group text-xs"
|
class="flex flex-row cursor-pointer gap-2 items-center group text-xs"
|
||||||
>
|
>
|
||||||
<span class:font-bold={op} class="flex flex-row gap-1 items-center">
|
<span class:font-bold={op} class="flex flex-row gap-1 items-center">
|
||||||
<UserLink avatarSize={20} avatar user={node.comment_view.creator} />
|
<UserLink avatarSize={20} avatar user={node.comment_view.creator} />
|
||||||
@@ -48,8 +44,17 @@
|
|||||||
<span class="text-sky-500">OP</span>
|
<span class="text-sky-500">OP</span>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
<span class="opacity-60">
|
<span class="opacity-60 flex flex-row gap-1">
|
||||||
<RelativeDate date={new Date(node.comment_view.comment.published)} />
|
<RelativeDate date={new Date(node.comment_view.comment.published)} />
|
||||||
|
<span>•</span>
|
||||||
|
<span>
|
||||||
|
{Math.floor(
|
||||||
|
(node.comment_view.counts.upvotes /
|
||||||
|
(node.comment_view.counts.upvotes +
|
||||||
|
node.comment_view.counts.downvotes)) *
|
||||||
|
100
|
||||||
|
)}%
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
class="ml-auto translate-x-1 opacity-0
|
class="ml-auto translate-x-1 opacity-0
|
||||||
@@ -68,10 +73,10 @@
|
|||||||
</span>
|
</span>
|
||||||
</summary>
|
</summary>
|
||||||
<div
|
<div
|
||||||
class="flex flex-col gap-1 whitespace-pre-wrap
|
class="flex flex-col whitespace-pre-wrap
|
||||||
max-w-full"
|
max-w-full gap-1"
|
||||||
>
|
>
|
||||||
<div class="max-w-full break-words text-sm leading-6">
|
<div class="max-w-full mt-0.5 break-words text-sm leading-[22px]">
|
||||||
<Markdown source={node.comment_view.comment.content} />
|
<Markdown source={node.comment_view.comment.content} />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row gap-2 items-center mt-1 h-[26px]">
|
<div class="flex flex-row gap-2 items-center mt-1 h-[26px]">
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
{#if post.body}
|
{#if post.body}
|
||||||
<p
|
<p
|
||||||
class="bg-slate-100 border border-slate-200 dark:border-zinc-800
|
class="bg-slate-100 border border-slate-200 dark:border-zinc-800
|
||||||
dark:bg-zinc-900 p-2 text-sm rounded-md leading-6"
|
dark:bg-zinc-900 p-2 text-sm rounded-md leading-[22px]"
|
||||||
>
|
>
|
||||||
<Markdown source={post.body} />
|
<Markdown source={post.body} />
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in new issue
Block a user