Skip to content

Commit

Permalink
Merge branch 'main' into typography-for-work-3
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjeff0 authored Aug 20, 2022
2 parents 3efbea6 + 03530f0 commit 8721fde
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/cljs/athens/views/blocks/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@
(when (and @show-comments?
(or @show-textarea?
(comments/get-comment-thread-uid @db/dsdb uid)))
[inline-comments/inline-comments (comments/get-comments-in-thread @db/dsdb (comments/get-comment-thread-uid @db/dsdb uid)) uid false])
(cond
@show-textarea? [inline-comments/inline-comments (comments/get-comments-in-thread @db/dsdb (comments/get-comment-thread-uid @db/dsdb uid)) uid false]
:else [inline-comments/inline-comments (comments/get-comments-in-thread @db/dsdb (comments/get-comment-thread-uid @db/dsdb uid)) uid true]))

[presence/inline-presence-el uid]

Expand Down
14 changes: 11 additions & 3 deletions src/cljs/athens/views/comments/inline.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@


(defn comments-disclosure
[hide? num-comments]
[hide? num-comments last-comment]
[:> Button (merge
(when-not @hide?
{:bg "background.upper"
Expand All @@ -182,7 +182,14 @@
[:<>
[:> ChevronRightIcon]
[:> CommentCounter {:count num-comments}]
[:> Text {:pl 1.5} "Comments"]]
[:> Text {:pl 1.5} "Comments"]
[:> HStack
[:> Box
(:author last-comment)]
[:> Box
(:string last-comment)]
[:> Box
(timeAgo (:time last-comment))]]]
[:<>
[:> ChevronDownIcon]
[:> CommentCounter {:count num-comments}]
Expand All @@ -199,6 +206,7 @@
(fn [data uid _hide?]
(let [num-comments (count data)
username (rf/subscribe [:username])
last-comment (last data)
;; hacky way to detect if user just wanted to start the first comment, but the block-uid of the textarea
;; isn't accessible globally
focus-textarea-if-opening-first-time #(when (zero? num-comments)
Expand All @@ -215,7 +223,7 @@
:borderRadius "md"
:align "stretch"})

[comments-disclosure hide? num-comments]
[comments-disclosure hide? num-comments last-comment]

(when-not @hide?
[:> Box {:pl 8
Expand Down
8 changes: 5 additions & 3 deletions src/cljs/athens/views/pages/block_page.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
properties-enabled? (rf/subscribe [:feature-flags/enabled? :properties])]

(fn [block]
(let [{:block/keys [string children uid properties] :db/keys [id]} block]
(let [{:block/keys [string children uid properties] :db/keys [id]} block
show-comments? (rf/subscribe [:comment/show-comments?])
show-textarea? (rf/subscribe [:comment/show-editor? uid])]
(when (not= string (:string/previous @state))
(swap! state assoc :string/previous string :string/local string))

Expand Down Expand Up @@ -141,8 +143,8 @@
;; Show comments when the toggle is on
[:> Box {:ml "4%"
:w "100%"}
(when (or @(rf/subscribe [:comment/show-editor? uid])
(and @(rf/subscribe [:comment/show-comments?])
(when (or @show-textarea?
(and @show-comments?
(comments/get-comment-thread-uid @db/dsdb uid)))
[inline-comments/inline-comments (comments/get-comments-in-thread @db/dsdb (comments/get-comment-thread-uid @db/dsdb uid)) uid false])]

Expand Down

0 comments on commit 8721fde

Please sign in to comment.