mirror of
https://git.v0l.io/Kieran/dtan.git
synced 2024-12-12 15:06:22 +00:00
refactor: remove size tag
This commit is contained in:
parent
f5784534d6
commit
b4cc59d25f
@ -4,7 +4,6 @@
|
||||
"content": "<long-description-pre-formatted>",
|
||||
"tags": [
|
||||
["title", "<torrent-title>"],
|
||||
["size", "<size-in-bytes>"],
|
||||
["btih", "<bittorrent-info-hash>"],
|
||||
["t", "<top-level-tag>"],
|
||||
["t", "(optional)<second-level-tag>"],
|
||||
|
@ -31,7 +31,7 @@ export function TorrentList({ items }: { items: Array<TaggedNostrEvent> }) {
|
||||
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 size = item.tags.filter(a => a[0] === "file").map(a => Number(a[2])).reduce((acc, v) => acc += v, 0);
|
||||
const npub = hexToBech32("npub", item.pubkey);
|
||||
return (
|
||||
<tr>
|
||||
|
@ -90,7 +90,6 @@ export function NewPage() {
|
||||
.kind(TorrentKind)
|
||||
.content(obj.desc)
|
||||
.tag(["title", obj.name])
|
||||
.tag(["size", String(obj.files.reduce((acc, v) => (acc += v.size), 0))])
|
||||
.tag(["btih", obj.btih]);
|
||||
|
||||
obj.tags.forEach((t) => v.tag(["t", t]));
|
||||
|
@ -29,7 +29,7 @@ export function TorrentDetail({ item }: { item: TaggedNostrEvent }) {
|
||||
const login = useLogin();
|
||||
const navigate = useNavigate();
|
||||
const name = item.tags.find((a) => a[0] === "title")?.at(1);
|
||||
const size = Number(item.tags.find((a) => a[0] === "size")?.at(1));
|
||||
const size = item.tags.filter(a => a[0] === "file").map(a => Number(a[2])).reduce((acc, v) => acc += v, 0);
|
||||
const files = item.tags.filter((a) => a[0] === "file");
|
||||
const tags = item.tags.filter((a) => a[0] === "t").map((a) => a[1]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user