import "./torrent-list.css"; import { hexToBech32 } from "@snort/shared"; import { NostrLink, TaggedNostrEvent } from "@snort/system"; import { useUserProfile } from "@snort/system-react"; import { FormatBytes } from "../const"; import { Link } from "react-router-dom"; import { MagnetLink } from "./magnet"; export function TorrentList({ items }: { items: Array }) { return ( {items.map((a) => ( ))}
Category Name Uploaded Size From
); } function TorrentTableEntry({ item }: { item: TaggedNostrEvent }) { const profile = useUserProfile(item.pubkey); const name = item.tags.find((a) => a[0] === "title")?.at(1); const size = Number(item.tags.find((a) => a[0] === "size")?.at(1)); const npub = hexToBech32("npub", item.pubkey); return ( {item.tags .filter((a) => a[0] === "t") .map((a) => a[1]) .join(" > ")} {name} {new Date(item.created_at * 1000).toLocaleDateString()} {FormatBytes(size)} {profile?.name ?? npub.slice(0, 12)} ); }