diff --git a/src/components/StuffStats/TopZaps.tsx b/src/components/StuffStats/TopZaps.tsx index 294cfeb..12bba57 100644 --- a/src/components/StuffStats/TopZaps.tsx +++ b/src/components/StuffStats/TopZaps.tsx @@ -1,12 +1,14 @@ import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area' -import { useStuffStatsById } from '@/hooks/useStuffStatsById' import { useStuff } from '@/hooks/useStuff' +import { useStuffStatsById } from '@/hooks/useStuffStatsById' +import { createFakeEvent } from '@/lib/event' import { formatAmount } from '@/lib/lightning' import { Zap } from 'lucide-react' import { Event } from 'nostr-tools' import { useMemo, useState } from 'react' +import ContentPreview from '../ContentPreview' import { SimpleUserAvatar } from '../UserAvatar' -import ZapDialog from '../ZapDialog' +import ZapDetailDialog from '../ZapDetailDialog' export default function TopZaps({ stuff }: { stuff: Event | string }) { const { event, stuffKey } = useStuff(stuff) @@ -22,34 +24,35 @@ export default function TopZaps({ stuff }: { stuff: Event | string }) {
{topZaps.map((zap, index) => ( -
{ - e.stopPropagation() - setZapIndex(index) - }} - > - - -
{formatAmount(zap.amount)}
-
{zap.comment}
-
e.stopPropagation()}> - { - if (open) { - setZapIndex(index) - } else { - setZapIndex(-1) - } - }} - pubkey={event.pubkey} - event={event} - defaultAmount={zap.amount} - defaultComment={zap.comment} +
+
{ + e.stopPropagation() + setZapIndex(index) + }} + > + + +
{formatAmount(zap.amount)}
+
+ { + if (open) { + setZapIndex(index) + } else { + setZapIndex(-1) + } + }} + zap={zap} + />
))}
diff --git a/src/components/ZapDetailDialog/index.tsx b/src/components/ZapDetailDialog/index.tsx new file mode 100644 index 0000000..bd654a7 --- /dev/null +++ b/src/components/ZapDetailDialog/index.tsx @@ -0,0 +1,70 @@ +import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog' +import { Drawer, DrawerContent, DrawerHeader, DrawerTitle } from '@/components/ui/drawer' +import { formatAmount } from '@/lib/lightning' +import { Zap } from 'lucide-react' +import { Dispatch, SetStateAction } from 'react' +import { useTranslation } from 'react-i18next' +import { useScreenSize } from '@/providers/ScreenSizeProvider' +import UserAvatar from '../UserAvatar' +import Username from '../Username' +import Content from '../Content' +import { FormattedTimestamp } from '../FormattedTimestamp' + +interface ZapDetailDialogProps { + open: boolean + setOpen: Dispatch> + zap: { + pubkey: string + amount: number + comment?: string + created_at: number + } +} + +export default function ZapDetailDialog({ open, setOpen, zap }: ZapDetailDialogProps) { + const { t } = useTranslation() + const { isSmallScreen } = useScreenSize() + + const content = ( +
+
+ +
+ +
+ +
+
+
+ + {formatAmount(zap.amount)} +
+
+ {zap.comment && } +
+ ) + + if (isSmallScreen) { + return ( + + + + {t('Zap Details')} + + {content} + + + ) + } + + return ( + + e.stopPropagation()}> + + {t('Zap Details')} + + {content} + + + ) +} diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index 678634f..5c0f0d8 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -662,6 +662,7 @@ export default { 'تحذير: يرجى عدم تعديل هذه الإعدادات بشكل عشوائي، فقد يؤثر ذلك على تجربتك الأساسية.', 'Invalid relay URL': 'عنوان URL للمرحل غير صالح', 'Muted words': 'الكلمات المحظورة', - 'Add muted word': 'إضافة كلمة محظورة' + 'Add muted word': 'إضافة كلمة محظورة', + 'Zap Details': 'تفاصيل Zap' } } diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 47a183f..9c527a0 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -684,6 +684,7 @@ export default { 'Warnung: Ändern Sie diese Einstellungen nicht leichtfertig, da dies Ihre grundlegende Erfahrung beeinträchtigen kann.', 'Invalid relay URL': 'Ungültige Relay-URL', 'Muted words': 'Stummgeschaltete Wörter', - 'Add muted word': 'Stummgeschaltetes Wort hinzufügen' + 'Add muted word': 'Stummgeschaltetes Wort hinzufügen', + 'Zap Details': 'Zap-Details' } } diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 7cf5a19..c24f506 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -667,6 +667,7 @@ export default { 'Warning: Please do not modify these settings casually, as it may affect your basic experience.', 'Invalid relay URL': 'Invalid relay URL', 'Muted words': 'Muted words', - 'Add muted word': 'Add muted word' + 'Add muted word': 'Add muted word', + 'Zap Details': 'Zap Details' } } diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index a8cca24..06baa5e 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -678,6 +678,7 @@ export default { 'Advertencia: No modifiques estas configuraciones a la ligera, ya que puede afectar tu experiencia básica.', 'Invalid relay URL': 'URL de relé no válida', 'Muted words': 'Palabras silenciadas', - 'Add muted word': 'Agregar palabra silenciada' + 'Add muted word': 'Agregar palabra silenciada', + 'Zap Details': 'Detalles del Zap' } } diff --git a/src/i18n/locales/fa.ts b/src/i18n/locales/fa.ts index 82d72e9..e72717d 100644 --- a/src/i18n/locales/fa.ts +++ b/src/i18n/locales/fa.ts @@ -673,6 +673,7 @@ export default { 'هشدار: لطفاً این تنظیمات را به صورت تصادفی تغییر ندهید، ممکن است بر تجربه اولیه شما تأثیر بگذارد.', 'Invalid relay URL': 'آدرس URL رله نامعتبر است', 'Muted words': 'کلمات بی‌صدا شده', - 'Add muted word': 'افزودن کلمه بی‌صدا' + 'Add muted word': 'افزودن کلمه بی‌صدا', + 'Zap Details': 'جزئیات زپ' } } diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 9f2a788..3e5d6b7 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -682,6 +682,7 @@ export default { 'Attention : Ne modifiez pas ces paramètres à la légère, car cela pourrait affecter votre expérience de base.', 'Invalid relay URL': 'URL de relais non valide', 'Muted words': 'Mots masqués', - 'Add muted word': 'Ajouter un mot masqué' + 'Add muted word': 'Ajouter un mot masqué', + 'Zap Details': 'Détails du Zap' } } diff --git a/src/i18n/locales/hi.ts b/src/i18n/locales/hi.ts index 427e381..24bdfdc 100644 --- a/src/i18n/locales/hi.ts +++ b/src/i18n/locales/hi.ts @@ -674,6 +674,7 @@ export default { 'चेतावनी: कृपया इन सेटिंग्स को बेतरतीब ढंग से संशोधित न करें, क्योंकि यह आपके बुनियादी अनुभव को प्रभावित कर सकता है।', 'Invalid relay URL': 'अमान्य रिले URL', 'Muted words': 'म्यूट किए गए शब्द', - 'Add muted word': 'म्यूट शब्द जोड़ें' + 'Add muted word': 'म्यूट शब्द जोड़ें', + 'Zap Details': 'जैप विवरण' } } diff --git a/src/i18n/locales/hu.ts b/src/i18n/locales/hu.ts index e0dbf04..e8d8f99 100644 --- a/src/i18n/locales/hu.ts +++ b/src/i18n/locales/hu.ts @@ -667,6 +667,7 @@ export default { 'Figyelmeztetés: Ne módosítsa ezeket a beállításokat meggondolatlanul, mert ez befolyásolhatja az alapvető élményt.', 'Invalid relay URL': 'Érvénytelen továbbító URL', 'Muted words': 'Némított szavak', - 'Add muted word': 'Némított szó hozzáadása' + 'Add muted word': 'Némított szó hozzáadása', + 'Zap Details': 'Zap Részletek' } } diff --git a/src/i18n/locales/it.ts b/src/i18n/locales/it.ts index 0d3a817..5bb2251 100644 --- a/src/i18n/locales/it.ts +++ b/src/i18n/locales/it.ts @@ -678,6 +678,7 @@ export default { "Attenzione: Non modificare queste impostazioni alla leggera, potrebbe influire sull'esperienza di base.", 'Invalid relay URL': 'URL relay non valido', 'Muted words': 'Parole silenziate', - 'Add muted word': 'Aggiungi parola silenziata' + 'Add muted word': 'Aggiungi parola silenziata', + 'Zap Details': 'Dettagli Zap' } } diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index d94ed9e..dfa477a 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -672,6 +672,7 @@ export default { '警告:これらの設定を無闇に変更しないでください。基本的な体験に影響を与える可能性があります。', 'Invalid relay URL': '無効なリレーURL', 'Muted words': 'ミュートワード', - 'Add muted word': 'ミュートワードを追加' + 'Add muted word': 'ミュートワードを追加', + 'Zap Details': 'Zapの詳細' } } diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index 8db0d2e..599ccd5 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -668,6 +668,7 @@ export default { '경고: 이러한 설정을 임의로 수정하지 마십시오. 기본 경험에 영향을 줄 수 있습니다.', 'Invalid relay URL': '유효하지 않은 릴레이 URL', 'Muted words': '차단 단어', - 'Add muted word': '차단 단어 추가' + 'Add muted word': '차단 단어 추가', + 'Zap Details': '잽 세부 정보' } } diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index 18cb08b..eb025f6 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -679,6 +679,7 @@ export default { 'Ostrzeżenie: Nie modyfikuj tych ustawień pochopnie, może to wpłynąć na podstawowe doświadczenie.', 'Invalid relay URL': 'Nieprawidłowy adres URL przekaźnika', 'Muted words': 'Wyciszone słowa', - 'Add muted word': 'Dodaj wyciszone słowo' + 'Add muted word': 'Dodaj wyciszone słowo', + 'Zap Details': 'Szczegóły zapu' } } diff --git a/src/i18n/locales/pt-BR.ts b/src/i18n/locales/pt-BR.ts index 970a792..4e65b52 100644 --- a/src/i18n/locales/pt-BR.ts +++ b/src/i18n/locales/pt-BR.ts @@ -675,6 +675,7 @@ export default { 'Aviso: Não modifique essas configurações casualmente, pois pode afetar sua experiência básica.', 'Invalid relay URL': 'URL de relé inválida', 'Muted words': 'Palavras silenciadas', - 'Add muted word': 'Adicionar palavra silenciada' + 'Add muted word': 'Adicionar palavra silenciada', + 'Zap Details': 'Detalhes do Zap' } } diff --git a/src/i18n/locales/pt-PT.ts b/src/i18n/locales/pt-PT.ts index f1366c6..b7ab2eb 100644 --- a/src/i18n/locales/pt-PT.ts +++ b/src/i18n/locales/pt-PT.ts @@ -678,6 +678,7 @@ export default { 'Aviso: Não modifique estas configurações casualmente, pois pode afetar a sua experiência básica.', 'Invalid relay URL': 'URL de relay inválido', 'Muted words': 'Palavras silenciadas', - 'Add muted word': 'Adicionar palavra silenciada' + 'Add muted word': 'Adicionar palavra silenciada', + 'Zap Details': 'Detalhes do Zap' } } diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 86594e8..2a7b309 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -678,6 +678,7 @@ export default { 'Предупреждение: Не изменяйте эти настройки без необходимости, это может повлиять на базовый опыт использования.', 'Invalid relay URL': 'Неверный URL реле', 'Muted words': 'Заблокированные слова', - 'Add muted word': 'Добавить заблокированное слово' + 'Add muted word': 'Добавить заблокированное слово', + 'Zap Details': 'Детали запа' } } diff --git a/src/i18n/locales/th.ts b/src/i18n/locales/th.ts index 1caf5d7..fabc437 100644 --- a/src/i18n/locales/th.ts +++ b/src/i18n/locales/th.ts @@ -663,6 +663,7 @@ export default { 'คำเตือน: กรุณาอย่าแก้ไขการตั้งค่าเหล่านี้โดยไม่ระมัดระวัง เพราะอาจส่งผลต่อประสบการณ์พื้นฐานของคุณ', 'Invalid relay URL': 'URL รีเลย์ไม่ถูกต้อง', 'Muted words': 'คำที่ถูกปิดเสียง', - 'Add muted word': 'เพิ่มคำที่ถูกปิดเสียง' + 'Add muted word': 'เพิ่มคำที่ถูกปิดเสียง', + 'Zap Details': 'รายละเอียดซาตส์' } } diff --git a/src/i18n/locales/zh-TW.ts b/src/i18n/locales/zh-TW.ts index 2d29c23..14a39ab 100644 --- a/src/i18n/locales/zh-TW.ts +++ b/src/i18n/locales/zh-TW.ts @@ -646,6 +646,7 @@ export default { 'Default relays warning': '警告:請不要隨意修改這些設定,可能會影響基礎體驗。', 'Invalid relay URL': '無效的中繼地址', 'Muted words': '屏蔽詞', - 'Add muted word': '添加屏蔽詞' + 'Add muted word': '添加屏蔽詞', + 'Zap Details': '打閃詳情' } } diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index 617aa3d..ce74f16 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -651,6 +651,7 @@ export default { 'Default relays warning': '警告:请不要随意修改这些设置,可能会影响您的基本体验。', 'Invalid relay URL': '无效的中继地址', 'Muted words': '屏蔽词', - 'Add muted word': '添加屏蔽词' + 'Add muted word': '添加屏蔽词', + 'Zap Details': '打闪详情' } } diff --git a/src/services/stuff-stats.service.ts b/src/services/stuff-stats.service.ts index f0d3cc3..99e9b7a 100644 --- a/src/services/stuff-stats.service.ts +++ b/src/services/stuff-stats.service.ts @@ -329,7 +329,7 @@ class StuffStatsService { const info = getZapInfoFromEvent(evt) if (!info) return const { originalEventId, senderPubkey, invoice, amount, comment } = info - if (!originalEventId || !senderPubkey) return + if (!originalEventId || !senderPubkey || amount <= 0) return return this.addZap( senderPubkey,