-
- {getPostTypeLabel(post.postType)}
-
@@ -137,8 +43,8 @@
- {post.album.description}
{/if}Photos
- openLightbox()}>
-
{#if items[selectedIndex].caption}
{items[selectedIndex].caption}
{/if}
{#each Array(totalSlots) as _, index}
@@ -125,9 +126,9 @@
onclick={() => selectImage(index)}
aria-label="View image {index + 1}"
>
-
{:else if index === displayItems.length && showMoreThumbnail}
@@ -137,14 +138,14 @@
aria-label="View all {totalCount || items.length} photos"
>
{#if items[displayItems.length]}
-
{:else if items[items.length - 1]}
-
@@ -162,7 +163,7 @@
{/if}
-
-
-
+ {#if slideshowItems.length > 0}
+
+
\ No newline at end of file
diff --git a/src/lib/components/UniverseCard.svelte b/src/lib/components/UniverseCard.svelte
new file mode 100644
index 0000000..7cb03f3
--- /dev/null
+++ b/src/lib/components/UniverseCard.svelte
@@ -0,0 +1,162 @@
+
+
+
+
+
+
diff --git a/src/lib/components/UniverseFeed.svelte b/src/lib/components/UniverseFeed.svelte
index 4f6ac16..12873e7 100644
--- a/src/lib/components/UniverseFeed.svelte
+++ b/src/lib/components/UniverseFeed.svelte
@@ -26,7 +26,7 @@
.universe-feed {
display: flex;
flex-direction: column;
- gap: $unit-4x;
+ gap: $unit-3x;
}
.empty-state {
diff --git a/src/lib/components/UniversePostCard.svelte b/src/lib/components/UniversePostCard.svelte
index 2069c15..e2582a3 100644
--- a/src/lib/components/UniversePostCard.svelte
+++ b/src/lib/components/UniversePostCard.svelte
@@ -1,161 +1,64 @@
-
-
Album
-
+
+ 1}
+ maxThumbnails={6}
+ totalCount={album.photosCount}
+ showMoreLink="/photos/{album.slug}"
+ />
+ {/if}
- {#if slideshowItems.length > 0}
-
- 1}
- maxThumbnails={6}
- totalCount={album.photosCount}
- showMoreLink="/photos/{album.slug}"
- />
-
+
+
-
++ e.preventDefault()} tabindex="-1">{album.title} +
+ + {#if album.description} +{album.description}
{/if} - -
-
-
- - {album.title} -
- - {#if album.location || album.date} -
- {#if album.date}
- 📅 {formatDate(album.date)}
- {/if}
- {#if album.location}
- 📍 {album.location}
- {/if}
-
- {/if}
-
- {#if album.description}
- {album.description}
- {/if} -
- View album →
-
-
e.key === 'Enter' && handleCardClick(e)}
+ >
+ {@render children?.()}
+
+
+
+
+
+
+
+
+
-
+ {#if post.title}
+
-
+
- {getPostTypeLabel(post.postType || 'post')}
-
-
- + e.preventDefault()} tabindex="-1">{post.title} +
+ {/if} - {#if post.title} -- {post.title} -
- {/if} - - {#if post.linkUrl} - -
-
- {post.linkUrl}
-
- {#if post.linkDescription}
-
- {/if}
-
- {post.linkDescription}
- {/if} -
- {#if post.excerpt}
- ${headingText} `
+
+ case 'paragraph':
+ const paragraphText = block.content || block.text || ''
+ if (!paragraphText) return '${itemText} `
+ })
+ .join('')
+ return `${itemText} `
+ })
+ .join('')
+ return `
${caption ? `${caption} ` : ''} `
+
+ case 'hr':
+ case 'horizontalRule':
+ return '
' + + default: + // For simple text content + const text = block.content || block.text || '' + if (text) { + return `
{post.excerpt}
- {:else if post.content} -{getContentExcerpt(post.content)}
+ {#if post.linkUrl} + +
+
+ {post.linkUrl}
+
+ {#if post.linkDescription}
+
+ {/if}
- {#if post.attachments && Array.isArray(post.attachments) && post.attachments.length > 0}
- {post.linkDescription}
{/if}
-
+
- 📎 {post.attachments.length} attachment{post.attachments.length > 1 ? 's' : ''}
-
-
+ {#if post.excerpt}
+
-
+
+ {#if post.postType === 'essay'}
+ {post.excerpt}
+ {:else if post.content} +{getContentExcerpt(post.content)}
{/if} - -
- Read more →
-
-
+ e.preventDefault()} tabindex="-1">Continue reading +
+ {/if} + + {#if post.attachments && Array.isArray(post.attachments) && post.attachments.length > 0} +
+
+ {/if}
+
diff --git a/src/lib/utils/content.ts b/src/lib/utils/content.ts
new file mode 100644
index 0000000..66bff41
--- /dev/null
+++ b/src/lib/utils/content.ts
@@ -0,0 +1,89 @@
+// Render Edra/BlockNote JSON content to HTML
+export const renderEdraContent = (content: any): string => {
+ if (!content) return ''
+
+ // Handle both { blocks: [...] } and { content: [...] } formats
+ const blocks = content.blocks || content.content || []
+ if (!Array.isArray(blocks)) return ''
+
+ const renderBlock = (block: any): string => {
+ switch (block.type) {
+ case 'heading':
+ const level = block.attrs?.level || block.level || 1
+ const headingText = block.content || block.text || ''
+ return `
+ 📎 {post.attachments.length} attachment{post.attachments.length > 1 ? 's' : ''}
+
+ ${paragraphText}
` + + case 'bulletList': + case 'ul': + const listItems = (block.content || []) + .map((item: any) => { + const itemText = item.content || item.text || '' + return `- ${listItems}
- ${orderedItems}
` + + case 'codeBlock': + case 'code': + const codeText = block.content || block.text || '' + const language = block.attrs?.language || block.language || '' + return `${quoteText}
${codeText}`
+
+ case 'image':
+ const src = block.attrs?.src || block.src || ''
+ const alt = block.attrs?.alt || block.alt || ''
+ const caption = block.attrs?.caption || block.caption || ''
+ return `' + + default: + // For simple text content + const text = block.content || block.text || '' + if (text) { + return `
${text}
` + } + return '' + } + } + + return blocks.map(renderBlock).join('') +} + +// Extract text content from Edra JSON for excerpt +export const getContentExcerpt = (content: any, maxLength = 200): string => { + if (!content || !content.content) return '' + + const extractText = (node: any): string => { + if (node.text) return node.text + if (node.content && Array.isArray(node.content)) { + return node.content.map(extractText).join(' ') + } + return '' + } + + const text = content.content.map(extractText).join(' ').trim() + if (text.length <= maxLength) return text + return text.substring(0, maxLength).trim() + '...' +} \ No newline at end of file diff --git a/src/lib/utils/date.ts b/src/lib/utils/date.ts new file mode 100644 index 0000000..a97f509 --- /dev/null +++ b/src/lib/utils/date.ts @@ -0,0 +1,8 @@ +export function formatDate(dateString: string): string { + const date = new Date(dateString) + return date.toLocaleDateString('en-US', { + year: 'numeric', + month: 'short', + day: 'numeric' + }) +} \ No newline at end of file