Skip to content

Commit 28c0db8

Browse files
committed
feat: [#279] show canonical infohash group in details page
1 parent eb88095 commit 28c0db8

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<template>
2+
<div id="torrent-description" class="flex flex-col gap-6">
3+
<div class="flex flex-row items-center justify-between">
4+
<h2 class="mr-1 text-2xl font-medium text-left text-neutral-content/50">
5+
Canonical InfoHash Group ({{ torrent.canonical_info_hash_group.length }})
6+
</h2>
7+
<button
8+
class="flex flex-col items-center justify-center w-10 h-10 duration-200 bg-transparent text-base-content/50 hover:text-base-content rounded-xl"
9+
@click="collapsed = !collapsed"
10+
>
11+
<ChevronDownIcon class="w-6" :class="{ 'rotate-90': collapsed }" />
12+
</button>
13+
</div>
14+
<template v-if="!collapsed">
15+
<div class="overflow-x-auto">
16+
<table class="table w-full table-zebra">
17+
<!-- head -->
18+
<thead>
19+
<tr>
20+
<th />
21+
<th>original infohash</th>
22+
</tr>
23+
</thead>
24+
<tbody>
25+
<template v-for="(infohash, index) in torrent.canonical_info_hash_group">
26+
<tr>
27+
<th>{{ index + 1 }}</th>
28+
<td>{{ infohash }}</td>
29+
<td />
30+
</tr>
31+
</template>
32+
</tbody>
33+
</table>
34+
</div>
35+
</template>
36+
</div>
37+
</template>
38+
39+
<script setup lang="ts">
40+
import { ChevronDownIcon } from "@heroicons/vue/24/solid";
41+
import type { PropType } from "vue";
42+
import type { TorrentResponse } from "torrust-index-types-lib";
43+
import { ref } from "#imports";
44+
45+
const collapsed = ref(false);
46+
47+
const props = defineProps({
48+
torrent: {
49+
type: Object as PropType<TorrentResponse>,
50+
required: true
51+
}
52+
});
53+
</script>
54+
55+
<style scoped>
56+
57+
</style>

components/torrent/TorrentDetails.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<TorrentEncodingTab :torrent="torrent" @updated="reloadTorrent" />
2424
<TorrentFilesTab :torrent="torrent" @updated="reloadTorrent" />
2525
<TorrentTrackersTab :torrent="torrent" @updated="reloadTorrent" />
26+
<CanonicalInfoHashGroup :torrent="torrent" @updated="reloadTorrent" />
2627
</div>
2728
</div>
2829
</div>
@@ -47,6 +48,7 @@ import { ChevronLeftIcon } from "@heroicons/vue/24/solid";
4748
import type { Ref } from "vue";
4849
import type { TorrentResponse } from "torrust-index-types-lib";
4950
import { notify } from "notiwind-ts";
51+
import CanonicalInfoHashGroup from "./CanonicalInfoHashGroup.vue";
5052
import { useRoute, navigateTo, ref, useRestApi } from "#imports";
5153
import TorrentActionCard from "~/components/torrent/TorrentActionCard.vue";
5254
import TorrentDescriptionTab from "~/components/torrent/TorrentDescriptionTab.vue";

0 commit comments

Comments
 (0)