import { NDKEvent } from "@nostr-dev-kit/ndk"; import { useProfile } from "../../hooks/useProfile"; import { useUIStore } from "../../stores/ui"; import { shortenPubkey, timeAgo, profileName } from "../../lib/utils"; function AncestorCard({ event }: { event: NDKEvent }) { const profile = useProfile(event.pubkey); const name = profileName(profile, shortenPubkey(event.pubkey)); const avatar = typeof profile?.picture === "string" ? profile.picture : undefined; const time = event.created_at ? timeAgo(event.created_at) : ""; const { openThread } = useUIStore(); const truncated = event.content.length > 120 ? event.content.slice(0, 120) + "…" : event.content; return ( ); } interface AncestorChainProps { ancestors: NDKEvent[]; } export function AncestorChain({ ancestors }: AncestorChainProps) { if (ancestors.length === 0) return null; return (
{ancestors.length} parent {ancestors.length === 1 ? "note" : "notes"} above
{ancestors.map((a) => ( ))}
); }