diff --git a/src/components/ClientTag/index.tsx b/src/components/ClientTag/index.tsx new file mode 100644 index 00000000..b441cc09 --- /dev/null +++ b/src/components/ClientTag/index.tsx @@ -0,0 +1,17 @@ +import { getUsingClient } from '@/lib/event' +import { NostrEvent } from 'nostr-tools' +import { useMemo } from 'react' +import { useTranslation } from 'react-i18next' + +export default function ClientTag({ event }: { event: NostrEvent }) { + const { t } = useTranslation() + const usingClient = useMemo(() => getUsingClient(event), [event]) + + if (!usingClient) return null + + return ( + + {t('via {{client}}', { client: usingClient })} + + ) +} diff --git a/src/components/Note/index.tsx b/src/components/Note/index.tsx index 211ca611..6552f753 100644 --- a/src/components/Note/index.tsx +++ b/src/components/Note/index.tsx @@ -1,6 +1,6 @@ import { useSecondaryPage } from '@/PageManager' import { ExtendedKind, SUPPORTED_KINDS } from '@/constants' -import { getParentBech32Id, getUsingClient, isNsfwEvent } from '@/lib/event' +import { getParentBech32Id, isNsfwEvent } from '@/lib/event' import { toNote } from '@/lib/link' import { useContentPolicy } from '@/providers/ContentPolicyProvider' import { useMuteList } from '@/providers/MuteListProvider' @@ -8,6 +8,7 @@ import { useScreenSize } from '@/providers/ScreenSizeProvider' import { Event, kinds } from 'nostr-tools' import { useMemo, useState } from 'react' import AudioPlayer from '../AudioPlayer' +import ClientTag from '../ClientTag' import Content from '../Content' import { FormattedTimestamp } from '../FormattedTimestamp' import Nip05 from '../Nip05' @@ -51,7 +52,6 @@ export default function Note({ () => (hideParentNotePreview ? undefined : getParentBech32Id(event)), [event, hideParentNotePreview] ) - const usingClient = useMemo(() => getUsingClient(event), [event]) const { defaultShowNsfw } = useContentPolicy() const [showNsfw, setShowNsfw] = useState(false) const { mutePubkeySet } = useMuteList() @@ -114,9 +114,7 @@ export default function Note({ className={`font-semibold flex truncate ${size === 'small' ? 'text-sm' : ''}`} skeletonClassName={size === 'small' ? 'h-3' : 'h-4'} /> - {usingClient && ( - using {usingClient} - )} +
diff --git a/src/components/ReplyNote/index.tsx b/src/components/ReplyNote/index.tsx index ac7c3352..915173de 100644 --- a/src/components/ReplyNote/index.tsx +++ b/src/components/ReplyNote/index.tsx @@ -1,7 +1,7 @@ import { useSecondaryPage } from '@/PageManager' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' -import { getUsingClient, isMentioningMutedUsers } from '@/lib/event' +import { isMentioningMutedUsers } from '@/lib/event' import { toNote } from '@/lib/link' import { useContentPolicy } from '@/providers/ContentPolicyProvider' import { useMuteList } from '@/providers/MuteListProvider' @@ -9,6 +9,7 @@ import { useScreenSize } from '@/providers/ScreenSizeProvider' import { Event } from 'nostr-tools' import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' +import ClientTag from '../ClientTag' import Collapsible from '../Collapsible' import Content from '../Content' import { FormattedTimestamp } from '../FormattedTimestamp' @@ -49,7 +50,6 @@ export default function ReplyNote({ } return true }, [showMuted, mutePubkeySet, event, hideContentMentioningMutedUsers]) - const usingClient = useMemo(() => getUsingClient(event), [event]) return (
- {usingClient && ( - - using {usingClient} - - )} +
diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index c843a901..c20c6adc 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -400,6 +400,7 @@ export default { Compact: 'مضغوط', 'Submit Relay': 'إرسال ريلاي', Homepage: 'الصفحة الرئيسية', - 'Proof of Work (difficulty {{minPow}})': 'إثبات العمل (الصعوبة {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'إثبات العمل (الصعوبة {{minPow}})', + 'via {{client}}': 'عبر {{client}}' } } diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index cffe474c..5e79fdbe 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -410,6 +410,7 @@ export default { Compact: 'Kompakt', 'Submit Relay': 'Relay einreichen', Homepage: 'Homepage', - 'Proof of Work (difficulty {{minPow}})': 'Arbeitsnachweis (Schwierigkeit {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Arbeitsnachweis (Schwierigkeit {{minPow}})', + 'via {{client}}': 'über {{client}}' } } diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index d1c6ce95..f60d8e8e 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -399,6 +399,7 @@ export default { Compact: 'Compact', 'Submit Relay': 'Submit Relay', Homepage: 'Homepage', - 'Proof of Work (difficulty {{minPow}})': 'Proof of Work (difficulty {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Proof of Work (difficulty {{minPow}})', + 'via {{client}}': 'via {{client}}' } } diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index e8de485a..ff008929 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -405,6 +405,7 @@ export default { Compact: 'Compacto', 'Submit Relay': 'Enviar relé', Homepage: 'Página principal', - 'Proof of Work (difficulty {{minPow}})': 'Prueba de Trabajo (dificultad {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Prueba de Trabajo (dificultad {{minPow}})', + 'via {{client}}': 'vía {{client}}' } } diff --git a/src/i18n/locales/fa.ts b/src/i18n/locales/fa.ts index a511c468..cf57bd67 100644 --- a/src/i18n/locales/fa.ts +++ b/src/i18n/locales/fa.ts @@ -401,6 +401,7 @@ export default { Compact: 'فشرده', 'Submit Relay': 'ارسال رله', Homepage: 'صفحه اصلی', - 'Proof of Work (difficulty {{minPow}})': 'اثبات کار (دشواری {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'اثبات کار (دشواری {{minPow}})', + 'via {{client}}': 'از طریق {{client}}' } } diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index fc048f53..d5ea1453 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -410,6 +410,7 @@ export default { Compact: 'Compact', 'Submit Relay': 'Soumettre un relais', Homepage: 'Page d’accueil', - 'Proof of Work (difficulty {{minPow}})': 'Preuve de travail (difficulté {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Preuve de travail (difficulté {{minPow}})', + 'via {{client}}': 'via {{client}}' } } diff --git a/src/i18n/locales/hi.ts b/src/i18n/locales/hi.ts index 7fe6a348..ca080952 100644 --- a/src/i18n/locales/hi.ts +++ b/src/i18n/locales/hi.ts @@ -404,6 +404,7 @@ export default { Compact: 'संक्षिप्त', 'Submit Relay': 'रिले सबमिट करें', Homepage: 'होमपेज', - 'Proof of Work (difficulty {{minPow}})': 'कार्य प्रमाण (कठिनाई {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'कार्य प्रमाण (कठिनाई {{minPow}})', + 'via {{client}}': 'के माध्यम से {{client}}' } } diff --git a/src/i18n/locales/it.ts b/src/i18n/locales/it.ts index 9a8232f4..e99cd131 100644 --- a/src/i18n/locales/it.ts +++ b/src/i18n/locales/it.ts @@ -405,6 +405,7 @@ export default { Compact: 'Compatto', 'Submit Relay': 'Invia Relay', Homepage: 'Homepage', - 'Proof of Work (difficulty {{minPow}})': 'Proof of Work (difficoltà {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Proof of Work (difficoltà {{minPow}})', + 'via {{client}}': 'tramite {{client}}' } } diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index 183b712d..8131a7f5 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -402,6 +402,7 @@ export default { Compact: 'コンパクト', 'Submit Relay': 'リレーを提出', Homepage: 'ホームページ', - 'Proof of Work (difficulty {{minPow}})': 'プルーフオブワーク (難易度 {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'プルーフオブワーク (難易度 {{minPow}})', + 'via {{client}}': '{{client}} 経由' } } diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index 58245c83..dcd42476 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -402,6 +402,7 @@ export default { Compact: '간단', 'Submit Relay': '릴레이 제출', Homepage: '홈페이지', - 'Proof of Work (difficulty {{minPow}})': '작업 증명 (난이도 {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': '작업 증명 (난이도 {{minPow}})', + 'via {{client}}': '{{client}} 통해' } } diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index 3131ff5c..23b13701 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -406,6 +406,7 @@ export default { Compact: 'Zwięzły', 'Submit Relay': 'Prześlij przekaźnik', Homepage: 'Strona główna', - 'Proof of Work (difficulty {{minPow}})': 'Dowód pracy (trudność {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Dowód pracy (trudność {{minPow}})', + 'via {{client}}': 'przez {{client}}' } } diff --git a/src/i18n/locales/pt-BR.ts b/src/i18n/locales/pt-BR.ts index 8b0bd72c..6293d714 100644 --- a/src/i18n/locales/pt-BR.ts +++ b/src/i18n/locales/pt-BR.ts @@ -402,6 +402,7 @@ export default { Compact: 'Compacto', 'Submit Relay': 'Enviar Relay', Homepage: 'Página inicial', - 'Proof of Work (difficulty {{minPow}})': 'Prova de Trabalho (dificuldade {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Prova de Trabalho (dificuldade {{minPow}})', + 'via {{client}}': 'via {{client}}' } } diff --git a/src/i18n/locales/pt-PT.ts b/src/i18n/locales/pt-PT.ts index f3109719..7533644b 100644 --- a/src/i18n/locales/pt-PT.ts +++ b/src/i18n/locales/pt-PT.ts @@ -405,6 +405,7 @@ export default { Compact: 'Compacto', 'Submit Relay': 'Enviar Relay', Homepage: 'Página inicial', - 'Proof of Work (difficulty {{minPow}})': 'Prova de Trabalho (dificuldade {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Prova de Trabalho (dificuldade {{minPow}})', + 'via {{client}}': 'via {{client}}' } } diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 587df222..552cd072 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -407,6 +407,7 @@ export default { Compact: 'Компактный', 'Submit Relay': 'Отправить релей', Homepage: 'Домашняя страница', - 'Proof of Work (difficulty {{minPow}})': 'Доказательство работы (сложность {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'Доказательство работы (сложность {{minPow}})', + 'via {{client}}': 'через {{client}}' } } diff --git a/src/i18n/locales/th.ts b/src/i18n/locales/th.ts index ae563b69..5167c200 100644 --- a/src/i18n/locales/th.ts +++ b/src/i18n/locales/th.ts @@ -397,6 +397,7 @@ export default { Compact: 'กะทัดรัด', 'Submit Relay': 'ส่งรีเลย์', Homepage: 'หน้าแรก', - 'Proof of Work (difficulty {{minPow}})': 'หลักฐานการทำงาน (ความยาก {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': 'หลักฐานการทำงาน (ความยาก {{minPow}})', + 'via {{client}}': 'ผ่าน {{client}}' } } diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index c5f422ab..f2f4f85e 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -395,6 +395,7 @@ export default { Compact: '紧凑', 'Submit Relay': '提交服务器', Homepage: '主页', - 'Proof of Work (difficulty {{minPow}})': '工作量证明 (难度 {{minPow}})' + 'Proof of Work (difficulty {{minPow}})': '工作量证明 (难度 {{minPow}})', + 'via {{client}}': '来自 {{client}}' } }