From 44121696027dacafbc8566a426be285f108631a7 Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Sun, 9 Jul 2023 15:50:34 -0700 Subject: [PATCH] feat: Add comment scores --- .../components/lemmy/comment/Comment.svelte | 23 +++++++++++-------- src/routes/post/[instance]/[id]/+page.svelte | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index 8de0ea7a..5855d859 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -9,18 +9,14 @@ Minus, Plus, } from 'svelte-hero-icons' - import Avatar from '$lib/components/ui/Avatar.svelte' import type { CommentNodeI } from './comments' - import SvelteMarkdown from 'svelte-markdown' import RelativeDate from '$lib/components/util/RelativeDate.svelte' - import { getClient, authData } from '$lib/lemmy.js' import { Color } from '$lib/ui/colors.js' import CommentForm from './CommentForm.svelte' import { page } from '$app/stores' import UserLink from '$lib/components/user/UserLink.svelte' import Markdown from '$lib/components/markdown/Markdown.svelte' import CommentVote from '$lib/components/lemmy/comment/CommentVote.svelte' - import Button from '$lib/components/input/Button.svelte' export let node: CommentNodeI export let postId: number @@ -40,7 +36,7 @@ >
@@ -48,8 +44,17 @@ OP {/if} - + + • + + {Math.floor( + (node.comment_view.counts.upvotes / + (node.comment_view.counts.upvotes + + node.comment_view.counts.downvotes)) * + 100 + )}% + -
+
diff --git a/src/routes/post/[instance]/[id]/+page.svelte b/src/routes/post/[instance]/[id]/+page.svelte index b39fd724..e45a30c2 100644 --- a/src/routes/post/[instance]/[id]/+page.svelte +++ b/src/routes/post/[instance]/[id]/+page.svelte @@ -93,7 +93,7 @@ {#if post.body}