fix: update external links in article notes

This commit is contained in:
codytseng
2024-11-19 22:17:43 +08:00
parent aa4f4258aa
commit af027debb0
2 changed files with 5 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
import { useFetchEventById } from '@renderer/hooks'
import { toNoStrudelNote } from '@renderer/lib/link'
import { toNoStrudelArticle, toNoStrudelNote } from '@renderer/lib/link'
import { kinds } from 'nostr-tools'
import ShortTextNoteCard from '../NoteCard/ShortTextNoteCard'
@@ -10,7 +10,9 @@ export function EmbeddedNote({ noteId }: { noteId: string }) {
<ShortTextNoteCard size="small" className="mt-2 w-full" event={event} hideStats />
) : (
<a
href={toNoStrudelNote(noteId)}
href={
event?.kind === kinds.LongFormArticle ? toNoStrudelArticle(noteId) : toNoStrudelNote(noteId)
}
target="_blank"
className="text-highlight hover:underline"
onClick={(e) => e.stopPropagation()}

View File

@@ -6,3 +6,4 @@ export const toFollowingList = (pubkey: string) => `/user/${pubkey}/following`
export const toNoStrudelProfile = (id: string) => `https://nostrudel.ninja/#/u/${id}`
export const toNoStrudelNote = (id: string) => `https://nostrudel.ninja/#/n/${id}`
export const toNoStrudelArticle = (id: string) => `https://nostrudel.ninja/#/articles/${id}`