fix: replies

This commit is contained in:
codytseng 2025-05-15 23:38:22 +08:00
parent a6c2decfe3
commit 304bbe4f01
13 changed files with 178 additions and 120 deletions

View file

@ -1,12 +1,11 @@
import client from '@/services/client.service'
import { Event, nip19 } from 'nostr-tools'
import { getSharableEventId } from './event'
import { generateEventId } from './tag'
export const toHome = () => '/'
export const toNote = (eventOrId: Pick<Event, 'id' | 'pubkey'> | string) => {
if (typeof eventOrId === 'string') return `/notes/${eventOrId}`
const relay = client.getEventHint(eventOrId.id)
const nevent = nip19.neventEncode({ id: eventOrId.id, author: eventOrId.pubkey, relays: [relay] })
const nevent = generateEventId(eventOrId)
return `/notes/${nevent}`
}
export const toNoteList = ({ hashtag, search }: { hashtag?: string; search?: string }) => {