From 5e3cd042809008d8578dfe1139ea762b45714767 Mon Sep 17 00:00:00 2001 From: codytseng Date: Sat, 8 Mar 2025 00:06:31 +0800 Subject: [PATCH] feat: improve the preview effect when note is not found --- src/components/ContentPreview/index.tsx | 3 +-- src/components/Embedded/EmbeddedNote.tsx | 2 +- src/i18n/locales/ar.ts | 3 ++- src/i18n/locales/de.ts | 3 ++- src/i18n/locales/en.ts | 3 ++- src/i18n/locales/es.ts | 3 ++- src/i18n/locales/fr.ts | 3 ++- src/i18n/locales/ja.ts | 3 ++- src/i18n/locales/pl.ts | 3 ++- src/i18n/locales/pt-BR.ts | 3 ++- src/i18n/locales/pt-PT.ts | 3 ++- src/i18n/locales/ru.ts | 3 ++- src/i18n/locales/zh.ts | 3 ++- src/pages/secondary/NotePage/index.tsx | 8 ++++---- 14 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/components/ContentPreview/index.tsx b/src/components/ContentPreview/index.tsx index 4f03ce0b..7f3d8d94 100644 --- a/src/components/ContentPreview/index.tsx +++ b/src/components/ContentPreview/index.tsx @@ -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
{content}
} diff --git a/src/components/Embedded/EmbeddedNote.tsx b/src/components/Embedded/EmbeddedNote.tsx index 45e5394d..f6eb24fe 100644 --- a/src/components/Embedded/EmbeddedNote.tsx +++ b/src/components/Embedded/EmbeddedNote.tsx @@ -61,7 +61,7 @@ function EmbeddedNoteNotFound({ noteId, className }: { noteId: string; className }} variant="ghost" > - {isCopied ? : } Copy note ID + {isCopied ? : } {t('Copy event ID')} diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index 266f686b..3c3c1345 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -208,6 +208,7 @@ export default { 'هل أنت متأكد أنك تريد إلغاء متابعة هذا المستخدم؟', 'Recent Supporters': 'الداعمين الجدد', 'Seen on': 'شوهد على', - 'Temporarily display this reply': 'عرض هذا الرد مؤقتاً' + 'Temporarily display this reply': 'عرض هذا الرد مؤقتاً', + 'Not found the note': 'لم يتم العثور على الملاحظة' } } diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index d2395bb0..687ec360 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -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' } } diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 74bbf48c..52cfe7a8 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -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' } } diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 60927202..ae6a3ca4 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -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' } } diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 026dfc79..ff0e16c2 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -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' } } diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index daf3bf55..89d9af4b 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -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': 'ノートが見つかりません' } } diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index dd5b2f69..aa88ee19 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -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' } } diff --git a/src/i18n/locales/pt-BR.ts b/src/i18n/locales/pt-BR.ts index 91855b7f..52834e82 100644 --- a/src/i18n/locales/pt-BR.ts +++ b/src/i18n/locales/pt-BR.ts @@ -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' } } diff --git a/src/i18n/locales/pt-PT.ts b/src/i18n/locales/pt-PT.ts index 0d1b4860..8d3c4796 100644 --- a/src/i18n/locales/pt-PT.ts +++ b/src/i18n/locales/pt-PT.ts @@ -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' } } diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index dede5f4e..22d750c9 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -212,6 +212,7 @@ export default { 'Вы уверены, что хотите отписаться от этого пользователя?', 'Recent Supporters': 'Недавние спонсоры', 'Seen on': 'Просмотрено на', - 'Temporarily display this reply': 'Временно отобразить этот ответ' + 'Temporarily display this reply': 'Временно отобразить этот ответ', + 'Not found the note': 'Заметка не найдена' } } diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index 8fc5fe29..d481377f 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -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': '未找到该笔记' } } diff --git a/src/pages/secondary/NotePage/index.tsx b/src/pages/secondary/NotePage/index.tsx index 33c9e7af..2faf07e5 100644 --- a/src/pages/secondary/NotePage/index.tsx +++ b/src/pages/secondary/NotePage/index.tsx @@ -113,7 +113,7 @@ function ParentNote({ eventId }: { eventId?: string }) { return (
- {t('Not found')} + [{t('Not found the note')}]
@@ -130,10 +130,10 @@ function ParentNote({ eventId }: { eventId?: string }) { -
[{t('This user has been muted')}]
+
[{t('This user has been muted')}]
@@ -149,7 +149,7 @@ function ParentNote({ eventId }: { eventId?: string }) {