fix: 🐛
This commit is contained in:
@@ -35,13 +35,13 @@ export default function Content({
|
||||
<span className={cn('pointer-events-none', className)}>
|
||||
{nodes.map((node, index) => {
|
||||
if (node.type === 'image' || node.type === 'images') {
|
||||
return index > 0 ? ` [${t('image')}]` : `[${t('image')}]`
|
||||
return index > 0 ? ` [${t('Image')}]` : `[${t('Image')}]`
|
||||
}
|
||||
if (node.type === 'media') {
|
||||
return index > 0 ? ` [${t('media')}]` : `[${t('media')}]`
|
||||
return index > 0 ? ` [${t('Media')}]` : `[${t('Media')}]`
|
||||
}
|
||||
if (node.type === 'event') {
|
||||
return index > 0 ? ` [${t('note')}]` : `[${t('note')}]`
|
||||
return index > 0 ? ` [${t('Note')}]` : `[${t('Note')}]`
|
||||
}
|
||||
if (node.type === 'mention') {
|
||||
return <EmbeddedMentionText key={index} userId={node.data.split(':')[1]} />
|
||||
|
||||
19
src/components/ContentPreview/PictureNotePreview.tsx
Normal file
19
src/components/ContentPreview/PictureNotePreview.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Event } from 'nostr-tools'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export default function PictureNotePreview({
|
||||
event,
|
||||
className
|
||||
}: {
|
||||
event: Event
|
||||
className?: string
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className={cn('pointer-events-none', className)}>
|
||||
[{t('Image')}] <span className="italic pr-0.5">{event.content}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
19
src/components/ContentPreview/VideoNotePreview.tsx
Normal file
19
src/components/ContentPreview/VideoNotePreview.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Event } from 'nostr-tools'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export default function VideoNotePreview({
|
||||
event,
|
||||
className
|
||||
}: {
|
||||
event: Event
|
||||
className?: string
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className={cn('pointer-events-none', className)}>
|
||||
[{t('Media')}] <span className="italic pr-0.5">{event.content}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -10,7 +10,9 @@ import HighlightPreview from './HighlightPreview'
|
||||
import LiveEventPreview from './LiveEventPreview'
|
||||
import LongFormArticlePreview from './LongFormArticlePreview'
|
||||
import NormalContentPreview from './NormalContentPreview'
|
||||
import PictureNotePreview from './PictureNotePreview'
|
||||
import PollPreview from './PollPreview'
|
||||
import VideoNotePreview from './VideoNotePreview'
|
||||
|
||||
export default function ContentPreview({
|
||||
event,
|
||||
@@ -40,7 +42,6 @@ export default function ContentPreview({
|
||||
[
|
||||
kinds.ShortTextNote,
|
||||
ExtendedKind.COMMENT,
|
||||
ExtendedKind.PICTURE,
|
||||
ExtendedKind.VOICE,
|
||||
ExtendedKind.VOICE_COMMENT
|
||||
].includes(event.kind)
|
||||
@@ -60,6 +61,14 @@ export default function ContentPreview({
|
||||
return <LongFormArticlePreview event={event} className={className} />
|
||||
}
|
||||
|
||||
if (event.kind === ExtendedKind.VIDEO || event.kind === ExtendedKind.SHORT_VIDEO) {
|
||||
return <VideoNotePreview event={event} className={className} />
|
||||
}
|
||||
|
||||
if (event.kind === ExtendedKind.PICTURE) {
|
||||
return <PictureNotePreview event={event} className={className} />
|
||||
}
|
||||
|
||||
if (event.kind === ExtendedKind.GROUP_METADATA) {
|
||||
return <GroupMetadataPreview event={event} className={className} />
|
||||
}
|
||||
|
||||
@@ -49,14 +49,10 @@ export default function KindFilter({
|
||||
}
|
||||
|
||||
const newShowKinds = [...temporaryShowKinds].sort()
|
||||
let isSame = true
|
||||
for (let index = 0; index < newShowKinds.length; index++) {
|
||||
if (showKinds[index] !== newShowKinds[index]) {
|
||||
isSame = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!isSame) {
|
||||
if (
|
||||
newShowKinds.length !== showKinds.length ||
|
||||
newShowKinds.some((k, i) => k !== showKinds[i])
|
||||
) {
|
||||
onShowKindsChange(newShowKinds)
|
||||
}
|
||||
|
||||
@@ -95,6 +91,7 @@ export default function KindFilter({
|
||||
checked ? 'border-primary bg-primary/20' : 'clickable'
|
||||
)}
|
||||
onClick={() => {
|
||||
console.log(checked)
|
||||
if (!checked) {
|
||||
// add all kinds in this group
|
||||
setTemporaryShowKinds((prev) => Array.from(new Set([...prev, ...kindGroup])))
|
||||
|
||||
@@ -58,7 +58,14 @@ export default function Note({
|
||||
const [showMuted, setShowMuted] = useState(false)
|
||||
|
||||
let content: React.ReactNode
|
||||
if (!SUPPORTED_KINDS.includes(event.kind)) {
|
||||
if (
|
||||
![
|
||||
...SUPPORTED_KINDS,
|
||||
kinds.CommunityDefinition,
|
||||
kinds.LiveEvent,
|
||||
ExtendedKind.GROUP_METADATA
|
||||
].includes(event.kind)
|
||||
) {
|
||||
content = <UnknownNote className="mt-2" event={event} />
|
||||
} else if (mutePubkeys.includes(event.pubkey) && !showMuted) {
|
||||
content = <MutedNote show={() => setShowMuted(true)} />
|
||||
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
'ملاحظة خاصة للعملاء المعتمدين على الصور مثل Olas',
|
||||
'Picture note requires images': 'ملاحظة الصورة تتطلب صور',
|
||||
Relays: 'الريلايات',
|
||||
image: 'صورة',
|
||||
Image: 'صورة',
|
||||
'R & W': 'قراءة وكتابة',
|
||||
Read: 'قراءة',
|
||||
Write: 'كتابة',
|
||||
@@ -314,7 +314,7 @@ export default {
|
||||
'Remove poll': 'إزالة الاستطلاع',
|
||||
'Refresh results': 'تحديث النتائج',
|
||||
Poll: 'استطلاع',
|
||||
media: 'الوسائط',
|
||||
Media: 'الوسائط',
|
||||
'Broadcast to ...': 'البث إلى...',
|
||||
'Successfully broadcasted to your write relays': 'تم البث بنجاح إلى مرحلات الكتابة الخاصة بك',
|
||||
'Failed to broadcast to your write relays: {{error}}':
|
||||
|
||||
@@ -111,7 +111,7 @@ export default {
|
||||
'Eine spezielle Notiz für bildfokussierte Clients wie Olas',
|
||||
'Picture note requires images': 'Bildnotiz erfordert Bilder',
|
||||
Relays: 'Relays',
|
||||
image: 'Bild',
|
||||
Image: 'Bild',
|
||||
'R & W': 'R & W',
|
||||
Read: 'Lesen',
|
||||
Write: 'Schreiben',
|
||||
@@ -321,7 +321,7 @@ export default {
|
||||
'Remove poll': 'Umfrage entfernen',
|
||||
'Refresh results': 'Ergebnisse aktualisieren',
|
||||
Poll: 'Umfrage',
|
||||
media: 'Medien',
|
||||
Media: 'Medien',
|
||||
'Broadcast to ...': 'Senden an...',
|
||||
'Successfully broadcasted to your write relays': 'Erfolgreich an Ihre Schreibrelays gesendet',
|
||||
'Failed to broadcast to your write relays: {{error}}':
|
||||
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
'A special note for picture-first clients like Olas',
|
||||
'Picture note requires images': 'Picture note requires images',
|
||||
Relays: 'Relays',
|
||||
image: 'image',
|
||||
Image: 'Image',
|
||||
'R & W': 'R & W',
|
||||
Read: 'Read',
|
||||
Write: 'Write',
|
||||
@@ -314,7 +314,7 @@ export default {
|
||||
'Remove poll': 'Remove poll',
|
||||
'Refresh results': 'Refresh results',
|
||||
Poll: 'Poll',
|
||||
media: 'media',
|
||||
Media: 'Media',
|
||||
'Broadcast to ...': 'Broadcast to ...',
|
||||
'Successfully broadcasted to your write relays':
|
||||
'Successfully broadcasted to your write relays',
|
||||
|
||||
@@ -111,7 +111,7 @@ export default {
|
||||
'Una nota especial para clientes que priorizan imagen, como Olas',
|
||||
'Picture note requires images': 'La nota con imagen requiere imágenes',
|
||||
Relays: 'Relés',
|
||||
image: 'imagen',
|
||||
Image: 'imagen',
|
||||
'R & W': 'L y E',
|
||||
Read: 'Leer',
|
||||
Write: 'Escribir',
|
||||
@@ -319,7 +319,7 @@ export default {
|
||||
'Remove poll': 'Eliminar encuesta',
|
||||
'Refresh results': 'Actualizar resultados',
|
||||
Poll: 'Encuesta',
|
||||
media: 'medios',
|
||||
Media: 'medios',
|
||||
'Broadcast to ...': 'Transmitir a...',
|
||||
'Successfully broadcasted to your write relays':
|
||||
'Transmitido exitosamente a sus relés de escritura',
|
||||
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
'یادداشت ویژه برای کلاینتهای تصویر محور مانند Olas',
|
||||
'Picture note requires images': 'یادداشت تصویری نیاز به تصاویر دارد',
|
||||
Relays: 'رلهها',
|
||||
image: 'تصویر',
|
||||
Image: 'تصویر',
|
||||
'R & W': 'خواندن و نوشتن',
|
||||
Read: 'خواندن',
|
||||
Write: 'نوشتن',
|
||||
@@ -316,7 +316,7 @@ export default {
|
||||
'Remove poll': 'حذف نظرسنجی',
|
||||
'Refresh results': 'بارگیری مجدد نتایج',
|
||||
Poll: 'نظرسنجی',
|
||||
media: 'رسانه',
|
||||
Media: 'رسانه',
|
||||
'Broadcast to ...': 'پخش به...',
|
||||
'Successfully broadcasted to your write relays': 'با موفقیت به رلههای نوشتن شما پخش شد',
|
||||
'Failed to broadcast to your write relays: {{error}}':
|
||||
|
||||
@@ -111,7 +111,7 @@ export default {
|
||||
"Une note spéciale pour les clients axés sur l'image comme Olas",
|
||||
'Picture note requires images': 'La note image nécessite des images',
|
||||
Relays: 'Relais',
|
||||
image: 'image',
|
||||
Image: 'image',
|
||||
'R & W': 'R & W',
|
||||
Read: 'Lire',
|
||||
Write: 'Écrire',
|
||||
@@ -320,7 +320,7 @@ export default {
|
||||
'Remove poll': 'Supprimer le sondage',
|
||||
'Refresh results': 'Rafraîchir les résultats',
|
||||
Poll: 'Sondage',
|
||||
media: 'média',
|
||||
Media: 'média',
|
||||
'Broadcast to ...': 'Diffuser vers...',
|
||||
'Successfully broadcasted to your write relays': "Diffusion réussie vers vos relais d'écriture",
|
||||
'Failed to broadcast to your write relays: {{error}}':
|
||||
|
||||
@@ -111,7 +111,7 @@ export default {
|
||||
'Una nota speciale per i client immagine che privilegiano Olas',
|
||||
'Picture note requires images': 'La nota illustrativa richiede immagini',
|
||||
Relays: 'Relays',
|
||||
image: 'immagine',
|
||||
Image: 'immagine',
|
||||
'R & W': 'L & S',
|
||||
Read: 'Leggi',
|
||||
Write: 'Scrivi',
|
||||
@@ -318,7 +318,7 @@ export default {
|
||||
'Remove poll': 'Rimuovi sondaggio',
|
||||
'Refresh results': 'Aggiorna risultati',
|
||||
Poll: 'Sondaggio',
|
||||
media: 'media',
|
||||
Media: 'media',
|
||||
'Broadcast to ...': 'Trasmetti a...',
|
||||
'Successfully broadcasted to your write relays':
|
||||
'Trasmesso con successo ai tuoi relay di scrittura',
|
||||
|
||||
@@ -111,7 +111,7 @@ export default {
|
||||
'Olas のような画像優先クライアント向けの特別なノート',
|
||||
'Picture note requires images': '画像ノートには画像が必要です',
|
||||
Relays: 'リレイ',
|
||||
image: '画像',
|
||||
Image: '画像',
|
||||
'R & W': '読&書',
|
||||
Read: '読む',
|
||||
Write: '書く',
|
||||
@@ -316,7 +316,7 @@ export default {
|
||||
'Remove poll': '投票を削除',
|
||||
'Refresh results': '結果を更新',
|
||||
Poll: '投票',
|
||||
media: 'メディア',
|
||||
Media: 'メディア',
|
||||
'Broadcast to ...': 'ブロードキャスト先...',
|
||||
'Successfully broadcasted to your write relays': '書きリレイへのブロードキャストが成功しました',
|
||||
'Failed to broadcast to your write relays: {{error}}':
|
||||
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
'Olas와 같은 사진 우선 클라이언트에서 표시되는 특별한 노트',
|
||||
'Picture note requires images': '사진 노트에는 이미지가 필요합니다',
|
||||
Relays: '릴레이',
|
||||
image: '이미지',
|
||||
Image: '이미지',
|
||||
Normal: '일반',
|
||||
'R & W': '읽기/쓰기',
|
||||
Read: '읽기 전용',
|
||||
@@ -316,7 +316,7 @@ export default {
|
||||
'Remove poll': '투표 제거',
|
||||
'Refresh results': '결과 새로 고침',
|
||||
Poll: '투표',
|
||||
media: '미디어',
|
||||
Media: '미디어',
|
||||
'Broadcast to ...': '브로드캐스트 대상...',
|
||||
'Successfully broadcasted to your write relays': '쓰기 릴레이로 브로드캐스트에 성공했습니다',
|
||||
'Failed to broadcast to your write relays: {{error}}':
|
||||
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
'Publikacja ze zdjęciami i opisem dla klientów takich jak Olas',
|
||||
'Picture note requires images': 'Wpis graficzny wymaga obrazów',
|
||||
Relays: 'Transmitery',
|
||||
image: 'grafika',
|
||||
Image: 'grafika',
|
||||
'R & W': 'O & Z',
|
||||
Read: 'Odczyt',
|
||||
Write: 'Zapis',
|
||||
@@ -318,7 +318,7 @@ export default {
|
||||
'Remove poll': 'Usuń ankietę',
|
||||
'Refresh results': 'Odśwież wyniki',
|
||||
Poll: 'Ankieta',
|
||||
media: 'media',
|
||||
Media: 'media',
|
||||
'Broadcast to ...': 'Transmituj do...',
|
||||
'Successfully broadcasted to your write relays':
|
||||
'Pomyślnie transmitowano do twoich przekaźników zapisu',
|
||||
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
'Uma nota especial para clientes que priorizam imagens, como Olas',
|
||||
'Picture note requires images': 'Nota de imagem requer imagens',
|
||||
Relays: 'Relés',
|
||||
image: 'imagem',
|
||||
Image: 'imagem',
|
||||
'R & W': 'Leitura & Escrita',
|
||||
Read: 'Leitura',
|
||||
Write: 'Escrita',
|
||||
@@ -317,7 +317,7 @@ export default {
|
||||
'Remove poll': 'Remover enquete',
|
||||
'Refresh results': 'Atualizar resultados',
|
||||
Poll: 'Enquete',
|
||||
media: 'Mídia',
|
||||
Media: 'Mídia',
|
||||
'Broadcast to ...': 'Transmitir para...',
|
||||
'Successfully broadcasted to your write relays':
|
||||
'Transmitido com sucesso para seus relays de escrita',
|
||||
|
||||
@@ -111,7 +111,7 @@ export default {
|
||||
'Uma nota especial para clientes que priorizam imagens, como Olas',
|
||||
'Picture note requires images': 'Nota de imagem requer imagens',
|
||||
Relays: 'Relés',
|
||||
image: 'imagem',
|
||||
Image: 'imagem',
|
||||
'R & W': 'Leitura & Escrita',
|
||||
Read: 'Ler',
|
||||
Write: 'Escrever',
|
||||
@@ -318,7 +318,7 @@ export default {
|
||||
'Remove poll': 'Remover sondagem',
|
||||
'Refresh results': 'Atualizar resultados',
|
||||
Poll: 'Sondagem',
|
||||
media: 'mídia',
|
||||
Media: 'mídia',
|
||||
'Broadcast to ...': 'Transmitir para...',
|
||||
'Successfully broadcasted to your write relays':
|
||||
'Transmitido com sucesso para os seus relays de escrita',
|
||||
|
||||
@@ -112,7 +112,7 @@ export default {
|
||||
'Особенная заметка для клиентов с приоритетом изображений, таких как Olas',
|
||||
'Picture note requires images': 'Заметка с изображением требует наличия изображений',
|
||||
Relays: 'Ретрансляторы',
|
||||
image: 'изображение',
|
||||
Image: 'изображение',
|
||||
'R & W': 'Чтение & Запись',
|
||||
Read: 'Читать',
|
||||
Write: 'Писать',
|
||||
@@ -319,7 +319,7 @@ export default {
|
||||
'Remove poll': 'Удалить опрос',
|
||||
'Refresh results': 'Обновить результаты',
|
||||
Poll: 'Опрос',
|
||||
media: 'медиа',
|
||||
Media: 'медиа',
|
||||
'Broadcast to ...': 'Транслировать в...',
|
||||
'Successfully broadcasted to your write relays': 'Успешно транслировано в ваши релеи записи',
|
||||
'Failed to broadcast to your write relays: {{error}}':
|
||||
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
'หมายเหตุพิเศษสำหรับไคลเอนต์ที่เน้นรูปภาพเช่น Olas',
|
||||
'Picture note requires images': 'โน้ตรูปภาพต้องมีรูปภาพ',
|
||||
Relays: 'รีเลย์',
|
||||
image: 'รูปภาพ',
|
||||
Image: 'รูปภาพ',
|
||||
'R & W': 'อ่าน & เขียน',
|
||||
Read: 'อ่าน',
|
||||
Write: 'เขียน',
|
||||
@@ -313,7 +313,7 @@ export default {
|
||||
'Remove poll': 'ลบโพลล์',
|
||||
'Refresh results': 'รีเฟรชผลลัพธ์',
|
||||
Poll: 'โพลล์',
|
||||
media: 'สื่อ',
|
||||
Media: 'สื่อ',
|
||||
'Broadcast to ...': 'ส่งสัญญาณไปยัง...',
|
||||
'Successfully broadcasted to your write relays': 'ส่งสัญญาณไปยังรีเลย์การเขียนของคุณสำเร็จแล้ว',
|
||||
'Failed to broadcast to your write relays: {{error}}':
|
||||
|
||||
@@ -109,7 +109,7 @@ export default {
|
||||
'一种可以在图片优先客户端 (如 Olas) 中显示的特殊笔记',
|
||||
'Picture note requires images': '图片笔记需要有图片',
|
||||
Relays: '服务器',
|
||||
image: '图片',
|
||||
Image: '图片',
|
||||
Normal: '普通',
|
||||
'R & W': '读写',
|
||||
Read: '只读',
|
||||
@@ -314,7 +314,7 @@ export default {
|
||||
'Remove poll': '移除投票',
|
||||
'Refresh results': '刷新结果',
|
||||
Poll: '投票',
|
||||
media: '媒体',
|
||||
Media: '媒体',
|
||||
'Broadcast to ...': '广播到...',
|
||||
'Successfully broadcasted to your write relays': '成功广播到您的写服务器',
|
||||
'Failed to broadcast to your write relays: {{error}}': '广播到您的写服务器失败:{{error}}',
|
||||
|
||||
Reference in New Issue
Block a user