a tool for shared writing and social publishing

don't render Untitled on published posts

+21 -15
+3 -3
actions/publishToPublication.ts
··· 259 259 260 260 record = { 261 261 $type: "site.standard.document", 262 - title: title || "Untitled", 262 + title: title || "", 263 263 site: siteUri, 264 264 path: "/" + rkey, 265 265 publishedAt: ··· 293 293 ...preferences, 294 294 }, 295 295 }), 296 - title: title || "Untitled", 296 + title: title || "", 297 297 description: description || "", 298 298 ...(tags !== undefined && { tags }), 299 299 ...(coverImageBlob && { coverImage: coverImageBlob }), ··· 338 338 await supabaseServerClient.from("leaflets_to_documents").upsert({ 339 339 leaflet: leaflet_id, 340 340 document: result.uri, 341 - title: title || "Untitled", 341 + title: title || "", 342 342 description: description || "", 343 343 }); 344 344
+5 -5
app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx
··· 123 123 <div className="pubInfo flex text-accent-contrast font-bold justify-between w-full"> 124 124 {props.pubLink} 125 125 </div> 126 - <h2 127 - className={`postTitle text-xl leading-tight pt-0.5 font-bold outline-hidden bg-transparent ${!props.postTitle && "text-tertiary italic"}`} 128 - > 129 - {props.postTitle ? props.postTitle : "Untitled"} 130 - </h2> 126 + {props.postTitle && ( 127 + <h2 className="postTitle text-xl leading-tight pt-0.5 font-bold outline-hidden bg-transparent"> 128 + {props.postTitle} 129 + </h2> 130 + )} 131 131 {props.postDescription ? ( 132 132 <div className="postDescription italic text-secondary outline-hidden bg-transparent pt-1"> 133 133 {props.postDescription}
+6 -3
app/lish/[did]/[publication]/page.tsx
··· 20 20 normalizePublicationRecord, 21 21 normalizeDocumentRecord, 22 22 } from "src/utils/normalizeRecords"; 23 + import { getFirstParagraph } from "src/utils/getFirstParagraph"; 23 24 24 25 export default async function Publication(props: { 25 26 params: Promise<{ publication: string; did: string }>; ··· 143 144 href={docUrl} 144 145 className="publishedPost hover:no-underline! flex flex-col" 145 146 > 146 - <h3 className="text-primary">{doc_record.title}</h3> 147 - <p className="italic text-secondary"> 148 - {doc_record.description} 147 + {doc_record.title && ( 148 + <h3 className="text-primary">{doc_record.title}</h3> 149 + )} 150 + <p className="italic text-secondary line-clamp-3"> 151 + {doc_record.description || getFirstParagraph(doc_record)} 149 152 </p> 150 153 </SpeedyLink> 151 154
+7 -4
components/PostListing.tsx
··· 25 25 import { ExternalLinkTiny } from "./Icons/ExternalLinkTiny"; 26 26 import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; 27 27 import { RecommendButton } from "./RecommendButton"; 28 + import { getFirstParagraph } from "src/utils/getFirstParagraph"; 28 29 29 30 export const PostListing = (props: Post) => { 30 31 let pubRecord = props.publication?.pubRecord as ··· 133 134 </div> 134 135 )} 135 136 <div className="postListingInfo px-3 py-2"> 136 - <h3 className="postListingTitle text-primary line-clamp-2 sm:text-lg text-base"> 137 - {postRecord.title} 138 - </h3> 137 + {postRecord.title && ( 138 + <h3 className="postListingTitle text-primary line-clamp-2 sm:text-lg text-base"> 139 + {postRecord.title} 140 + </h3> 141 + )} 139 142 140 143 <p className="postListingDescription text-secondary line-clamp-3 sm:text-base text-sm"> 141 - {postRecord.description} 144 + {postRecord.description || getFirstParagraph(postRecord)} 142 145 </p> 143 146 <div className="flex flex-col-reverse gap-2 text-sm text-tertiary items-center justify-start pt-1.5 w-full"> 144 147 {props.publication && pubRecord && (