diff --git a/app/lish/[did]/[publication]/PublicationContent.tsx b/app/lish/[did]/[publication]/PublicationContent.tsx index aea1aaeb..ad67ce0a 100644 --- a/app/lish/[did]/[publication]/PublicationContent.tsx +++ b/app/lish/[did]/[publication]/PublicationContent.tsx @@ -20,12 +20,19 @@ import { PublicationPostItem, } from "./PublicationPageContent"; +type FakePost = { + title: string; + description: string; + date: React.ReactNode; +}; + export const PublicationContent = ({ record, publication, did, profile, showPageBackground, + fakePosts, }: { record: ReturnType; publication: { @@ -47,6 +54,7 @@ export const PublicationContent = ({ did: string; profile: { did: string; displayName?: string; handle: string } | undefined; showPageBackground: boolean | undefined; + fakePosts?: FakePost[]; }) => { return ( <> @@ -85,82 +93,92 @@ export const PublicationContent = ({ } />
- {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 || []; + {fakePosts && + fakePosts.map((post, i) => ( + + ))} + {!fakePosts && + 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 ( - - + + ) : undefined + } + interactions={ + - ) : undefined - } - interactions={ - - } - /> - - ); - })} + } + /> + + ); + })}
diff --git a/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx b/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx index f7401019..b5b7bbc8 100644 --- a/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx +++ b/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx @@ -163,6 +163,11 @@ export function SettingsContent(props: { showPageBackground: boolean }) { setIconFile={setIconFile} /> + {cardBorderHidden &&
} + + + + {cardBorderHidden &&
} {/* ── Post Settings ── */} @@ -181,12 +186,6 @@ export function SettingsContent(props: { showPageBackground: boolean }) { {cardBorderHidden &&
} - - - - - {cardBorderHidden &&
} - diff --git a/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx b/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx index 23e90e03..5876f9f2 100644 --- a/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx +++ b/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx @@ -7,6 +7,7 @@ import { import { useIdentityData } from "components/IdentityProvider"; import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; import { PublicationContent } from "../PublicationContent"; +import { LocalizedDate } from "../LocalizedDate"; export function PubPreview(props: { showPageBackground: boolean; @@ -22,16 +23,69 @@ export function PubPreview(props: { let did = publication?.identity_did || ""; - let profile = profileRecord + let profile = identity?.bsky_profiles ? { - did: profileRecord.did, - displayName: profileRecord.displayName, - handle: profileRecord.handle, + did: identity.bsky_profiles.did, + displayName: profileRecord?.displayName, + handle: identity.bsky_profiles.handle || "", } : undefined; if (!publication) return null; + const hasPosts = publication.documents_in_publications.some( + (d) => !!d?.documents, + ); + const today = new Date(); + const yesterday = new Date(today); + yesterday.setDate(today.getDate() - 1); + const dayBefore = new Date(today); + dayBefore.setDate(today.getDate() - 2); + + const dateOptions: Intl.DateTimeFormatOptions = { + year: "numeric", + month: "long", + day: "2-digit", + }; + + const fakePosts = !hasPosts + ? undefined + : [ + { + title: "Hello!", + description: + "So excited to have you! This is how your posts will appear in your publication", + date: ( + + ), + }, + { + title: "Welcome to your Leaflet Publication", + description: + "Leaflet is an open platform for writing and reading long form posts. Everything you write here, and everyone that follows you is data that belongs to YOU.", + date: ( + + ), + }, + { + title: "I can't wait to see what you do here :)", + description: + "There's so much cool stuff happening here, including this publication!", + date: ( + + ), + }, + ]; + return ( ); } diff --git a/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx b/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx index 89fed05d..95dfd237 100644 --- a/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx +++ b/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx @@ -173,7 +173,12 @@ const BackToPubButton = (props: { Discard and Leave - +