diff --git a/apps/admin-x-activitypub/src/components/Inbox.tsx b/apps/admin-x-activitypub/src/components/Inbox.tsx index cc9ea316bf..8bf95cbf9a 100644 --- a/apps/admin-x-activitypub/src/components/Inbox.tsx +++ b/apps/admin-x-activitypub/src/components/Inbox.tsx @@ -50,7 +50,7 @@ const Inbox: React.FC = ({}) => { const handleViewContent = (object: ObjectProperties, actor: ActorProperties, comments: Activity[]) => { setArticleContent(object); setArticleActor(actor); - NiceModal.show(ArticleModal, {object, actor, comments}); + NiceModal.show(ArticleModal, {object, actor, comments, allComments: commentsMap}); }; const handleLayoutChange = (newLayout: string) => { diff --git a/apps/admin-x-activitypub/src/components/feed/ArticleModal.tsx b/apps/admin-x-activitypub/src/components/feed/ArticleModal.tsx index 4f928bd7cf..f2dd167388 100644 --- a/apps/admin-x-activitypub/src/components/feed/ArticleModal.tsx +++ b/apps/admin-x-activitypub/src/components/feed/ArticleModal.tsx @@ -15,6 +15,7 @@ interface ArticleModalProps { object: ObjectProperties; actor: ActorProperties; comments: Activity[]; + allComments: Map; } const ArticleBody: React.FC<{heading: string, image: string|undefined, html: string}> = ({heading, image, html}) => { @@ -68,7 +69,11 @@ ${image && ); }; -const ArticleModal: React.FC = ({object, actor, comments}) => { +const FeedItemDivider: React.FC = () => ( +
+); + +const ArticleModal: React.FC = ({object, actor, comments, allComments}) => { const modal = useModal(); return ( = ({object, actor, comments}) => */} - {comments.map((comment, index) => ( - - ))} - )} + {comments.map((comment, index) => { + const showDivider = index !== comments.length - 1; + const nestedComments = allComments.get(comment.object.id) ?? []; + const hasNestedComments = nestedComments.length > 0; + + return ( + <> + + {hasNestedComments && } + {nestedComments.map((nestedComment, nestedCommentIndex) => ( + + ))} + {showDivider && } + + ); + })} + + )} {object.type === 'Article' && ( )}