Skip to content

Commit ce5bd32

Browse files
author
MMelchor
committed
feat: [#277] show torrent comment on torrent details page
Details page of a torrent now displays the comment field if exists. Updated libraries packages for API responses to contain the comment field.
1 parent 14e36c3 commit ce5bd32

File tree

4 files changed

+58
-11
lines changed

4 files changed

+58
-11
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template>
2+
<div id="torrent-comment" 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+
Comment
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="flex flex-col w-full h-full p-6 grow bg-base-100 rounded-2xl">
16+
<template v-if="torrent.comment">
17+
<Markdown :source="torrent.comment" />
18+
</template>
19+
<template v-else>
20+
<span class="italic text-neutral-content">No comment provided.</span>
21+
</template>
22+
</div>
23+
</template>
24+
</div>
25+
</template>
26+
27+
<script setup lang="ts">
28+
import { ChevronDownIcon } from "@heroicons/vue/24/solid";
29+
import { TorrentResponse } from "torrust-index-types-lib";
30+
import { PropType } from "vue";
31+
import { ref } from "#imports";
32+
import Markdown from "~/components/Markdown.vue";
33+
34+
const collapsed = ref(false);
35+
36+
const props = defineProps({
37+
torrent: {
38+
type: Object as PropType<TorrentResponse>,
39+
required: true
40+
}
41+
});
42+
</script>
43+
44+
<style scoped>
45+
46+
</style>

components/torrent/TorrentDetails.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
</div>
1717
<div v-if="torrent" class="flex flex-col flex-auto w-full gap-6">
1818
<TorrentDescriptionTab :torrent="torrent" @updated="reloadTorrent" />
19+
<TorrentCommentTab :torrent="torrent" @updated="reloadTorrent" />
1920
<TorrentFilesTab :torrent="torrent" @updated="reloadTorrent" />
2021
<TorrentTrackersTab :torrent="torrent" @updated="reloadTorrent" />
2122
</div>

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"dompurify": "^3.0.5",
4040
"marked": "^7.0.2",
4141
"notiwind-ts": "^2.0.2",
42-
"torrust-index-api-lib": "^1.0.0-alpha.1",
43-
"torrust-index-types-lib": "^1.0.0-alpha.1",
42+
"torrust-index-api-lib": "^1.0.0-alpha.3",
43+
"torrust-index-types-lib": "^1.0.0-alpha.3",
4444
"uuid": "^9.0.0"
4545
}
4646
}

0 commit comments

Comments
 (0)