mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-10 15:36:53 +02:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user