Add: Comment tags
This commit is contained in:
parent
4bcd3b563e
commit
b941edaa1c
@ -7,12 +7,19 @@
|
|||||||
/**
|
/**
|
||||||
* @type {import("$types/base").CommentTreeNode}
|
* @type {import("$types/base").CommentTreeNode}
|
||||||
*/
|
*/
|
||||||
export let commentNode;
|
export let commentNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {(function(import("$types/base").Comment): string[]) | undefined}
|
||||||
|
*/
|
||||||
|
export let getTags = undefined;
|
||||||
|
|
||||||
$: comment = commentNode.parent;
|
$: comment = commentNode.parent;
|
||||||
|
|
||||||
|
$: tags = getTags ? getTags(comment) : [];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style lang="scss">
|
||||||
.message {
|
.message {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row nowrap;
|
flex-flow: row nowrap;
|
||||||
@ -31,6 +38,17 @@
|
|||||||
flex-flow: row nowrap;
|
flex-flow: row nowrap;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nameField {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row nowrap;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
& > .tag {
|
||||||
|
color: var(--white-dim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.date {
|
.date {
|
||||||
@ -42,17 +60,26 @@
|
|||||||
<Avatar size={48}></Avatar>
|
<Avatar size={48}></Avatar>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="topBar">
|
<div class="topBar">
|
||||||
<Mention user={comment.author}></Mention>
|
<div class="nameField">
|
||||||
|
<Mention user={comment.author}></Mention>
|
||||||
|
{#each tags as tag}
|
||||||
|
<span class="tag typeContent">{tag}</span>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
<span class="date">{moment(comment.commentDate).fromNow()}</span>
|
<span class="date">{moment(comment.commentDate).fromNow()}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>{comment.content}</p>
|
<p>{comment.content}</p>
|
||||||
|
|
||||||
<div class="actionBar">
|
<div class="actionBar">
|
||||||
<Rating rating={comment.rating}></Rating>
|
<Rating rating={comment.rating}></Rating>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="replyTree">
|
<div class="replyTree">
|
||||||
{#each commentNode.children as reply}
|
{#each commentNode.children as reply}
|
||||||
<svelte:self commentNode={reply}></svelte:self>
|
<svelte:self commentNode={reply} getTags={getTags}></svelte:self>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -89,7 +89,12 @@
|
|||||||
|
|
||||||
<div class="commentList">
|
<div class="commentList">
|
||||||
{#each commentTree as reply}
|
{#each commentTree as reply}
|
||||||
<Comment commentNode={reply}></Comment>
|
<Comment commentNode={reply} getTags={(comment) => {
|
||||||
|
if (comment.author?.id == post.author?.id) {
|
||||||
|
return ["OP"];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}}></Comment>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user