---
import type Thread from '../models/Thread';
import Post from './Post.astro';
import Image from './Image.astro';
export interface Props {
thread: Thread;
board: string;
}
const { thread, board } = Astro.props;
let replies: string[] = [];
const listReplies = (id: string, getReplies: boolean = false): any => {
if(getReplies) return replies;
replies = [];
thread.comments.forEach(comment => {
if(comment.content.includes(id))
replies.push(comment.id);
})
if(replies.length <= 0) return false;
return true;
}
---
{(thread.id != "rules") && ( <>
{thread.comments != undefined && (listReplies(thread.id) && (
{listReplies(thread.id, true).map((id) => ( <>
>>{id}
> ))}
))}
{thread.title}
{thread.comments != undefined && ( <>
{thread.comments.map((comment) => ( <>
> ))}
> )}
> )}
{thread.comments != undefined && ( <>
> )}