From 37729c715d75e3b6b9eb34495b5ec63380922cee Mon Sep 17 00:00:00 2001 From: celine Date: Fri, 23 Jan 2026 23:41:13 -0500 Subject: [PATCH] refactor the bskypostcontent to use booleans for reply and quote rather than functions, include its own reply line, some renaming of variables to be more consistant --- .../[rkey]/BlueskyQuotesPage.tsx | 2 + .../[publication]/[rkey]/BskyPostContent.tsx | 180 ++++++++++-------- .../[rkey]/Interactions/Quotes.tsx | 3 +- .../[did]/[publication]/[rkey]/ThreadPage.tsx | 33 ++-- 4 files changed, 118 insertions(+), 100 deletions(-) diff --git a/app/lish/[did]/[publication]/[rkey]/BlueskyQuotesPage.tsx b/app/lish/[did]/[publication]/[rkey]/BlueskyQuotesPage.tsx index 1cfe3139..f335211d 100644 --- a/app/lish/[did]/[publication]/[rkey]/BlueskyQuotesPage.tsx +++ b/app/lish/[did]/[publication]/[rkey]/BlueskyQuotesPage.tsx @@ -92,6 +92,8 @@ function QuotePost(props: { post: PostView; quotesUri: string }) { parent={parent} showEmbed={true} showBlueskyLink={true} + quoteEnabled + replyEnabled onEmbedClick={(e) => e.stopPropagation()} className="relative py-2 px-2 hover:bg-bg-page rounded cursor-pointer" /> diff --git a/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx b/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx index e9512897..a0178390 100644 --- a/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx +++ b/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx @@ -19,7 +19,7 @@ type PostView = AppBskyFeedDefs.PostView; export function BskyPostContent(props: { post: PostView; - parent?: OpenPage; + parent: OpenPage; avatarSize?: "tiny" | "medium" | "large" | "giant"; className?: string; showEmbed?: boolean; @@ -50,97 +50,111 @@ export function BskyPostContent(props: { const url = `https://bsky.app/profile/${post.author.handle}/post/${postId}`; return ( -
- {replyLine && ( -
+
+
+
+ {replyLine && ( + + )} + + {replyLine && ( + + )} +
+
-
- )} - + {props.showBlueskyLink || + (props.post.quoteCount && props.post.quoteCount > 0) || + (props.post.replyCount && props.post.replyCount > 0) ? ( +
+ + +
+ {showBlueskyLink && ( + <> + + + + + )} +
+
+ ) : null}
- +
); } @@ -171,7 +185,7 @@ function PostCounts(props: { ); return ( -
+
{replyContent && (props.replyEnabled ? ( ); })} diff --git a/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx b/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx index 8efc880e..55774899 100644 --- a/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx +++ b/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx @@ -60,15 +60,15 @@ export function ThreadPage(props: { Failed to load thread
) : thread ? ( - + ) : null}
); } -function ThreadContent(props: { thread: ThreadType; parentUri: string }) { - const { thread, parentUri: parentUri } = props; +function ThreadContent(props: { post: ThreadType; parentUri: string }) { + const { post, parentUri } = props; const mainPostRef = useRef(null); // Scroll the main post into view when the thread loads @@ -81,11 +81,11 @@ function ThreadContent(props: { thread: ThreadType; parentUri: string }) { } }, []); - if (AppBskyFeedDefs.isNotFoundPost(thread)) { + if (AppBskyFeedDefs.isNotFoundPost(post)) { return ; } - if (AppBskyFeedDefs.isBlockedPost(thread)) { + if (AppBskyFeedDefs.isBlockedPost(post)) { return (
This post is blocked @@ -93,13 +93,13 @@ function ThreadContent(props: { thread: ThreadType; parentUri: string }) { ); } - if (!AppBskyFeedDefs.isThreadViewPost(thread)) { + if (!AppBskyFeedDefs.isThreadViewPost(post)) { return ; } // Collect all parent posts in order (oldest first) const parents: ThreadViewPost[] = []; - let currentParent = thread.parent; + let currentParent = post.parent; while (currentParent && AppBskyFeedDefs.isThreadViewPost(currentParent)) { parents.unshift(currentParent); currentParent = currentParent.parent; @@ -122,7 +122,7 @@ function ThreadContent(props: { thread: ThreadType; parentUri: string }) { {/* Main post */}
{/* Replies */} - {thread.replies && thread.replies.length > 0 && ( + {post.replies && post.replies.length > 0 && (
)} @@ -166,7 +166,7 @@ function ThreadPost(props: { showBlueskyLink={true} showEmbed={true} quoteEnabled - replyEnabled + replyEnabled={!isMainPost} />
); @@ -269,7 +269,9 @@ const ReplyPost = (props: { const hasReplies = props.post.replies && props.post.replies.length > 0; return ( -
+
{ props.toggleCollapsed(props.parentUri); - console.log("click click"); }, } : undefined @@ -299,7 +300,7 @@ const ReplyPost = (props: { {!props.isCollapsed && (