feat: Show username when badge awarded to single person

Update BadgeAwardRenderer to display the recipient's username
when only 1 person is awarded the badge, instead of "1 person".

- Single recipient: "awarded to @username"
- Multiple recipients: "awarded to n people"

Uses UserName component for proper profile name resolution.
This commit is contained in:
Claude
2026-01-17 17:48:51 +00:00
parent 682dfe8639
commit 0d70b432ea

View File

@@ -13,6 +13,7 @@ import {
getBadgeImageUrl,
} from "@/lib/nip58-helpers";
import { Award } from "lucide-react";
import { UserName } from "../UserName";
/**
* Parse an address pointer from an a tag value
@@ -92,13 +93,17 @@ export function BadgeAwardRenderer({ event }: BaseEventProps) {
</span>
)}
{/* Awarded count - linked to this award event */}
{/* Awarded count/name - linked to this award event */}
<ClickableEventTitle
event={event}
className="text-sm text-muted-foreground hover:text-foreground"
className="text-sm text-muted-foreground hover:text-foreground inline-flex items-center gap-1"
>
awarded to {recipientCount}{" "}
{recipientCount === 1 ? "person" : "people"}
<span>awarded to</span>
{recipientCount === 1 ? (
<UserName pubkey={awardedPubkeys[0]} />
) : (
<span>{recipientCount} people</span>
)}
</ClickableEventTitle>
</div>
</BaseEventContainer>