diff --git a/app/lish/[did]/[publication]/page.tsx b/app/lish/[did]/[publication]/page.tsx index 9902d594..c4fce3f1 100644 --- a/app/lish/[did]/[publication]/page.tsx +++ b/app/lish/[did]/[publication]/page.tsx @@ -1,6 +1,9 @@ import { supabaseServerClient } from "supabase/serverClient"; import { AtUri } from "@atproto/syntax"; -import { getPublicationURL, getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { + getPublicationURL, + getDocumentURL, +} from "app/lish/createPub/getPublicationURL"; import { BskyAgent } from "@atproto/api"; import { publicationNameOrUriFilter } from "src/utils/uriHelpers"; import { SubscribeWithBluesky } from "app/lish/Subscribe"; @@ -61,141 +64,151 @@ export default async function Publication(props: { try { return ( <> - - - + - -
- {record?.icon && ( -
- )} -

- {publication.name} -

-

- {record?.description}{" "} -

- {profile && ( - - )} -
- + +
+ {record?.icon && ( +
+ )} +

+ {publication.name} +

+

+ {record?.description}{" "} +

+ {profile && ( + + )} +
+ +
-
-
- {publication.documents_in_publications - .filter((d) => !!d?.documents) - .sort((a, b) => { - const aRecord = normalizeDocumentRecord(a.documents?.data); - const bRecord = normalizeDocumentRecord(b.documents?.data); - const aDate = aRecord?.publishedAt - ? new Date(aRecord.publishedAt) - : new Date(0); - const bDate = bRecord?.publishedAt - ? new Date(bRecord.publishedAt) - : new Date(0); - return bDate.getTime() - aDate.getTime(); // Sort by most recent first - }) - .map((doc) => { - if (!doc.documents) return null; - const doc_record = normalizeDocumentRecord( - doc.documents.data, - ); - if (!doc_record) return null; - let uri = new AtUri(doc.documents.uri); - 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; - let recommends = - doc.documents.recommends_on_documents?.[0]?.count || 0; - let tags = doc_record.tags || []; +
+ {publication.documents_in_publications + .filter((d) => !!d?.documents) + .sort((a, b) => { + const aRecord = normalizeDocumentRecord(a.documents?.data); + const bRecord = normalizeDocumentRecord(b.documents?.data); + const aDate = aRecord?.publishedAt + ? new Date(aRecord.publishedAt) + : new Date(0); + const bDate = bRecord?.publishedAt + ? new Date(bRecord.publishedAt) + : new Date(0); + return bDate.getTime() - aDate.getTime(); // Sort by most recent first + }) + .map((doc) => { + if (!doc.documents) return null; + const doc_record = normalizeDocumentRecord( + doc.documents.data, + ); + if (!doc_record) return null; + let uri = new AtUri(doc.documents.uri); + 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; + let recommends = + doc.documents.recommends_on_documents?.[0]?.count || 0; + let tags = doc_record.tags || []; - const docUrl = getDocumentURL(doc_record, doc.documents.uri, publication); - return ( - -
- - {doc_record.title && ( -

{doc_record.title}

- )} -

- {doc_record.description || getFirstParagraph(doc_record)} -

-
+ const docUrl = getDocumentURL( + doc_record, + doc.documents.uri, + publication, + ); + return ( + +
+ + {doc_record.title && ( +

+ {doc_record.title} +

+ )} +

+ {doc_record.description || + getFirstParagraph(doc_record)} +

+
-
-

- {doc_record.publishedAt && ( - - )}{" "} -

+
+

+ {doc_record.publishedAt && ( + + )}{" "} +

- + +
-
-
-
- ); - })} -
- - - +
+
+ ); + })} +
+ + + ); } catch (e) {