feat: blog header images, npub display, and meetups load more
Show longform image tags on posts, use shortened npubs for author names, and paginate the homepage meetups section with responsive load more. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -82,6 +82,20 @@ export function shortenPubkey(pubkey: string): string {
|
||||
return `${pubkey.slice(0, 8)}...${pubkey.slice(-8)}`;
|
||||
}
|
||||
|
||||
// Shortened npub for display when no profile is available. Accepts a hex pubkey
|
||||
// or an existing npub/nprofile and always renders bech32 (never raw hex).
|
||||
export function shortenNpub(pubkeyOrBech32: string): string {
|
||||
if (!pubkeyOrBech32) return "";
|
||||
try {
|
||||
const npub = pubkeyOrBech32.startsWith("npub")
|
||||
? pubkeyOrBech32
|
||||
: nip19.npubEncode(toHexPubkey(pubkeyOrBech32) || pubkeyOrBech32);
|
||||
return shortenPubkey(npub);
|
||||
} catch {
|
||||
return shortenPubkey(pubkeyOrBech32);
|
||||
}
|
||||
}
|
||||
|
||||
export interface NostrProfile {
|
||||
name?: string;
|
||||
picture?: string;
|
||||
|
||||
Reference in New Issue
Block a user