Browse Source

feat: improve the preview effect when note is not found

imwald
codytseng 1 year ago
parent
commit
5e3cd04280
  1. 3
      src/components/ContentPreview/index.tsx
  2. 2
      src/components/Embedded/EmbeddedNote.tsx
  3. 3
      src/i18n/locales/ar.ts
  4. 3
      src/i18n/locales/de.ts
  5. 3
      src/i18n/locales/en.ts
  6. 3
      src/i18n/locales/es.ts
  7. 3
      src/i18n/locales/fr.ts
  8. 3
      src/i18n/locales/ja.ts
  9. 3
      src/i18n/locales/pl.ts
  10. 3
      src/i18n/locales/pt-BR.ts
  11. 3
      src/i18n/locales/pt-PT.ts
  12. 3
      src/i18n/locales/ru.ts
  13. 3
      src/i18n/locales/zh.ts
  14. 8
      src/pages/secondary/NotePage/index.tsx

3
src/components/ContentPreview/index.tsx

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

2
src/components/Embedded/EmbeddedNote.tsx

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

3
src/i18n/locales/ar.ts

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

3
src/i18n/locales/de.ts

@ -212,6 +212,7 @@ export default {
'Möchtest du diesem Benutzer wirklich nicht mehr folgen?', 'Möchtest du diesem Benutzer wirklich nicht mehr folgen?',
'Recent Supporters': 'Neueste Unterstützer', 'Recent Supporters': 'Neueste Unterstützer',
'Seen on': 'Gesehen auf', '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'
} }
} }

3
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?', 'Are you sure you want to unfollow this user?': 'Are you sure you want to unfollow this user?',
'Recent Supporters': 'Recent Supporters', 'Recent Supporters': 'Recent Supporters',
'Seen on': 'Seen on', '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'
} }
} }

3
src/i18n/locales/es.ts

@ -212,6 +212,7 @@ export default {
'¿Estás seguro de que deseas dejar de seguir a este usuario?', '¿Estás seguro de que deseas dejar de seguir a este usuario?',
'Recent Supporters': 'Últimos patrocinadores', 'Recent Supporters': 'Últimos patrocinadores',
'Seen on': 'Visto en', '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'
} }
} }

3
src/i18n/locales/fr.ts

@ -211,6 +211,7 @@ export default {
'Êtes-vous sûr de vouloir arrêter de suivre cet utilisateur ?', 'Êtes-vous sûr de vouloir arrêter de suivre cet utilisateur ?',
'Recent Supporters': 'Derniers soutiens', 'Recent Supporters': 'Derniers soutiens',
'Seen on': 'Vu sur', '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'
} }
} }

3
src/i18n/locales/ja.ts

@ -209,6 +209,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': 'この返信を一時的に表示',
'Not found the note': 'ノートが見つかりません'
} }
} }

3
src/i18n/locales/pl.ts

@ -210,6 +210,7 @@ export default {
'Czy na pewno chcesz przestać obserwować tego użytkownika?', 'Czy na pewno chcesz przestać obserwować tego użytkownika?',
'Recent Supporters': 'Ostatni wspierający', 'Recent Supporters': 'Ostatni wspierający',
'Seen on': 'Widziany na', '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'
} }
} }

3
src/i18n/locales/pt-BR.ts

@ -210,6 +210,7 @@ export default {
'Tem certeza de que deseja deixar de seguir este usuário?', 'Tem certeza de que deseja deixar de seguir este usuário?',
'Recent Supporters': 'Apoiadores recentes', 'Recent Supporters': 'Apoiadores recentes',
'Seen on': 'Visto em', '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'
} }
} }

3
src/i18n/locales/pt-PT.ts

@ -211,6 +211,7 @@ export default {
'Tem certeza de que deseja deixar de seguir este usuário?', 'Tem certeza de que deseja deixar de seguir este usuário?',
'Recent Supporters': 'Apoiadores Recentes', 'Recent Supporters': 'Apoiadores Recentes',
'Seen on': 'Visto em', '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'
} }
} }

3
src/i18n/locales/ru.ts

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

3
src/i18n/locales/zh.ts

@ -209,6 +209,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': '临时显示此回复',
'Not found the note': '未找到该笔记'
} }
} }

8
src/pages/secondary/NotePage/index.tsx

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

Loading…
Cancel
Save