feat: improve the preview effect when note is not found

This commit is contained in:
codytseng
2025-03-08 00:06:31 +08:00
parent accf3319e7
commit 5e3cd04280
14 changed files with 28 additions and 18 deletions

View File

@@ -18,7 +18,7 @@ export default function ContentPreview({
}) {
const { t } = useTranslation()
const content = useMemo(() => {
if (!event) return t('Not found')
if (!event) return `[${t('Not found the note')}]`
const { contentWithoutEmbeddedNotes, embeddedNotes } = extractEmbeddedNotesFromContent(
event.content
)
@@ -35,7 +35,6 @@ export default function ContentPreview({
embeddedNostrNpubTextRenderer
])
}, [event])
if (!event) return null
return <div className={cn('pointer-events-none', className)}>{content}</div>
}

View File

@@ -61,7 +61,7 @@ function EmbeddedNoteNotFound({ noteId, className }: { noteId: string; className
}}
variant="ghost"
>
{isCopied ? <Check /> : <Copy />} Copy note ID
{isCopied ? <Check /> : <Copy />} {t('Copy event ID')}
</Button>
</div>
</div>

View File

@@ -208,6 +208,7 @@ export default {
'هل أنت متأكد أنك تريد إلغاء متابعة هذا المستخدم؟',
'Recent Supporters': 'الداعمين الجدد',
'Seen on': 'شوهد على',
'Temporarily display this reply': 'عرض هذا الرد مؤقتاً'
'Temporarily display this reply': 'عرض هذا الرد مؤقتاً',
'Not found the note': 'لم يتم العثور على الملاحظة'
}
}

View File

@@ -212,6 +212,7 @@ export default {
'Möchtest du diesem Benutzer wirklich nicht mehr folgen?',
'Recent Supporters': 'Neueste Unterstützer',
'Seen on': 'Gesehen auf',
'Temporarily display this reply': 'Antwort vorübergehend anzeigen'
'Temporarily display this reply': 'Antwort vorübergehend anzeigen',
'Not found the note': 'Die Notiz wurde nicht gefunden'
}
}

View File

@@ -208,6 +208,7 @@ export default {
'Are you sure you want to unfollow this user?': 'Are you sure you want to unfollow this user?',
'Recent Supporters': 'Recent Supporters',
'Seen on': 'Seen on',
'Temporarily display this reply': 'Temporarily display this reply'
'Temporarily display this reply': 'Temporarily display this reply',
'Not found the note': 'Not found the note'
}
}

View File

@@ -212,6 +212,7 @@ export default {
'¿Estás seguro de que deseas dejar de seguir a este usuario?',
'Recent Supporters': 'Últimos patrocinadores',
'Seen on': 'Visto en',
'Temporarily display this reply': 'Mostrar temporalmente esta respuesta'
'Temporarily display this reply': 'Mostrar temporalmente esta respuesta',
'Not found the note': 'No se encontró la nota'
}
}

View File

@@ -211,6 +211,7 @@ export default {
'Êtes-vous sûr de vouloir arrêter de suivre cet utilisateur ?',
'Recent Supporters': 'Derniers soutiens',
'Seen on': 'Vu sur',
'Temporarily display this reply': 'Afficher temporairement cette réponse'
'Temporarily display this reply': 'Afficher temporairement cette réponse',
'Not found the note': 'Note introuvable'
}
}

View File

@@ -209,6 +209,7 @@ export default {
'Are you sure you want to unfollow this user?': 'このユーザーのフォローを解除しますか?',
'Recent Supporters': '最近のサポーター',
'Seen on': '見た',
'Temporarily display this reply': 'この返信を一時的に表示'
'Temporarily display this reply': 'この返信を一時的に表示',
'Not found the note': 'ノートが見つかりません'
}
}

View File

@@ -210,6 +210,7 @@ export default {
'Czy na pewno chcesz przestać obserwować tego użytkownika?',
'Recent Supporters': 'Ostatni wspierający',
'Seen on': 'Widziany na',
'Temporarily display this reply': 'Tymczasowo wyświetl tę odpowiedź'
'Temporarily display this reply': 'Tymczasowo wyświetl tę odpowiedź',
'Not found the note': 'Nie znaleziono wpisu'
}
}

View File

@@ -210,6 +210,7 @@ export default {
'Tem certeza de que deseja deixar de seguir este usuário?',
'Recent Supporters': 'Apoiadores recentes',
'Seen on': 'Visto em',
'Temporarily display this reply': 'Exibir temporariamente esta resposta'
'Temporarily display this reply': 'Exibir temporariamente esta resposta',
'Not found the note': 'Nota não encontrada'
}
}

View File

@@ -211,6 +211,7 @@ export default {
'Tem certeza de que deseja deixar de seguir este usuário?',
'Recent Supporters': 'Apoiadores Recentes',
'Seen on': 'Visto em',
'Temporarily display this reply': 'Exibir temporariamente esta resposta'
'Temporarily display this reply': 'Exibir temporariamente esta resposta',
'Not found the note': 'Nota não encontrada'
}
}

View File

@@ -212,6 +212,7 @@ export default {
'Вы уверены, что хотите отписаться от этого пользователя?',
'Recent Supporters': 'Недавние спонсоры',
'Seen on': 'Просмотрено на',
'Temporarily display this reply': 'Временно отобразить этот ответ'
'Temporarily display this reply': 'Временно отобразить этот ответ',
'Not found the note': 'Заметка не найдена'
}
}

View File

@@ -209,6 +209,7 @@ export default {
'Are you sure you want to unfollow this user?': '确定要取消关注此用户吗?',
'Recent Supporters': '最近的支持者',
'Seen on': '来自',
'Temporarily display this reply': '临时显示此回复'
'Temporarily display this reply': '临时显示此回复',
'Not found the note': '未找到该笔记'
}
}

View File

@@ -113,7 +113,7 @@ function ParentNote({ eventId }: { eventId?: string }) {
return (
<div>
<Card className="flex p-1 items-center justify-center text-sm text-muted-foreground">
{t('Not found')}
[{t('Not found the note')}]
</Card>
<div className="ml-5 w-px h-2 bg-border" />
</div>
@@ -130,10 +130,10 @@ function ParentNote({ eventId }: { eventId?: string }) {
<UserAvatar userId={event.pubkey} size="tiny" className="shrink-0" />
<SimpleUsername
userId={event.pubkey}
className="font-semibold truncate shrink-0"
className="font-semibold truncate"
skeletonClassName="h-3 shrink-0"
/>
<div>[{t('This user has been muted')}]</div>
<div className="shrink-0">[{t('This user has been muted')}]</div>
</Card>
<div className="ml-5 w-px h-2 bg-border" />
</div>
@@ -149,7 +149,7 @@ function ParentNote({ eventId }: { eventId?: string }) {
<UserAvatar userId={event.pubkey} size="tiny" className="shrink-0" />
<SimpleUsername
userId={event.pubkey}
className="font-semibold truncate shrink-0"
className="font-semibold truncate"
skeletonClassName="h-3 shrink-0"
/>
<ContentPreview className="truncate" event={event} />