Skip to content

Commit ab9769a

Browse files
committed
Merge #497: Show Canonical Infohash Group info in the details page
28c0db8 feat: [#279] show canonical infohash group in details page (Jose Celano) eb88095 refactor: [#279] use the canonical infohash instead (Jose Celano) e743c75 refactor: [#279] rename field in TorrentActionCard (Jose Celano) 75712ad chore(deps): update depencencies (Jose Celano) Pull request description: Changes in the UI to make it clear when the infohash of an uploaded torrent changes. ACKs for top commit: josecelano: ACK 28c0db8 Tree-SHA512: b51be07f44a16509a4ea07aa40661e122e088ebcf6dcc5872edbd08349ec3e814f3473af8597a824ccb1871171bc302cd5c24f3f313ad90a5025736f08834fb1
2 parents 2c08436 + 28c0db8 commit ab9769a

File tree

5 files changed

+243
-157
lines changed

5 files changed

+243
-157
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/TorrentActionCard.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@
4444

4545
<div class="flex flex-col p-6 stats bg-base-100 rounded-2xl">
4646
<div class="flex flex-col text-sm text-base-content/60">
47+
<div class="flex flex-row">
48+
<div class="flex flex-row w-1/2 py-2">
49+
<HashtagIcon class="w-4 mr-2" />
50+
<span>Canonical Info Hash</span>
51+
</div>
52+
<div class="flex flex-row w-1/2 py-1">
53+
<div class="relative flex items-center max-w-full overflow-x-auto border rounded-lg border-base-content/10">
54+
<span data-cy="torrent-action-info-hash" class="px-2">{{ torrent.info_hash }}</span>
55+
</div>
56+
</div>
57+
</div>
4758
<div v-if="torrent.category !== null" class="flex flex-row py-2 pt-0">
4859
<div class="flex flex-row w-1/2">
4960
<TagIcon class="w-4 mr-2" />
@@ -73,17 +84,6 @@
7384
<span>{{ fileSize(torrent.file_size) }}</span>
7485
</div>
7586
</div>
76-
<div class="flex flex-row">
77-
<div class="flex flex-row w-1/2 py-2">
78-
<HashtagIcon class="w-4 mr-2" />
79-
<span>Info Hash</span>
80-
</div>
81-
<div class="flex flex-row w-1/2 py-1">
82-
<div class="relative flex items-center max-w-full overflow-x-auto border rounded-lg border-base-content/10">
83-
<span data-cy="torrent-action-info-hash" class="px-2">{{ torrent.info_hash }}</span>
84-
</div>
85-
</div>
86-
</div>
8787
<div class="flex flex-row py-2 pb-0">
8888
<div class="flex flex-row w-1/2">
8989
<UserCircleIcon class="w-4 mr-2" />

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)