From 6822a2748cf046fe343772f061ef97bf514a3518 Mon Sep 17 00:00:00 2001 From: celine Date: Sun, 12 Apr 2026 21:56:22 -0400 Subject: [PATCH] some stuff to unify darft and published post paddings, also new filler content in the previews --- .../[publication]/[rkey]/PostContent.tsx | 8 +- .../[rkey]/PostHeader/PostHeader.tsx | 4 +- .../dashboard/PublishedPostsLists.tsx | 4 +- .../theme-settings/PostPreview.tsx | 50 +-- .../theme-settings/PubPreview.tsx | 12 +- .../theme-settings/ThemeSettingsContent.tsx | 12 +- .../theme-settings/postPreviewFakeBlocks.ts | 353 ++++++++++++++++++ components/Pages/PublicationMetadata.tsx | 2 +- components/ThemeManager/PubThemeSetter.tsx | 82 ---- 9 files changed, 381 insertions(+), 146 deletions(-) create mode 100644 app/lish/[did]/[publication]/theme-settings/postPreviewFakeBlocks.ts diff --git a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx b/app/lish/[did]/[publication]/[rkey]/PostContent.tsx index 47318580..e008a3ae 100644 --- a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx +++ b/app/lish/[did]/[publication]/[rkey]/PostContent.tsx @@ -65,7 +65,7 @@ export function PostContent({ return (
{blocks.map((b, index) => { return ( @@ -158,10 +158,12 @@ export let Block = ({ ) alignment = "text-center justify-center"; + let isHeading = PubLeafletBlocksHeader.isMain(b.block); + let className = ` postBlockWrapper min-h-7 - mt-1 mb-2 + ${isFirst ? "mt-0" : "mt-1"} ${isLast ? "mb-3 sm:mb-4" : isHeading ? "mb-0!" : "mb-2"} ${isList && "isListItem mb-0! "} ${alignment} `; @@ -388,7 +390,7 @@ export let Block = ({ return ( // all this margin stuff is a highly unfortunate hack so that the border-l on blockquote is the height of just the text rather than the height of the block, which includes padding.
{props.postTitle && ( -

+

{props.postTitle} -

+ )} {props.postDescription ? (
diff --git a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx b/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx index 47b18411..1d726519 100644 --- a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx +++ b/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx @@ -87,7 +87,9 @@ function PublishedPostItem(props: {

- {doc.record.title} + {doc.record.title === "" || doc.record.title === undefined + ? "Untitled" + : doc.record.title}

diff --git a/app/lish/[did]/[publication]/theme-settings/PostPreview.tsx b/app/lish/[did]/[publication]/theme-settings/PostPreview.tsx index 60d12d1e..e880d6f1 100644 --- a/app/lish/[did]/[publication]/theme-settings/PostPreview.tsx +++ b/app/lish/[did]/[publication]/theme-settings/PostPreview.tsx @@ -15,61 +15,15 @@ import { usePublicationData, useNormalizedPublicationRecord, } from "../dashboard/PublicationSWRProvider"; +import { fakeBlocks, fakePage } from "./postPreviewFakeBlocks"; const FAKE_DID = "did:plc:fake-preview-user"; const FAKE_DOC_URI = "at://did:plc:fake-preview-user/site.standard.document/preview"; -const fakeBlocks: PubLeafletPagesLinearDocument.Block[] = [ - { - $type: "pub.leaflet.pages.linearDocument#block", - block: { - $type: "pub.leaflet.blocks.header", - level: 2, - plaintext: "A Heading", - }, - }, - { - $type: "pub.leaflet.pages.linearDocument#block", - block: { - $type: "pub.leaflet.blocks.text", - plaintext: - "This is a preview of what your posts will look like with the current theme settings. You can adjust colors, fonts, and layout options to match your style.", - }, - }, - { - $type: "pub.leaflet.pages.linearDocument#block", - block: { - $type: "pub.leaflet.blocks.text", - plaintext: - "Try changing the heading font, body font, accent color, and background to see how they affect the look and feel of your publication.", - }, - }, - { - $type: "pub.leaflet.pages.linearDocument#block", - block: { - $type: "pub.leaflet.blocks.horizontalRule", - }, - }, - { - $type: "pub.leaflet.pages.linearDocument#block", - block: { - $type: "pub.leaflet.blocks.text", - plaintext: - "Your readers will see posts rendered just like this. Make sure you're happy with the typography and spacing before publishing!", - }, - }, -]; - -const fakePage: PubLeafletPagesLinearDocument.Main = { - $type: "pub.leaflet.pages.linearDocument", - id: "preview-page", - blocks: fakeBlocks, -}; - const fakeNormalizedDocument = { $type: "site.standard.document" as const, - title: "Preview Post Title", + title: "Building your Dream Theme!", description: "A short description of this preview post.", publishedAt: new Date().toISOString(), site: "at://did:plc:fake-preview-user/site.standard.publication/preview", diff --git a/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx b/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx index 5876f9f2..27887ef4 100644 --- a/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx +++ b/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx @@ -52,9 +52,9 @@ export function PubPreview(props: { ? undefined : [ { - title: "Hello!", + title: "Your Personal Antheme", description: - "So excited to have you! This is how your posts will appear in your publication", + "Welcome to the Publication Theme Setter. This is how posts will appear in your publication", date: (
-
+
{ + e.preventDefault(); + e.stopPropagation(); + }} + > {previewMode === "pub" ? ( { } postTitle={ { await rep?.mutate.updatePublicationDraft({ diff --git a/components/ThemeManager/PubThemeSetter.tsx b/components/ThemeManager/PubThemeSetter.tsx index 53e8153a..c4fd66ac 100644 --- a/components/ThemeManager/PubThemeSetter.tsx +++ b/components/ThemeManager/PubThemeSetter.tsx @@ -337,85 +337,3 @@ export const PubThemeSetter = (props: { ); }; - -const SamplePub = (props: { - pubBGImage: string | null; - pubBGRepeat: number | null; - showPageBackground: boolean; -}) => { - let { data } = usePublicationData(); - let { publication } = data || {}; - let record = useNormalizedPublicationRecord(); - - return ( -
-
-
- {record?.icon && publication?.uri && ( -
- )} - -
- {record?.name} -
-
- {record?.description} -
-
-
- Subscribe with Bluesky -
-
- -
-
- A Sample Post -
-
- This is a sample description about the sample post -
-
Jan 1, 20XX
-
-
-
- ); -}; -- 2.51.2