diff --git a/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx b/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx index a0178390..8b7d54f6 100644 --- a/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx +++ b/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx @@ -20,9 +20,10 @@ type PostView = AppBskyFeedDefs.PostView; export function BskyPostContent(props: { post: PostView; parent: OpenPage; - avatarSize?: "tiny" | "medium" | "large" | "giant"; + avatarSize?: "tiny" | "small" | "medium" | "large" | "giant"; className?: string; showEmbed?: boolean; + compactEmbed?: boolean; showBlueskyLink?: boolean; onEmbedClick?: (e: React.MouseEvent) => void; quoteEnabled?: boolean; @@ -35,8 +36,9 @@ export function BskyPostContent(props: { const { post, parent, - avatarSize = "md", + avatarSize = "medium", showEmbed = true, + compactEmbed = false, showBlueskyLink = true, onEmbedClick, quoteEnabled, @@ -67,7 +69,7 @@ export function BskyPostContent(props: { {replyLine && ( + )} + +
+
+ +
+
+ +
+
+ + {(post.quoteCount && post.quoteCount > 0) || + (post.replyCount && post.replyCount > 0) ? ( +
+ +
+ ) : null} + + + + ); +} + function PostCounts(props: { post: PostView; parent?: OpenPage; diff --git a/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx b/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx index 55774899..8805cce4 100644 --- a/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx +++ b/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx @@ -6,9 +6,12 @@ import { PageWrapper } from "components/Pages/Page"; import { useDrawerOpen } from "./Interactions/InteractionDrawer"; import { DotLoader } from "components/utils/DotLoader"; import { PostNotAvailable } from "components/Blocks/BlueskyPostBlock/BlueskyEmbed"; -import { openPage } from "./PostPages"; import { useThreadState } from "src/useThreadState"; -import { BskyPostContent, ClientDate } from "./BskyPostContent"; +import { + BskyPostContent, + CompactBskyPostContent, + ClientDate, +} from "./BskyPostContent"; import { ThreadLink, getThreadKey, @@ -30,7 +33,7 @@ export function ThreadPage(props: { pageOptions?: React.ReactNode; hasPageBackground: boolean; }) { - const { parentUri: parentUri, pageId, pageOptions } = props; + const { parentUri, pageId, pageOptions } = props; const drawer = useDrawerOpen(parentUri); const { @@ -49,7 +52,7 @@ export function ThreadPage(props: { drawerOpen={!!drawer} pageOptions={pageOptions} > -
+
{isLoading ? (
loading thread @@ -106,35 +109,31 @@ function ThreadContent(props: { post: ThreadType; parentUri: string }) { } return ( -
+
{/* grandparent posts, if any */} - {parents.map((parent, index) => ( -
- -
+ {parents.map((parentPost, index) => ( + ))} {/* Main post */}
- +
{/* Replies */} {post.replies && post.replies.length > 0 && ( -
+
@@ -147,26 +146,38 @@ function ThreadContent(props: { post: ThreadType; parentUri: string }) { function ThreadPost(props: { post: ThreadViewPost; isMainPost: boolean; - showReplyLine: boolean; - parentUri: string; + pageUri: string; }) { - const { post, isMainPost, showReplyLine, parentUri } = props; + const { post, isMainPost, pageUri } = props; const postView = post.post; - const parent = { type: "thread" as const, uri: parentUri }; + const page = { type: "thread" as const, uri: pageUri }; + + if (isMainPost) { + return ( +
+ +
+ ); + } return ( -
- {/* Reply line connector */} - {showReplyLine && ( -
- )} - + {}, + }} />
); @@ -176,9 +187,10 @@ function Replies(props: { replies: (ThreadViewPost | NotFoundPost | BlockedPost)[]; depth: number; parentAuthorDid?: string; - parentUri: string; + pageUri: string; + parentPostUri: string; }) { - const { replies, depth, parentAuthorDid, parentUri } = props; + const { replies, depth, parentAuthorDid, pageUri, parentPostUri } = props; const collapsedThreads = useThreadState((s) => s.collapsedThreads); const toggleCollapsed = useThreadState((s) => s.toggleCollapsed); @@ -198,7 +210,7 @@ function Replies(props: { : replies; return ( -
+
{sortedReplies.map((reply, index) => { if (AppBskyFeedDefs.isNotFoundPost(reply)) { return ( @@ -231,19 +243,21 @@ function Replies(props: { return ( toggleCollapsed(uri)} isCollapsed={isCollapsed} depth={props.depth} /> ); })} - {parentUri && depth > 0 && replies.length > 3 && ( + {pageUri && depth > 0 && replies.length > 3 && (
@@ -258,12 +272,13 @@ function Replies(props: { const ReplyPost = (props: { post: ThreadViewPost; isLast: boolean; - parentUri: string; + pageUri: string; + parentPostUri: string; toggleCollapsed: (uri: string) => void; isCollapsed: boolean; depth: number; }) => { - const { post, parentUri } = props; + const { post, pageUri, parentPostUri } = props; const postView = post.post; const hasReplies = props.post.replies && props.post.replies.length > 0; @@ -274,14 +289,14 @@ const ReplyPost = (props: { > 0 ? { onToggle: () => { - props.toggleCollapsed(props.parentUri); + props.toggleCollapsed(parentPostUri); }, } : undefined @@ -291,6 +306,7 @@ const ReplyPost = (props: { replyOnClick={(e) => { e.preventDefault(); props.toggleCollapsed(post.post.uri); + console.log(post.post.uri); }} onEmbedClick={(e) => e.stopPropagation()} className="text-sm z-10" @@ -300,7 +316,8 @@ const ReplyPost = (props: { {!props.isCollapsed && (
= 3 && ( View more replies diff --git a/components/Blocks/BlueskyPostBlock/BlueskyEmbed.tsx b/components/Blocks/BlueskyPostBlock/BlueskyEmbed.tsx index 5d8eaefb..192306cc 100644 --- a/components/Blocks/BlueskyPostBlock/BlueskyEmbed.tsx +++ b/components/Blocks/BlueskyPostBlock/BlueskyEmbed.tsx @@ -15,6 +15,7 @@ export const BlueskyEmbed = (props: { embed: Exclude; postUrl?: string; className?: string; + compact?: boolean; }) => { // check this file from bluesky for ref // https://github.com/bluesky-social/social-app/blob/main/bskyembed/src/components/embed.tsx @@ -22,7 +23,7 @@ export const BlueskyEmbed = (props: { case AppBskyEmbedImages.isView(props.embed): let imageEmbed = props.embed; return ( -
+
{imageEmbed.images.map( ( image: { @@ -69,7 +70,7 @@ export const BlueskyEmbed = (props: { let isGif = externalEmbed.external.uri.includes(".gif"); if (isGif) { return ( -
+
{externalEmbed.external.title} {externalEmbed.external.thumb === undefined ? null : ( <> -
+ -
+ {!props.compact &&
} )} -
-
-

{externalEmbed.external.title}

-

+

+
+

{externalEmbed.external.title}

+

{externalEmbed.external.description}


-
+
{externalEmbed.external.uri}
@@ -117,7 +123,7 @@ export const BlueskyEmbed = (props: { : 16 / 9; return (
{record.author.avatar && (