aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2023-07-25 22:01:12 +0200
committerMiguel Ángel Moreno <mail@migalmoreno.com>2023-07-25 22:01:12 +0200
commit34fab32d544dc98439fc853ed787970c3cee172f (patch)
treecf00b7ca04a61d3103a48ddf80ef0d62bfd41a6d
parent141da4b61792ff71d6ec12f85a94a4bd6368524f (diff)
fix: Conditionally display comments container
-rw-r--r--src/backend/tubo/api/streams.clj2
-rw-r--r--src/frontend/tubo/views/stream.cljs35
2 files changed, 19 insertions, 18 deletions
diff --git a/src/backend/tubo/api/streams.clj b/src/backend/tubo/api/streams.clj
index 274d5f2..6ce2086 100644
--- a/src/backend/tubo/api/streams.clj
+++ b/src/backend/tubo/api/streams.clj
@@ -25,7 +25,7 @@
:duration (.getDuration info)
:tags (.getTags info)
:category (.getCategory info)
- :view-count (.getViewCount info)
+ :view-count (when-not (= (.getViewCount info) -1) (.getViewCount info))
:like-count (when-not (= (.getLikeCount info) -1) (.getLikeCount info))
:dislike-count (when-not (= (.getDislikeCount info) -1) (.getDislikeCount info))
:subscriber-count (when-not (= (.getUploaderSubscriberCount info) -1) (.getUploaderSubscriberCount info))
diff --git a/src/frontend/tubo/views/stream.cljs b/src/frontend/tubo/views/stream.cljs
index a380b5e..e3a7e7d 100644
--- a/src/frontend/tubo/views/stream.cljs
+++ b/src/frontend/tubo/views/stream.cljs
@@ -98,24 +98,25 @@
[:div.min-w-full.py-3
[:h1 name]
[:div {:dangerouslySetInnerHTML {:__html description}}]]
- [:div.py-6
- [:div.flex.items-center
- [:i.fa-solid.fa-comments]
- [:p.px-2.py-4 "Comments"]
- (if show-comments
- [:i.fa-solid.fa-chevron-up {:on-click #(rf/dispatch [::events/toggle-comments])
- :style {:cursor "pointer"}}]
- [:i.fa-solid.fa-chevron-down {:on-click #(if (or show-comments comments-page)
- (rf/dispatch [::events/toggle-comments])
- (rf/dispatch [::events/get-comments url]))
- :style {:cursor "pointer"}}])]
- [:div
- (if show-comments-loading
- [loading/loading-icon service-color "text-2xl"]
- (when (and show-comments comments-page)
- [comments/comments comments-page uploader-name uploader-avatar url]))]]
+ (when-not (empty? (:comments comments-page))
+ [:div.py-6
+ [:div.flex.items-center
+ [:i.fa-solid.fa-comments]
+ [:p.px-2.py-4 "Comments"]
+ (if show-comments
+ [:i.fa-solid.fa-chevron-up {:on-click #(rf/dispatch [::events/toggle-comments])
+ :style {:cursor "pointer"}}]
+ [:i.fa-solid.fa-chevron-down {:on-click #(if (or show-comments comments-page)
+ (rf/dispatch [::events/toggle-comments])
+ (rf/dispatch [::events/get-comments url]))
+ :style {:cursor "pointer"}}])]
+ [:div
+ (if show-comments-loading
+ [loading/loading-icon service-color "text-2xl"]
+ (when (and show-comments comments-page)
+ [comments/comments comments-page uploader-name uploader-avatar url]))]])
(when-not (empty? related-streams)
- [:div.py-3
+ [:div.py-6
[:div.flex.items-center
[:i.fa-solid.fa-list]
[:h1.px-2.text-lg.bold "Related Results"]]