This commit is contained in:
Donatas Kirda 2024-05-10 10:51:10 +03:00
parent 2781724f8f
commit b36379c044
Signed by: bloodwiing
GPG Key ID: 63020D8D3F4A164F
3 changed files with 23 additions and 3 deletions

View File

@ -1,13 +1,18 @@
<script>
import Rating from "./rating.svelte";
/**
* @type {import("$types/base").CommentTreeNode}
*/
export let commentNode;
$: comment = commentNode.parent;
</script>
<div>
<h5>{commentNode.parent.author?.name}</h5>
<p>{commentNode.parent.content}</p>
<h5>{comment.author?.name}</h5>
<Rating rating={comment.rating}></Rating>
<p>{comment.content}</p>
<div>
{#each commentNode.children as reply}
<svelte:self commentNode={reply}></svelte:self>

View File

@ -1,4 +1,6 @@
<script>
import Rating from './rating.svelte';
/**
* @type {import('$types/base').Post}
*/
@ -7,6 +9,8 @@
<div>
<a href="/posts/{post.id}">{post.name}</a>
<!-- <p>{post.author.name}</p> -->
<p>{post.author?.name}</p>
<p>{post.category.name}</p>
<Rating rating={post.rating}></Rating>
<p>{post.content}</p>
</div>

11
src/comp/rating.svelte Normal file
View File

@ -0,0 +1,11 @@
<script>
/**
* @type {import("$types/base").Rating}
*/
export let rating;
</script>
<div>
<p>up: {rating.likes}</p>
<p>down: {rating.dislikes}</p>
</div>