Show interaction buttons in PictureCard only when user is logged in

This commit is contained in:
2025-11-27 21:44:54 +01:00
parent 56892db6ee
commit 3a902953e2

View File

@@ -12,6 +12,7 @@ import { useNavigate } from 'react-router-dom';
import { nip19 } from 'nostr-tools';
import { ReactionButton } from '@/components/ReactionButton';
import { ZapButton } from '@/components/ZapButton';
import { useCurrentUser } from '@/hooks/useCurrentUser';
interface PictureCardProps {
event: NostrEvent;
@@ -61,6 +62,7 @@ export function PictureCard({ event }: PictureCardProps) {
const metadata: NostrMetadata | undefined = author.data?.metadata;
const [currentImageIndex, setCurrentImageIndex] = useState(0);
const navigate = useNavigate();
const { user } = useCurrentUser();
const displayName = metadata?.display_name || metadata?.name || genUserName(event.pubkey);
const profileImage = metadata?.picture;
@@ -193,11 +195,13 @@ export function PictureCard({ event }: PictureCardProps) {
)}
</div>
{/* Interaction buttons - always at bottom */}
<div className="flex items-center gap-2 pt-3 mt-auto border-t">
<ReactionButton target={event} showCount buttonVariant="ghost" />
<ZapButton target={event} showCount buttonVariant="ghost" />
</div>
{/* Interaction buttons - only show when logged in */}
{user && (
<div className="flex items-center gap-2 pt-3 mt-auto border-t">
<ReactionButton target={event} showCount buttonVariant="ghost" />
<ZapButton target={event} showCount buttonVariant="ghost" />
</div>
)}
</div>
</CardContent>
</Card>