aboutsummaryrefslogtreecommitdiff
path: root/src/components/Thread.astro
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-10-24 23:19:33 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-10-24 23:19:33 +0300
commit9dfd6aa77518b3a1e6bfd926a3b7719c32a8c97f (patch)
treed10fc76ef816160871e3955aa75821bc5d5088d4 /src/components/Thread.astro
parent4ca81621e5b31922565b4149ebad1deb5161071a (diff)
use the new api
Diffstat (limited to 'src/components/Thread.astro')
-rw-r--r--src/components/Thread.astro25
1 files changed, 12 insertions, 13 deletions
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") && ( <>
- <Post id={thread.id} date={thread.creationDate} creator={thread.threadCreator} box="threadbox" board={(!comments) ? board : ''}>
+ <Post id={thread.id} date={thread.timestamp} box="threadbox" board={(thread.comments == undefined) ? board : ''}>
- {comments && (listReplies(thread.id) && (
+ {thread.comments != undefined && (listReplies(thread.id) && (
<span class="small-mono">
{listReplies(thread.id, true).map((id) => ( <>
<a href=`/board/${board}/${thread.id}#${id}` onmouseover=`onMouseOver('${id}')` onmouseleave=`onMouseLeave('${id}')`>>>{id}</a>&#65279;
@@ -38,13 +37,13 @@ const listReplies = (id: string, getReplies: boolean = false): any => {
))}
- <h3>{thread.threadName}</h3>
- <Image image={thread.imageId} fileType={thread.fileType} />
- <p set:html={thread.threadText} />
+ <h3>{thread.title}</h3>
+ <Image image={thread.image} fileType={thread.imagetype} />
+ <p set:html={thread.content} />
- {comments && ( <>
+ {thread.comments != undefined && ( <>
{thread.comments.map((comment) => ( <>
- <Post id={comment.id} date={comment.creationDate} creator={comment.commentCreator} box="commentbox">
+ <Post id={comment.id} date={comment.timestamp} box="commentbox">
{listReplies(comment.id) && (
<span class="small-mono">
@@ -54,8 +53,8 @@ const listReplies = (id: string, getReplies: boolean = false): any => {
</span> <hr>
)}
- <Image image={comment.imageId} fileType={comment.fileType} />
- <p set:html={comment.commentText} />
+ <Image image={comment.image} fileType={comment.imagetype} />
+ <p set:html={comment.content} />
</Post>
</> ))}
@@ -64,7 +63,7 @@ const listReplies = (id: string, getReplies: boolean = false): any => {
</Post>
</> )}
-{comments && ( <>
+{thread.comments != undefined && ( <>
<script is:inline>
function onMouseOver(id) {
document.getElementById(id).classList.add('targeted');