Ratings
This commit is contained in:
parent
2781724f8f
commit
b36379c044
@ -1,13 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import Rating from "./rating.svelte";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("$types/base").CommentTreeNode}
|
* @type {import("$types/base").CommentTreeNode}
|
||||||
*/
|
*/
|
||||||
export let commentNode;
|
export let commentNode;
|
||||||
|
|
||||||
|
$: comment = commentNode.parent;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h5>{commentNode.parent.author?.name}</h5>
|
<h5>{comment.author?.name}</h5>
|
||||||
<p>{commentNode.parent.content}</p>
|
<Rating rating={comment.rating}></Rating>
|
||||||
|
<p>{comment.content}</p>
|
||||||
<div>
|
<div>
|
||||||
{#each commentNode.children as reply}
|
{#each commentNode.children as reply}
|
||||||
<svelte:self commentNode={reply}></svelte:self>
|
<svelte:self commentNode={reply}></svelte:self>
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import Rating from './rating.svelte';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import('$types/base').Post}
|
* @type {import('$types/base').Post}
|
||||||
*/
|
*/
|
||||||
@ -7,6 +9,8 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a href="/posts/{post.id}">{post.name}</a>
|
<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>
|
<p>{post.content}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
11
src/comp/rating.svelte
Normal file
11
src/comp/rating.svelte
Normal 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>
|
||||||
Loading…
x
Reference in New Issue
Block a user