mirror of
https://github.com/dergigi/boris.git
synced 2026-01-19 14:54:30 +01:00
refactor: split Me into Me and Profile components for simpler /p/ pages
- Create Profile.tsx for viewing other users (highlights + writings only) - Profile uses useStoreTimeline for instant cache-first display - Background fetches populate event store non-blocking - Extract toBlogPostPreview helper for reuse - Simplify Me.tsx to only handle own profile (/me routes) - Remove isOwnProfile branching and cached data logic from Me - Update Bookmarks.tsx to render Profile for /p/ routes - Keep code DRY and files under 210 lines
This commit is contained in:
15
src/utils/toBlogPostPreview.ts
Normal file
15
src/utils/toBlogPostPreview.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { NostrEvent } from 'nostr-tools'
|
||||
import { Helpers } from 'applesauce-core'
|
||||
import { BlogPostPreview } from '../services/exploreService'
|
||||
|
||||
const { getArticleTitle, getArticleImage, getArticlePublished, getArticleSummary } = Helpers
|
||||
|
||||
export const toBlogPostPreview = (event: NostrEvent): BlogPostPreview => ({
|
||||
event,
|
||||
title: getArticleTitle(event) || 'Untitled',
|
||||
summary: getArticleSummary(event),
|
||||
image: getArticleImage(event),
|
||||
published: getArticlePublished(event),
|
||||
author: event.pubkey
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user