diff --git a/app/lish/[did]/[publication]/page.tsx b/app/lish/[did]/[publication]/page.tsx index 79694a8c..20a37ba8 100644 --- a/app/lish/[did]/[publication]/page.tsx +++ b/app/lish/[did]/[publication]/page.tsx @@ -11,6 +11,8 @@ import { PublicationThemeProvider, } from "components/ThemeManager/PublicationThemeProvider"; import { SpeedyLink } from "components/SpeedyLink"; +import { QuoteTiny } from "components/Icons/QuoteTiny"; +import { CommentTiny } from "components/Icons/CommentTiny"; export default async function Publication(props: { params: Promise<{ publication: string; did: string }>; @@ -34,7 +36,11 @@ export default async function Publication(props: { .select( `*, publication_subscriptions(*), - documents_in_publications(documents(*)) + documents_in_publications(documents( + *, + comments_on_documents(count), + document_mentions_in_bsky(count) + )) `, ) .eq("identity_did", did) @@ -121,31 +127,58 @@ export default async function Publication(props: { .map((doc) => { if (!doc.documents) return null; let uri = new AtUri(doc.documents.uri); - let record = doc.documents + let doc_record = doc.documents .data as PubLeafletDocument.Record; + let quotes = + doc.documents.document_mentions_in_bsky[0].count || 0; + let comments = + record?.preferences?.showComments === false + ? 0 + : doc.documents.comments_on_documents[0].count || 0; + return ( -
+
-

{record.title}

+

{doc_record.title}

- {record.description} -

-

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

+ +
+

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

+ {comments > 0 || quotes > 0 ? "| " : ""} + {quotes > 0 && ( + + {quotes} + + )} + {comments > 0 && + record?.preferences?.showComments !== false && ( + + {comments} + + )} +