Browse Source

feat: 💨

imwald
codytseng 6 months ago
parent
commit
6571468150
  1. 17
      src/components/ClientTag/index.tsx
  2. 8
      src/components/Note/index.tsx
  3. 10
      src/components/ReplyNote/index.tsx
  4. 3
      src/i18n/locales/ar.ts
  5. 3
      src/i18n/locales/de.ts
  6. 3
      src/i18n/locales/en.ts
  7. 3
      src/i18n/locales/es.ts
  8. 3
      src/i18n/locales/fa.ts
  9. 3
      src/i18n/locales/fr.ts
  10. 3
      src/i18n/locales/hi.ts
  11. 3
      src/i18n/locales/it.ts
  12. 3
      src/i18n/locales/ja.ts
  13. 3
      src/i18n/locales/ko.ts
  14. 3
      src/i18n/locales/pl.ts
  15. 3
      src/i18n/locales/pt-BR.ts
  16. 3
      src/i18n/locales/pt-PT.ts
  17. 3
      src/i18n/locales/ru.ts
  18. 3
      src/i18n/locales/th.ts
  19. 3
      src/i18n/locales/zh.ts

17
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 (
<span className="text-sm text-muted-foreground shrink-0">
{t('via {{client}}', { client: usingClient })}
</span>
)
}

8
src/components/Note/index.tsx

@ -1,6 +1,6 @@
import { useSecondaryPage } from '@/PageManager' import { useSecondaryPage } from '@/PageManager'
import { ExtendedKind, SUPPORTED_KINDS } from '@/constants' 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 { toNote } from '@/lib/link'
import { useContentPolicy } from '@/providers/ContentPolicyProvider' import { useContentPolicy } from '@/providers/ContentPolicyProvider'
import { useMuteList } from '@/providers/MuteListProvider' import { useMuteList } from '@/providers/MuteListProvider'
@ -8,6 +8,7 @@ import { useScreenSize } from '@/providers/ScreenSizeProvider'
import { Event, kinds } from 'nostr-tools' import { Event, kinds } from 'nostr-tools'
import { useMemo, useState } from 'react' import { useMemo, useState } from 'react'
import AudioPlayer from '../AudioPlayer' import AudioPlayer from '../AudioPlayer'
import ClientTag from '../ClientTag'
import Content from '../Content' import Content from '../Content'
import { FormattedTimestamp } from '../FormattedTimestamp' import { FormattedTimestamp } from '../FormattedTimestamp'
import Nip05 from '../Nip05' import Nip05 from '../Nip05'
@ -51,7 +52,6 @@ export default function Note({
() => (hideParentNotePreview ? undefined : getParentBech32Id(event)), () => (hideParentNotePreview ? undefined : getParentBech32Id(event)),
[event, hideParentNotePreview] [event, hideParentNotePreview]
) )
const usingClient = useMemo(() => getUsingClient(event), [event])
const { defaultShowNsfw } = useContentPolicy() const { defaultShowNsfw } = useContentPolicy()
const [showNsfw, setShowNsfw] = useState(false) const [showNsfw, setShowNsfw] = useState(false)
const { mutePubkeySet } = useMuteList() const { mutePubkeySet } = useMuteList()
@ -114,9 +114,7 @@ export default function Note({
className={`font-semibold flex truncate ${size === 'small' ? 'text-sm' : ''}`} className={`font-semibold flex truncate ${size === 'small' ? 'text-sm' : ''}`}
skeletonClassName={size === 'small' ? 'h-3' : 'h-4'} skeletonClassName={size === 'small' ? 'h-3' : 'h-4'}
/> />
{usingClient && ( <ClientTag event={event} />
<span className="text-sm text-muted-foreground shrink-0">using {usingClient}</span>
)}
</div> </div>
<div className="flex items-center gap-1 text-sm text-muted-foreground"> <div className="flex items-center gap-1 text-sm text-muted-foreground">
<Nip05 pubkey={event.pubkey} append="·" /> <Nip05 pubkey={event.pubkey} append="·" />

10
src/components/ReplyNote/index.tsx

@ -1,7 +1,7 @@
import { useSecondaryPage } from '@/PageManager' import { useSecondaryPage } from '@/PageManager'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Skeleton } from '@/components/ui/skeleton' import { Skeleton } from '@/components/ui/skeleton'
import { getUsingClient, isMentioningMutedUsers } from '@/lib/event' import { isMentioningMutedUsers } from '@/lib/event'
import { toNote } from '@/lib/link' import { toNote } from '@/lib/link'
import { useContentPolicy } from '@/providers/ContentPolicyProvider' import { useContentPolicy } from '@/providers/ContentPolicyProvider'
import { useMuteList } from '@/providers/MuteListProvider' import { useMuteList } from '@/providers/MuteListProvider'
@ -9,6 +9,7 @@ import { useScreenSize } from '@/providers/ScreenSizeProvider'
import { Event } from 'nostr-tools' import { Event } from 'nostr-tools'
import { useMemo, useState } from 'react' import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import ClientTag from '../ClientTag'
import Collapsible from '../Collapsible' import Collapsible from '../Collapsible'
import Content from '../Content' import Content from '../Content'
import { FormattedTimestamp } from '../FormattedTimestamp' import { FormattedTimestamp } from '../FormattedTimestamp'
@ -49,7 +50,6 @@ export default function ReplyNote({
} }
return true return true
}, [showMuted, mutePubkeySet, event, hideContentMentioningMutedUsers]) }, [showMuted, mutePubkeySet, event, hideContentMentioningMutedUsers])
const usingClient = useMemo(() => getUsingClient(event), [event])
return ( return (
<div <div
@ -68,11 +68,7 @@ export default function ReplyNote({
className="text-sm font-semibold text-muted-foreground hover:text-foreground truncate" className="text-sm font-semibold text-muted-foreground hover:text-foreground truncate"
skeletonClassName="h-3" skeletonClassName="h-3"
/> />
{usingClient && ( <ClientTag event={event} />
<span className="text-sm text-muted-foreground shrink-0">
using {usingClient}
</span>
)}
</div> </div>
<div className="flex items-center gap-1 text-sm text-muted-foreground"> <div className="flex items-center gap-1 text-sm text-muted-foreground">
<Nip05 pubkey={event.pubkey} append="·" /> <Nip05 pubkey={event.pubkey} append="·" />

3
src/i18n/locales/ar.ts

@ -400,6 +400,7 @@ export default {
Compact: 'مضغوط', Compact: 'مضغوط',
'Submit Relay': 'إرسال ريلاي', 'Submit Relay': 'إرسال ريلاي',
Homepage: 'الصفحة الرئيسية', Homepage: 'الصفحة الرئيسية',
'Proof of Work (difficulty {{minPow}})': 'إثبات العمل (الصعوبة {{minPow}})' 'Proof of Work (difficulty {{minPow}})': 'إثبات العمل (الصعوبة {{minPow}})',
'via {{client}}': 'عبر {{client}}'
} }
} }

3
src/i18n/locales/de.ts

@ -410,6 +410,7 @@ export default {
Compact: 'Kompakt', Compact: 'Kompakt',
'Submit Relay': 'Relay einreichen', 'Submit Relay': 'Relay einreichen',
Homepage: 'Homepage', Homepage: 'Homepage',
'Proof of Work (difficulty {{minPow}})': 'Arbeitsnachweis (Schwierigkeit {{minPow}})' 'Proof of Work (difficulty {{minPow}})': 'Arbeitsnachweis (Schwierigkeit {{minPow}})',
'via {{client}}': 'über {{client}}'
} }
} }

3
src/i18n/locales/en.ts

@ -399,6 +399,7 @@ export default {
Compact: 'Compact', Compact: 'Compact',
'Submit Relay': 'Submit Relay', 'Submit Relay': 'Submit Relay',
Homepage: 'Homepage', 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}}'
} }
} }

3
src/i18n/locales/es.ts

@ -405,6 +405,7 @@ export default {
Compact: 'Compacto', Compact: 'Compacto',
'Submit Relay': 'Enviar relé', 'Submit Relay': 'Enviar relé',
Homepage: 'Página principal', 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}}'
} }
} }

3
src/i18n/locales/fa.ts

@ -401,6 +401,7 @@ export default {
Compact: 'فشرده', Compact: 'فشرده',
'Submit Relay': 'ارسال رله', 'Submit Relay': 'ارسال رله',
Homepage: 'صفحه اصلی', Homepage: 'صفحه اصلی',
'Proof of Work (difficulty {{minPow}})': 'اثبات کار (دشواری {{minPow}})' 'Proof of Work (difficulty {{minPow}})': 'اثبات کار (دشواری {{minPow}})',
'via {{client}}': 'از طریق {{client}}'
} }
} }

3
src/i18n/locales/fr.ts

@ -410,6 +410,7 @@ export default {
Compact: 'Compact', Compact: 'Compact',
'Submit Relay': 'Soumettre un relais', 'Submit Relay': 'Soumettre un relais',
Homepage: 'Page d’accueil', 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}}'
} }
} }

3
src/i18n/locales/hi.ts

@ -404,6 +404,7 @@ export default {
Compact: 'सित', Compact: 'सित',
'Submit Relay': 'रि सबमिट कर', 'Submit Relay': 'रि सबमिट कर',
Homepage: 'हमपज', Homepage: 'हमपज',
'Proof of Work (difficulty {{minPow}})': 'कय परमण (कठिई {{minPow}})' 'Proof of Work (difficulty {{minPow}})': 'कय परमण (कठिई {{minPow}})',
'via {{client}}': 'कयम स {{client}}'
} }
} }

3
src/i18n/locales/it.ts

@ -405,6 +405,7 @@ export default {
Compact: 'Compatto', Compact: 'Compatto',
'Submit Relay': 'Invia Relay', 'Submit Relay': 'Invia Relay',
Homepage: 'Homepage', 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}}'
} }
} }

3
src/i18n/locales/ja.ts

@ -402,6 +402,7 @@ export default {
Compact: 'コンパクト', Compact: 'コンパクト',
'Submit Relay': 'リレーを提出', 'Submit Relay': 'リレーを提出',
Homepage: 'ホームページ', Homepage: 'ホームページ',
'Proof of Work (difficulty {{minPow}})': 'プルーフオブワーク (難易度 {{minPow}})' 'Proof of Work (difficulty {{minPow}})': 'プルーフオブワーク (難易度 {{minPow}})',
'via {{client}}': '{{client}} 経由'
} }
} }

3
src/i18n/locales/ko.ts

@ -402,6 +402,7 @@ export default {
Compact: '간단', Compact: '간단',
'Submit Relay': '릴레이 제출', 'Submit Relay': '릴레이 제출',
Homepage: '홈페이지', Homepage: '홈페이지',
'Proof of Work (difficulty {{minPow}})': '작업 증명 (난이도 {{minPow}})' 'Proof of Work (difficulty {{minPow}})': '작업 증명 (난이도 {{minPow}})',
'via {{client}}': '{{client}} 통해'
} }
} }

3
src/i18n/locales/pl.ts

@ -406,6 +406,7 @@ export default {
Compact: 'Zwięzły', Compact: 'Zwięzły',
'Submit Relay': 'Prześlij przekaźnik', 'Submit Relay': 'Prześlij przekaźnik',
Homepage: 'Strona główna', 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}}'
} }
} }

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

@ -402,6 +402,7 @@ export default {
Compact: 'Compacto', Compact: 'Compacto',
'Submit Relay': 'Enviar Relay', 'Submit Relay': 'Enviar Relay',
Homepage: 'Página inicial', 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}}'
} }
} }

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

@ -405,6 +405,7 @@ export default {
Compact: 'Compacto', Compact: 'Compacto',
'Submit Relay': 'Enviar Relay', 'Submit Relay': 'Enviar Relay',
Homepage: 'Página inicial', 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}}'
} }
} }

3
src/i18n/locales/ru.ts

@ -407,6 +407,7 @@ export default {
Compact: 'Компактный', Compact: 'Компактный',
'Submit Relay': 'Отправить релей', 'Submit Relay': 'Отправить релей',
Homepage: 'Домашняя страница', Homepage: 'Домашняя страница',
'Proof of Work (difficulty {{minPow}})': 'Доказательство работы (сложность {{minPow}})' 'Proof of Work (difficulty {{minPow}})': 'Доказательство работы (сложность {{minPow}})',
'via {{client}}': 'через {{client}}'
} }
} }

3
src/i18n/locales/th.ts

@ -397,6 +397,7 @@ export default {
Compact: 'กะทดรด', Compact: 'กะทดรด',
'Submit Relay': 'สงรเลย', 'Submit Relay': 'สงรเลย',
Homepage: 'หนาแรก', Homepage: 'หนาแรก',
'Proof of Work (difficulty {{minPow}})': 'หลกฐานการทำงาน (ความยาก {{minPow}})' 'Proof of Work (difficulty {{minPow}})': 'หลกฐานการทำงาน (ความยาก {{minPow}})',
'via {{client}}': 'ผาน {{client}}'
} }
} }

3
src/i18n/locales/zh.ts

@ -395,6 +395,7 @@ export default {
Compact: '紧凑', Compact: '紧凑',
'Submit Relay': '提交服务器', 'Submit Relay': '提交服务器',
Homepage: '主页', Homepage: '主页',
'Proof of Work (difficulty {{minPow}})': '工作量证明 (难度 {{minPow}})' 'Proof of Work (difficulty {{minPow}})': '工作量证明 (难度 {{minPow}})',
'via {{client}}': '来自 {{client}}'
} }
} }

Loading…
Cancel
Save