refactor: post editor

This commit is contained in:
codytseng 2025-05-23 22:47:31 +08:00
parent 3d06421acb
commit 78725d1e88
31 changed files with 1603 additions and 766 deletions

View file

@ -23,6 +23,13 @@ export function formatNpub(npub: string, length = 12) {
return npub.slice(0, prefixLength) + '...' + npub.slice(-suffixLength)
}
export function formatUserId(userId: string) {
if (userId.startsWith('npub1')) {
return formatNpub(userId)
}
return formatPubkey(userId)
}
export function pubkeyToNpub(pubkey: string) {
try {
return nip19.npubEncode(pubkey)