Browse Source

bug-fix publication rendering

imwald
Silberengel 1 week ago
parent
commit
34da061699
  1. 16
      src/components/Note/MarkdownArticle/MarkdownArticle.tsx
  2. 2
      src/components/Note/PublicationIndexBody.tsx

16
src/components/Note/MarkdownArticle/MarkdownArticle.tsx

@ -5446,6 +5446,7 @@ export default function MarkdownArticle({
event, event,
className, className,
hideMetadata = false, hideMetadata = false,
hideTitle = false,
lazyMedia = true, lazyMedia = true,
parentImageUrl, parentImageUrl,
fullCalendarInvite, fullCalendarInvite,
@ -5454,6 +5455,8 @@ export default function MarkdownArticle({
event: Event event: Event
className?: string className?: string
hideMetadata?: boolean hideMetadata?: boolean
/** Suppress title headings (e.g. when a parent renders the section title). */
hideTitle?: boolean
/** /**
* When true (default), images in the note are held as blur/skeleton placeholders * When true (default), images in the note are held as blur/skeleton placeholders
* until the user opens them in the lightbox. Set to false in full/detail views * until the user opens them in the lightbox. Set to false in full/detail views
@ -6296,13 +6299,16 @@ export default function MarkdownArticle({
</div> </div>
)} )}
{/* Metadata */} {/* Metadata */}
{!hideMetadata && metadata.title && <h1 className="break-words">{metadata.title}</h1>} {!hideTitle && !hideMetadata && metadata.title && (
<h1 className="break-words">{metadata.title}</h1>
)}
{!hideMetadata && metadata.summary && ( {!hideMetadata && metadata.summary && (
<blockquote> <blockquote>
<p className="break-words">{metadata.summary}</p> <p className="break-words">{metadata.summary}</p>
</blockquote> </blockquote>
)} )}
{!hideMetadata && {!hideTitle &&
!hideMetadata &&
event.kind === kinds.LongFormArticle && event.kind === kinds.LongFormArticle &&
!metadata.image?.trim() && ( !metadata.image?.trim() && (
<div className="not-prose my-4 flex max-w-[400px] justify-center rounded-lg bg-muted p-6"> <div className="not-prose my-4 flex max-w-[400px] justify-center rounded-lg bg-muted p-6">
@ -6314,13 +6320,15 @@ export default function MarkdownArticle({
/> />
</div> </div>
)} )}
{hideMetadata && {!hideTitle &&
hideMetadata &&
metadata.title && metadata.title &&
event.kind !== ExtendedKind.DISCUSSION && event.kind !== ExtendedKind.DISCUSSION &&
!isNip52CalendarCardKind(event.kind) && ( !isNip52CalendarCardKind(event.kind) && (
<h2 className="text-2xl font-bold mb-4 leading-tight break-words">{metadata.title}</h2> <h2 className="text-2xl font-bold mb-4 leading-tight break-words">{metadata.title}</h2>
)} )}
{hideMetadata && {!hideTitle &&
hideMetadata &&
metadata.title && metadata.title &&
event.kind === kinds.LongFormArticle && event.kind === kinds.LongFormArticle &&
!metadata.image?.trim() && !metadata.image?.trim() &&

2
src/components/Note/PublicationIndexBody.tsx

@ -53,7 +53,7 @@ function SectionContent({ event }: { event: Event }) {
) )
} }
if (event.kind === kinds.LongFormArticle) { if (event.kind === kinds.LongFormArticle) {
return <MarkdownArticle className="mt-2" event={event} hideMetadata /> return <MarkdownArticle className="mt-2" event={event} hideMetadata hideTitle />
} }
if ((event.content ?? '').trim()) { if ((event.content ?? '').trim()) {
return ( return (

Loading…
Cancel
Save