feat: notification

This commit is contained in:
codytseng
2025-12-18 16:53:19 +08:00
parent 064c6e7923
commit acf136f321
20 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { Highlighter } from 'lucide-react'
import { Event } from 'nostr-tools'
import { useTranslation } from 'react-i18next'
import Notification from './Notification'
export function HighlightNotification({
notification,
isNew = false
}: {
notification: Event
isNew?: boolean
}) {
const { t } = useTranslation()
return (
<Notification
notificationId={notification.id}
icon={<Highlighter size={24} className="text-orange-400" />}
sender={notification.pubkey}
sentAt={notification.created_at}
targetEvent={notification}
description={t('highlighted your note')}
isNew={isNew}
/>
)
}

View File

@@ -6,6 +6,7 @@ import { useNostr } from '@/providers/NostrProvider'
import { useUserTrust } from '@/providers/UserTrustProvider'
import { Event, kinds } from 'nostr-tools'
import { useMemo } from 'react'
import { HighlightNotification } from './HighlightNotification'
import { MentionNotification } from './MentionNotification'
import { PollResponseNotification } from './PollResponseNotification'
import { ReactionNotification } from './ReactionNotification'
@@ -60,5 +61,8 @@ export function NotificationItem({
if (notification.kind === ExtendedKind.POLL_RESPONSE) {
return <PollResponseNotification notification={notification} isNew={isNew} />
}
if (notification.kind === kinds.Highlights) {
return <HighlightNotification notification={notification} isNew={isNew} />
}
return null
}

View File

@@ -55,6 +55,7 @@ const NotificationList = forwardRef((_, ref) => {
case 'mentions':
return [
kinds.ShortTextNote,
kinds.Highlights,
ExtendedKind.COMMENT,
ExtendedKind.VOICE_COMMENT,
ExtendedKind.POLL
@@ -70,6 +71,7 @@ const NotificationList = forwardRef((_, ref) => {
kinds.GenericRepost,
kinds.Reaction,
kinds.Zap,
kinds.Highlights,
ExtendedKind.COMMENT,
ExtendedKind.POLL_RESPONSE,
ExtendedKind.VOICE_COMMENT,

View File

@@ -384,6 +384,7 @@ export default {
'reacted to your note': 'تفاعل مع ملاحظتك',
'reposted your note': 'أعاد نشر ملاحظتك',
'zapped your note': 'زاب ملاحظتك',
'highlighted your note': 'أبرز ملاحظتك',
'zapped you': 'زابك',
'Mark as read': 'تعليم كمقروء',
Report: 'تبليغ',

View File

@@ -393,6 +393,7 @@ export default {
'reacted to your note': 'hat auf Ihre Notiz reagiert',
'reposted your note': 'hat Ihre Notiz geteilt',
'zapped your note': 'hat Ihre Notiz gezappt',
'highlighted your note': 'hat Ihre Notiz hervorgehoben',
'zapped you': 'hat Sie gezappt',
'Mark as read': 'Als gelesen markieren',
Report: 'Melden',

View File

@@ -383,6 +383,7 @@ export default {
'reacted to your note': 'reacted to your note',
'reposted your note': 'reposted your note',
'zapped your note': 'zapped your note',
'highlighted your note': 'highlighted your note',
'zapped you': 'zapped you',
'Mark as read': 'Mark as read',
Report: 'Report',

View File

@@ -389,6 +389,7 @@ export default {
'reacted to your note': 'reaccionó a tu nota',
'reposted your note': 'reposteó tu nota',
'zapped your note': 'zappeó tu nota',
'highlighted your note': 'destacó tu nota',
'zapped you': 'te zappeó',
'Mark as read': 'Marcar como leído',
Report: 'Reportar',

View File

@@ -385,6 +385,7 @@ export default {
'reacted to your note': 'به یادداشت شما واکنش نشان داد',
'reposted your note': 'یادداشت شما را بازنشر کرد',
'zapped your note': 'یادداشت شما را زپ کرد',
'highlighted your note': 'یادداشت شما را برجسته کرد',
'zapped you': 'شما را زپ کرد',
'Mark as read': 'علامت‌گذاری به عنوان خوانده شده',
Report: 'گزارش',

View File

@@ -393,6 +393,7 @@ export default {
'reacted to your note': 'a réagi à votre note',
'reposted your note': 'a repartagé votre note',
'zapped your note': 'a zappé votre note',
'highlighted your note': 'a mis en évidence votre note',
'zapped you': 'vous a zappé',
'Mark as read': 'Marquer comme lu',
Report: 'Signaler',

View File

@@ -388,6 +388,7 @@ export default {
'reacted to your note': 'ने आपके नोट पर प्रतिक्रिया दी',
'reposted your note': 'ने आपके नोट को रीपोस्ट किया',
'zapped your note': 'ने आपके नोट को जैप किया',
'highlighted your note': 'ने आपके नोट को हाइलाइट किया',
'zapped you': 'ने आपको जैप किया',
'Mark as read': 'पढ़ा हुआ मार्क करें',
Report: 'रिपोर्ट करें',

View File

@@ -385,6 +385,7 @@ export default {
'reacted to your note': 'reagált a posztodra',
'reposted your note': 'újraposztolta a posztodat',
'zapped your note': 'zappolta a posztodat',
'highlighted your note': 'kiemelte a posztodat',
'zapped you': 'zappolt téged',
'Mark as read': 'Megjelölés olvasottként',
Report: 'Jelentés',

View File

@@ -389,6 +389,7 @@ export default {
'reacted to your note': 'ha reagito alla tua nota',
'reposted your note': 'ha ricondiviso la tua nota',
'zapped your note': 'ha zappato la tua nota',
'highlighted your note': 'ha evidenziato la tua nota',
'zapped you': 'ti ha zappato',
'Mark as read': 'Segna come letto',
Report: 'Segnala',

View File

@@ -386,6 +386,7 @@ export default {
'reacted to your note': 'あなたのノートにリアクションしました',
'reposted your note': 'あなたのノートをリポストしました',
'zapped your note': 'あなたのノートにザップしました',
'highlighted your note': 'あなたのノートをハイライトしました',
'zapped you': 'あなたにザップしました',
'Mark as read': '既読にする',
Report: '報告',

View File

@@ -386,6 +386,7 @@ export default {
'reacted to your note': '당신의 노트에 반응했습니다',
'reposted your note': '당신의 노트를 리포스트했습니다',
'zapped your note': '당신의 노트를 잽했습니다',
'highlighted your note': '당신의 노트를 하이라이트했습니다',
'zapped you': '당신을 잽했습니다',
'Mark as read': '읽음으로 표시',
Report: '신고',

View File

@@ -390,6 +390,7 @@ export default {
'reacted to your note': 'zareagował na twój wpis',
'reposted your note': 'repostował twój wpis',
'zapped your note': 'zappował twój wpis',
'highlighted your note': 'wyróżnił twój wpis',
'zapped you': 'zappował cię',
'Mark as read': 'Oznacz jako przeczytane',
Report: 'Zgłoś',

View File

@@ -386,6 +386,7 @@ export default {
'reacted to your note': 'reagiu à sua nota',
'reposted your note': 'republicou sua nota',
'zapped your note': 'zappeou sua nota',
'highlighted your note': 'destacou sua nota',
'zapped you': 'zappeou você',
'Mark as read': 'Marcar como lida',
Report: 'Denunciar',

View File

@@ -389,6 +389,7 @@ export default {
'reacted to your note': 'reagiu à sua nota',
'reposted your note': 'republicou a sua nota',
'zapped your note': 'zappeou a sua nota',
'highlighted your note': 'destacou a sua nota',
'zapped you': 'zappeou-o',
'Mark as read': 'Marcar como lida',
Report: 'Denunciar',

View File

@@ -390,6 +390,7 @@ export default {
'reacted to your note': 'отреагировал на вашу заметку',
'reposted your note': 'репостнул вашу заметку',
'zapped your note': 'заппил вашу заметку',
'highlighted your note': 'выделил вашу заметку',
'zapped you': 'заппил вас',
'Mark as read': 'Отметить как прочитанное',
Report: 'Пожаловаться',

View File

@@ -382,6 +382,7 @@ export default {
'reacted to your note': 'ได้แสดงปฏิกิริยาต่อโน้ตของคุณ',
'reposted your note': 'ได้รีโพสต์โน้ตของคุณ',
'zapped your note': 'ได้แซปโน้ตของคุณ',
'highlighted your note': 'ได้ไฮไลต์โน้ตของคุณ',
'zapped you': 'ได้แซปคุณ',
'Mark as read': 'ทำเครื่องหมายว่าอ่านแล้ว',
Report: 'รายงาน',

View File

@@ -380,6 +380,7 @@ export default {
'reacted to your note': '对您的笔记做出了反应',
'reposted your note': '转发了您的笔记',
'zapped your note': '打闪了您的笔记',
'highlighted your note': '高亮了您的笔记',
'zapped you': '给您打闪',
'Mark as read': '标记为已读',
Report: '举报',