From 9dfd6aa77518b3a1e6bfd926a3b7719c32a8c97f Mon Sep 17 00:00:00 2001 From: kartofen Date: Mon, 24 Oct 2022 23:19:33 +0300 Subject: use the new api --- src/components/Thread.astro | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/components/Thread.astro') diff --git a/src/components/Thread.astro b/src/components/Thread.astro index 6fae3de..7b60227 100644 --- a/src/components/Thread.astro +++ b/src/components/Thread.astro @@ -6,10 +6,9 @@ import Image from './Image.astro'; export interface Props { thread: Thread; board: string; - comments: boolean; } -const { thread, board, comments = false } = Astro.props; +const { thread, board } = Astro.props; let replies: string[] = []; const listReplies = (id: string, getReplies: boolean = false): any => { @@ -17,7 +16,7 @@ const listReplies = (id: string, getReplies: boolean = false): any => { replies = []; thread.comments.forEach(comment => { - if(comment.commentText.includes(id)) + if(comment.content.includes(id)) replies.push(comment.id); }) @@ -27,9 +26,9 @@ const listReplies = (id: string, getReplies: boolean = false): any => { --- {(thread.id != "rules") && ( <> - + - {comments && (listReplies(thread.id) && ( + {thread.comments != undefined && (listReplies(thread.id) && ( {listReplies(thread.id, true).map((id) => ( <> >>{id} @@ -38,13 +37,13 @@ const listReplies = (id: string, getReplies: boolean = false): any => { ))} -

{thread.threadName}

- -

+

{thread.title}

+ +

- {comments && ( <> + {thread.comments != undefined && ( <> {thread.comments.map((comment) => ( <> - + {listReplies(comment.id) && ( @@ -54,8 +53,8 @@ const listReplies = (id: string, getReplies: boolean = false): any => {


)} - -

+ +

))} @@ -64,7 +63,7 @@ const listReplies = (id: string, getReplies: boolean = false): any => { )} -{comments && ( <> +{thread.comments != undefined && ( <>