be7cfbab67
Add emojify/EmojifiedText utilities that replace :shortcode: patterns with inline images using emoji tags from kind 0 and kind 1 events. Applied to display names across NoteCard, PostDetailPage, ProfilePage, ProfileHoverCard, InteractionsModal, NotificationsPage, and NoteContent @mentions. Also emojifies about/bio text in ProfilePage and ProfileHoverCard. Remove string-level truncation from getDisplayName to avoid breaking shortcodes mid-pattern (CSS truncate handles visual overflow). Use em-relative sizing and align-text-bottom for proper inline alignment.
16 lines
519 B
TypeScript
16 lines
519 B
TypeScript
import { genUserName } from '@/lib/genUserName';
|
|
import type { NostrMetadata } from '@nostrify/nostrify';
|
|
|
|
/**
|
|
* Get a display name for a user.
|
|
* Uses metadata.name if available, otherwise generates a deterministic username.
|
|
* Visual truncation is handled by CSS (`truncate` class) on the containing element
|
|
* to avoid breaking NIP-30 custom emoji shortcodes.
|
|
*/
|
|
export function getDisplayName(
|
|
metadata: NostrMetadata | undefined,
|
|
pubkey: string,
|
|
): string {
|
|
return metadata?.name || genUserName(pubkey);
|
|
}
|