diff --git a/src/components/NoteCard/MainNoteCard.tsx b/src/components/NoteCard/MainNoteCard.tsx index 4b949a1..c47eaaf 100644 --- a/src/components/NoteCard/MainNoteCard.tsx +++ b/src/components/NoteCard/MainNoteCard.tsx @@ -1,12 +1,10 @@ import { Separator } from '@/components/ui/separator' -import { ExtendedKind } from '@/constants' import { toNote } from '@/lib/link' import { useSecondaryPage } from '@/PageManager' import { Event } from 'nostr-tools' import Collapsible from '../Collapsible' import Note from '../Note' import NoteStats from '../NoteStats' -import DiscussionNoteStats from '../NoteStats/DiscussionNoteStats' import RepostDescription from './RepostDescription' export default function MainNoteCard({ @@ -43,11 +41,7 @@ export default function MainNoteCard({ /> {!embedded && ( - event.kind === ExtendedKind.DISCUSSION ? ( - - ) : ( - - ) + )} {!embedded && } diff --git a/src/components/NoteStats/DiscussionNoteStats.tsx b/src/components/NoteStats/DiscussionNoteStats.tsx index 791f5c3..3caad78 100644 --- a/src/components/NoteStats/DiscussionNoteStats.tsx +++ b/src/components/NoteStats/DiscussionNoteStats.tsx @@ -5,8 +5,6 @@ import noteStatsService from '@/services/note-stats.service' import { Event } from 'nostr-tools' import { useEffect, useState } from 'react' import VoteButtons from './VoteButtons' -import ReplyButton from './ReplyButton' -import SeenOnButton from './SeenOnButton' export default function DiscussionNoteStats({ event, @@ -42,9 +40,7 @@ export default function DiscussionNoteStats({ )} onClick={(e) => e.stopPropagation()} > - - ) @@ -57,11 +53,9 @@ export default function DiscussionNoteStats({ className={cn('flex items-center gap-2', loading ? 'animate-pulse' : '')} onClick={(e) => e.stopPropagation()} > -
e.stopPropagation()}> -
diff --git a/src/components/NoteStats/VoteButtons.tsx b/src/components/NoteStats/VoteButtons.tsx index 294a22b..6cd4d6c 100644 --- a/src/components/NoteStats/VoteButtons.tsx +++ b/src/components/NoteStats/VoteButtons.tsx @@ -40,6 +40,11 @@ export default function VoteButtons({ event }: { event: Event }) { checkLogin(async () => { if (voting || !pubkey) return + // Prevent voting if user already voted (no toggling allowed) + if (userVote) { + return // User already voted, don't allow multiple votes + } + setVoting(type) const timer = setTimeout(() => setVoting(null), 10_000) @@ -48,7 +53,7 @@ export default function VoteButtons({ event }: { event: Event }) { await noteStatsService.fetchNoteStats(event, pubkey) } - // If user is voting the same way again, remove the vote (toggle) + // Create the vote reaction const emoji = type === 'up' ? '⬆️' : '⬇️' // Check if user already voted this way @@ -92,13 +97,13 @@ export default function VoteButtons({ event }: { event: Event }) { userVote === 'up' ? 'bg-orange-100 text-orange-600' : 'text-muted-foreground' }`} onClick={() => vote('up')} - disabled={voting !== null} + disabled={voting !== null || userVote !== null} > 0 ? 'text-orange-600' : score < 0 ? 'text-blue-600' : 'text-muted-foreground' + score > 0 ? 'text-green-600' : score < 0 ? 'text-red-600' : 'text-muted-foreground' }`}> {score} diff --git a/src/components/ReactionList/index.tsx b/src/components/ReactionList/index.tsx index 3b359f8..2c0374f 100644 --- a/src/components/ReactionList/index.tsx +++ b/src/components/ReactionList/index.tsx @@ -1,4 +1,5 @@ import { useSecondaryPage } from '@/PageManager' +import { ExtendedKind } from '@/constants' import { useNoteStatsById } from '@/hooks/useNoteStatsById' import { toProfile } from '@/lib/link' import { useScreenSize } from '@/providers/ScreenSizeProvider' @@ -21,10 +22,17 @@ export default function ReactionList({ event }: { event: Event }) { const { hideUntrustedInteractions, isUserTrusted } = useUserTrust() const noteStats = useNoteStatsById(event.id) const filteredLikes = useMemo(() => { - return (noteStats?.likes ?? []) + let likes = noteStats?.likes ?? [] + + // For discussion events (kind 11), only show up/down arrow reactions + if (event.kind === ExtendedKind.DISCUSSION) { + likes = likes.filter(like => like.emoji === '⬆️' || like.emoji === '⬇️') + } + + return likes .filter((like) => !hideUntrustedInteractions || isUserTrusted(like.pubkey)) .sort((a, b) => b.created_at - a.created_at) - }, [noteStats, event.id, hideUntrustedInteractions, isUserTrusted]) + }, [noteStats, event.id, hideUntrustedInteractions, isUserTrusted, event.kind]) const [showCount, setShowCount] = useState(SHOW_COUNT) const bottomRef = useRef(null) diff --git a/src/pages/primary/DiscussionsPage/ThreadCard.tsx b/src/pages/primary/DiscussionsPage/ThreadCard.tsx index f10b258..a71ef17 100644 --- a/src/pages/primary/DiscussionsPage/ThreadCard.tsx +++ b/src/pages/primary/DiscussionsPage/ThreadCard.tsx @@ -1,7 +1,7 @@ import { Card, CardContent, CardHeader } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' -import { MessageCircle, User, Clock, Hash, Server } from 'lucide-react' +import { User, Clock, Hash, Server } from 'lucide-react' import { NostrEvent } from 'nostr-tools' import { formatDistanceToNow } from 'date-fns' import { useTranslation } from 'react-i18next' @@ -93,10 +93,6 @@ export default function ThreadCard({ thread, onThreadClick, className }: ThreadC -
- - 0 {/* TODO: Add reply count */} -