diff --git a/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx index 10b5d210..e6183b20 100644 --- a/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx @@ -33,7 +33,7 @@ export const PubBlueskyPostBlock = (props: { avatarSize="large" quoteEnabled replyEnabled - className="text-sm text-secondary block-border sm:px-3 sm:py-2 px-2 py-1 bg-bg-page mb-2 hover:border-accent-contrast!" + className="publishedBskyPostBlock text-sm text-secondary block-border sm:px-3 sm:py-2 px-2 py-1 bg-bg-page mb-2 hover:border-accent-contrast!" clientHost={props.clientHost} /> ); diff --git a/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishedPageBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishedPageBlock.tsx index 1dcfdced..201541d2 100644 --- a/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishedPageBlock.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishedPageBlock.tsx @@ -24,7 +24,6 @@ import { useInteractionState, } from "../Interactions/Interactions"; import { CommentTiny } from "components/Icons/CommentTiny"; -import { QuoteTiny } from "components/Icons/QuoteTiny"; import { CanvasBackgroundPattern } from "components/Canvas"; export function PublishedPageLinkBlock(props: { @@ -213,33 +212,13 @@ const Interactions = (props: { pageId: string; parentPageId?: string }) => { let { drawerOpen, drawer, pageId } = useInteractionState(document_uri); + let defaultDrawer: "comments" | "quotes" = comments > 0 ? "comments" : "quotes"; + return (
- {quotes > 0 && ( - - )} - {comments > 0 && ( + {quotes + comments > 0 && ( )}
diff --git a/app/(app)/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx index 41f2ff0a..baab0488 100644 --- a/app/(app)/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx @@ -4,12 +4,11 @@ import { BlueskyEmbed } from "components/Blocks/BlueskyPostBlock/BlueskyEmbed"; import { BlueskyRichText } from "components/Blocks/BlueskyPostBlock/BlueskyRichText"; import { BlueskyTiny } from "components/Icons/BlueskyTiny"; import { CommentTiny } from "components/Icons/CommentTiny"; -import { QuoteTiny } from "components/Icons/QuoteTiny"; import { Separator } from "components/Layout"; import { useLocalizedDate } from "src/hooks/useLocalizedDate"; import { useHasPageLoaded } from "components/InitialPageLoadProvider"; import { OpenPage, openPage } from "./postPageState"; -import { ThreadLink, QuotesLink } from "./PostLinks"; +import { ThreadLink } from "./PostLinks"; import { BlueskyLinkTiny } from "components/Icons/BlueskyLinkTiny"; import { Avatar } from "components/Avatar"; import { timeAgo } from "src/utils/timeAgo"; @@ -285,48 +284,29 @@ function PostCounts(props: { showBlueskyLink: boolean; url: string; }) { - const replyContent = props.post.replyCount != null && - props.post.replyCount > 0 && ( -
- - {props.post.replyCount} -
- ); + const total = (props.post.replyCount ?? 0) + (props.post.quoteCount ?? 0); - const quoteContent = props.post.quoteCount != null && - props.post.quoteCount > 0 && ( -
- - {props.post.quoteCount} -
- ); + const countContent = total > 0 && ( +
+ + {total} +
+ ); return (
- {replyContent && - (props.replyEnabled ? ( + {countContent && + (props.replyEnabled || props.quoteEnabled ? ( - {replyContent} + {countContent} ) : ( - replyContent - ))} - {quoteContent && - (props.quoteEnabled ? ( - - {quoteContent} - - ) : ( - quoteContent + countContent ))}
); diff --git a/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx index 2ddc82af..e1249170 100644 --- a/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx @@ -138,7 +138,7 @@ const Comment = (props: { size={"medium"} /> -
+
{ let drawer = useDrawerOpen(props.document_uri); + let { commentsCount } = useDocument(); if (!drawer) return null; const filteredQuotesAndMentions = props.quotesAndMentions.filter((q) => { @@ -57,12 +59,29 @@ export const InteractionDrawer = (props: { - setInteractionState(props.document_uri, { drawer: value }) - } + onChange={(value, e) => { + e?.preventDefault(); + setInteractionState(props.document_uri, { drawer: value }); + }} options={[ - { value: "comments", label: "Comments" }, - { value: "quotes", label: "Bluesky Mentions" }, + { + value: "comments", + label: + commentsCount > 0 + ? `Comments (${commentsCount})` + : "Comments", + }, + { + value: "quotes", + label: ( +
+ Bluesky{" "} + Mentions{" "} + {filteredQuotesAndMentions.length > 0 && + `(${filteredQuotesAndMentions.length})`} +
+ ), + }, ]} /> ) : ( diff --git a/app/(app)/lish/[did]/[publication]/[rkey]/ThreadPage.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/ThreadPage.tsx index e8a46456..a8342968 100644 --- a/app/(app)/lish/[did]/[publication]/[rkey]/ThreadPage.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/ThreadPage.tsx @@ -223,7 +223,7 @@ function ThreadContent(props: { post: ThreadType; parentUri: string }) { {/* Replies */} {post.replies && post.replies.length > 0 && ( -
+
{ —
)} - {showComments && ( + {(showComments || showMentions) && (
—
)} - {showMentions && ( -
- — -
- )} {showMentions !== false || showComments !== false || diff --git a/components/InteractionsPreview.tsx b/components/InteractionsPreview.tsx index af5d1d92..e81a7ec6 100644 --- a/components/InteractionsPreview.tsx +++ b/components/InteractionsPreview.tsx @@ -1,7 +1,6 @@ "use client"; import { Separator } from "./Layout"; import { CommentTiny } from "./Icons/CommentTiny"; -import { QuoteTiny } from "./Icons/QuoteTiny"; import { useSmoker } from "./Toast"; import { Tag } from "./Tags"; import { Popover } from "./Popover"; @@ -23,9 +22,14 @@ export const InteractionPreview = (props: { share?: boolean; }) => { let smoker = useSmoker(); + let commentsAvailable = props.showComments !== false && props.commentsCount > 0; + let mentionsAvailable = props.showMentions && props.quotesCount > 0; + let discussionsAvailable = commentsAvailable || mentionsAvailable; + let defaultDrawer: "comments" | "quotes" = commentsAvailable + ? "comments" + : "quotes"; let interactionsAvailable = - (props.quotesCount > 0 && props.showMentions) || - (props.showComments !== false && props.commentsCount > 0) || + discussionsAvailable || (props.showRecommends !== false && props.recommendsCount > 0); const tagsCount = props.tags?.length || 0; @@ -39,22 +43,13 @@ export const InteractionPreview = (props: { /> )} - {!props.showMentions || props.quotesCount === 0 ? null : ( + {!discussionsAvailable ? null : ( - {props.quotesCount} - - )} - {!props.showComments || props.commentsCount === 0 ? null : ( - - {props.commentsCount} + {props.commentsCount + props.quotesCount} )} {tagsCount === 0 ? null : ( diff --git a/components/Pages/PublicationMetadata.tsx b/components/Pages/PublicationMetadata.tsx index 1a10e1ad..f095713c 100644 --- a/components/Pages/PublicationMetadata.tsx +++ b/components/Pages/PublicationMetadata.tsx @@ -13,7 +13,6 @@ import { useSubscribe } from "src/replicache/useSubscribe"; import { useEntitySetContext } from "components/EntitySetProvider"; import { timeAgo } from "src/utils/timeAgo"; import { CommentTiny } from "components/Icons/CommentTiny"; -import { QuoteTiny } from "components/Icons/QuoteTiny"; import { TagTiny } from "components/Icons/TagTiny"; import { Popover } from "components/Popover"; import { TagSelector } from "components/Tags"; @@ -139,12 +138,8 @@ export const PublicationMetadata = (props: { noInteractions?: boolean }) => {
)} - {merged.showMentions !== false && ( -
- — -
- )} - {merged.showComments !== false && ( + {(merged.showComments !== false || + merged.showMentions !== false) && (
—
diff --git a/components/PostListing.tsx b/components/PostListing.tsx index 8091ff94..c56e7296 100644 --- a/components/PostListing.tsx +++ b/components/PostListing.tsx @@ -17,7 +17,6 @@ import { TagPopover } from "./InteractionsPreview"; import { useLocalizedDate } from "src/hooks/useLocalizedDate"; import { useSmoker } from "./Toast"; import { CommentTiny } from "./Icons/CommentTiny"; -import { QuoteTiny } from "./Icons/QuoteTiny"; import { ShareTiny } from "./Icons/ShareTiny"; import { useSelectedPostListing } from "src/useSelectedPostState"; import { mergePreferences } from "src/utils/mergePreferences"; @@ -249,6 +248,13 @@ const Interactions = (props: { }); }; + let commentsAvailable = props.showComments && props.commentsCount > 0; + let mentionsAvailable = props.showMentions && props.quotesCount > 0; + let discussionsAvailable = commentsAvailable || mentionsAvailable; + let defaultDrawer: "comments" | "quotes" = commentsAvailable + ? "comments" + : "quotes"; + return (
- {!props.showMentions || props.quotesCount === 0 ? null : ( - - )} - {!props.showComments || props.commentsCount === 0 ? null : ( + {!discussionsAvailable ? null : ( )}
diff --git a/components/ToggleGroup.tsx b/components/ToggleGroup.tsx index b27f738d..f5cc901e 100644 --- a/components/ToggleGroup.tsx +++ b/components/ToggleGroup.tsx @@ -2,7 +2,7 @@ import { type ReactNode } from "react"; export function ToggleGroup(props: { value: T; - onChange: (value: T) => void; + onChange: (value: T, e?: React.MouseEvent) => void; options: { value: T; label: ReactNode }[]; className?: string; optionClassName?: string;