mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
15 lines
454 B
TypeScript
15 lines
454 B
TypeScript
import type { NostrMetadata } from '@nostrify/nostrify';
|
|
|
|
/**
|
|
* Get a display name for a user.
|
|
* Uses metadata.name if available, otherwise falls back to "Anonymous".
|
|
* 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 || 'Anonymous';
|
|
}
|