import { type Event } from "nostr-tools"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { useProfileMetadata } from "@/lib/use-profile-metadata"; // Helper function to format timestamp (optional) const formatTimestamp = (timestamp: number): string => { return new Date(timestamp * 1000).toLocaleString(); }; interface NoteCardProps { event: Event; } export function NoteCard({ event }: NoteCardProps) { // Fetch profile metadata for this note's author const { profile, displayName, displayHandle } = useProfileMetadata(event.pubkey); // Create avatar fallback (first letter of name or '?') const avatarFallback = profile.name ? profile.name.charAt(0).toUpperCase() : '?'; return (
{avatarFallback}
{displayName} {displayHandle}

{event.content}

{formatTimestamp(event.created_at)}

{/* Add other footer elements like reactions, replies later */}
); }