From 8fe1dd3323d78757ddd17caa4e1b01a246950971 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Sun, 14 Sep 2025 20:10:27 +0900 Subject: [PATCH] add comments and quotes to published list on dash --- app/api/rpc/[command]/get_publication_data.ts | 6 ++- .../dashboard/PublishedPostsLists.tsx | 52 ++++++++++++++----- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/app/api/rpc/[command]/get_publication_data.ts b/app/api/rpc/[command]/get_publication_data.ts index f9baba0b..baa775c4 100644 --- a/app/api/rpc/[command]/get_publication_data.ts +++ b/app/api/rpc/[command]/get_publication_data.ts @@ -28,7 +28,11 @@ export const get_publication_data = makeRoute({ .from("publications") .select( `*, - documents_in_publications(documents(*)), + documents_in_publications(documents( + *, + comments_on_documents(count), + document_mentions_in_bsky(count) + )), publication_subscriptions(*, identities(bsky_profiles(*))), publication_domains(*), leaflets_in_publications(*, diff --git a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx b/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx index 7711db75..581c8f11 100644 --- a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx +++ b/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx @@ -15,6 +15,8 @@ import { DeleteSmall } from "components/Icons/DeleteSmall"; import { ShareSmall } from "components/Icons/ShareSmall"; import { ShareButton } from "components/ShareOptions"; import { SpeedyLink } from "components/SpeedyLink"; +import { QuoteTiny } from "components/Icons/QuoteTiny"; +import { CommentTiny } from "components/Icons/CommentTiny"; export function PublishedPostsList() { let { data: publication } = usePublicationData(); @@ -47,6 +49,10 @@ export function PublishedPostsList() { ); let uri = new AtUri(doc.documents.uri); let record = doc.documents.data as PubLeafletDocument.Record; + let quotes = + doc.documents.document_mentions_in_bsky[0]?.count || 0; + let comments = + doc.documents.comments_on_documents[0]?.count || 0; return ( @@ -80,19 +86,39 @@ export function PublishedPostsList() { {record.description}

) : null} - {record.publishedAt ? ( -

- Published{" "} - {new Date(record.publishedAt).toLocaleDateString( - undefined, - { - year: "numeric", - month: "long", - day: "2-digit", - }, - )} -

- ) : null} +
+ {record.publishedAt ? ( +

+ Published{" "} + {new Date(record.publishedAt).toLocaleDateString( + undefined, + { + year: "numeric", + month: "long", + day: "2-digit", + }, + )} +

+ ) : null} + {(comments > 0 || quotes > 0) && record.publishedAt ? " | " : ""} + {quotes > 0 && ( + + {quotes} + + )} + {comments > 0 && quotes > 0 ? " " : ""} + {comments > 0 && ( + + {comments} + + )} +

-- 2.54.0