Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Canonical Infohash Group info in the details page #497

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions components/torrent/CanonicalInfoHashGroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<div id="torrent-description" class="flex flex-col gap-6">
<div class="flex flex-row items-center justify-between">
<h2 class="mr-1 text-2xl font-medium text-left text-neutral-content/50">
Canonical InfoHash Group ({{ torrent.canonical_info_hash_group.length }})
</h2>
<button
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"
@click="collapsed = !collapsed"
>
<ChevronDownIcon class="w-6" :class="{ 'rotate-90': collapsed }" />
</button>
</div>
<template v-if="!collapsed">
<div class="overflow-x-auto">
<table class="table w-full table-zebra">
<!-- head -->
<thead>
<tr>
<th />
<th>original infohash</th>
</tr>
</thead>
<tbody>
<template v-for="(infohash, index) in torrent.canonical_info_hash_group">
<tr>
<th>{{ index + 1 }}</th>
<td>{{ infohash }}</td>
<td />
</tr>
</template>
</tbody>
</table>
</div>
</template>
</div>
</template>

<script setup lang="ts">
import { ChevronDownIcon } from "@heroicons/vue/24/solid";
import type { PropType } from "vue";
import type { TorrentResponse } from "torrust-index-types-lib";
import { ref } from "#imports";

const collapsed = ref(false);

const props = defineProps({
torrent: {
type: Object as PropType<TorrentResponse>,
required: true
}
});
</script>

<style scoped>

</style>
22 changes: 11 additions & 11 deletions components/torrent/TorrentActionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@

<div class="flex flex-col p-6 stats bg-base-100 rounded-2xl">
<div class="flex flex-col text-sm text-base-content/60">
<div class="flex flex-row">
<div class="flex flex-row w-1/2 py-2">
<HashtagIcon class="w-4 mr-2" />
<span>Canonical Info Hash</span>
</div>
<div class="flex flex-row w-1/2 py-1">
<div class="relative flex items-center max-w-full overflow-x-auto border rounded-lg border-base-content/10">
<span data-cy="torrent-action-info-hash" class="px-2">{{ torrent.info_hash }}</span>
</div>
</div>
</div>
<div v-if="torrent.category !== null" class="flex flex-row py-2 pt-0">
<div class="flex flex-row w-1/2">
<TagIcon class="w-4 mr-2" />
Expand Down Expand Up @@ -73,17 +84,6 @@
<span>{{ fileSize(torrent.file_size) }}</span>
</div>
</div>
<div class="flex flex-row">
<div class="flex flex-row w-1/2 py-2">
<HashtagIcon class="w-4 mr-2" />
<span>Info Hash</span>
</div>
<div class="flex flex-row w-1/2 py-1">
<div class="relative flex items-center max-w-full overflow-x-auto border rounded-lg border-base-content/10">
<span data-cy="torrent-action-info-hash" class="px-2">{{ torrent.info_hash }}</span>
</div>
</div>
</div>
<div class="flex flex-row py-2 pb-0">
<div class="flex flex-row w-1/2">
<UserCircleIcon class="w-4 mr-2" />
Expand Down
2 changes: 2 additions & 0 deletions components/torrent/TorrentDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<TorrentEncodingTab :torrent="torrent" @updated="reloadTorrent" />
<TorrentFilesTab :torrent="torrent" @updated="reloadTorrent" />
<TorrentTrackersTab :torrent="torrent" @updated="reloadTorrent" />
<CanonicalInfoHashGroup :torrent="torrent" @updated="reloadTorrent" />
</div>
</div>
</div>
Expand All @@ -47,6 +48,7 @@ import { ChevronLeftIcon } from "@heroicons/vue/24/solid";
import type { Ref } from "vue";
import type { TorrentResponse } from "torrust-index-types-lib";
import { notify } from "notiwind-ts";
import CanonicalInfoHashGroup from "./CanonicalInfoHashGroup.vue";
import { useRoute, navigateTo, ref, useRestApi } from "#imports";
import TorrentActionCard from "~/components/torrent/TorrentActionCard.vue";
import TorrentDescriptionTab from "~/components/torrent/TorrentDescriptionTab.vue";
Expand Down
Loading