feat: improve highlight source display and navigation

This commit is contained in:
codytseng
2025-08-16 22:33:19 +08:00
parent 06adcdb2a8
commit 6350ddc224
4 changed files with 41 additions and 22 deletions

View File

@@ -0,0 +1,13 @@
import ClientSelect from '@/components/ClientSelect'
import { useTranslation } from 'react-i18next'
export default function NotFound({ bech32Id }: { bech32Id?: string }) {
const { t } = useTranslation()
return (
<div className="text-muted-foreground w-full h-full flex flex-col items-center justify-center gap-2">
<div>{t('Note not found')}</div>
<ClientSelect originalNoteId={bech32Id} />
</div>
)
}

View File

@@ -18,7 +18,7 @@ import { Ellipsis } from 'lucide-react'
import { Event } from 'nostr-tools'
import { forwardRef, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import NotFoundPage from '../NotFoundPage'
import NotFound from './NotFound'
const NotePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => {
const { t } = useTranslation()
@@ -59,7 +59,13 @@ const NotePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref
</SecondaryPageLayout>
)
}
if (!event) return <NotFoundPage />
if (!event) {
return (
<SecondaryPageLayout ref={ref} index={index} title={t('Note')} displayScrollToTopButton>
<NotFound bech32Id={id} />
</SecondaryPageLayout>
)
}
return (
<SecondaryPageLayout ref={ref} index={index} title={t('Note')} displayScrollToTopButton>