From 53cf9b30fe4fed8324cf6b116f7adf0bcb481295 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 26 May 2021 01:16:21 +0530 Subject: [PATCH] Add rendering of comments. (#169) * Add rendering of comments. * Finish comments implementation. --- src/components/WatchVideo.vue | 74 +++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index 877ea765..77bfac33 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -33,23 +33,54 @@ Auto Play next Video:  -
- -

{{ related.title }}

- -
-

- -

{{ related.uploaderName }}

- - - {{ related.views }} views -

+
+ +
+
+
+
+ avatar + +

{{ comment.author }}

+
+
+

{{ comment.commentText }}

+
+
+
+ +
+
+ +

{{ related.title }}

+ +
+

+ +

{{ related.uploaderName }}

+ + + {{ related.views }} views +

+
+
@@ -68,18 +99,21 @@ export default { sponsors: null, selectedAutoPlay: null, showDesc: true, + comments: null, }; }, mounted() { this.selectedAutoPlay = Constants.AUTO_PLAY; this.getVideoData(); this.getSponsors(); + this.getComments(); }, watch: { "$route.query.v": function(v) { if (v) { this.getVideoData(); this.getSponsors(); + this.getComments(); } }, }, @@ -98,6 +132,9 @@ export default { : encodeURIComponent('["sponsor", "interaction", "selfpromo", "music_offtopic"]')), ); }, + fetchComments() { + return this.fetchJson(Constants.BASE_URL + "/comments/" + this.$route.query.v); + }, onChange() { if (localStorage) localStorage.setItem("autoplay", this.selectedAutoPlay); }, @@ -121,6 +158,9 @@ export default { if (!localStorage || localStorage.getItem("sponsorblock") !== false) this.fetchSponsors().then(data => (this.sponsors = data)); }, + async getComments() { + this.fetchComments().then(data => (this.comments = data)); + }, }, components: { Player,