mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 04:49:03 -05:00
🐛 Fix scrollbar on comment thread.
This commit is contained in:
parent
bf8e61b9bb
commit
a86f198406
2 changed files with 19 additions and 12 deletions
|
@ -57,6 +57,7 @@
|
||||||
|
|
||||||
.comments {
|
.comments {
|
||||||
max-height: 320px;
|
max-height: 320px;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
|
@ -205,8 +206,8 @@
|
||||||
|
|
||||||
|
|
||||||
.comment-options-dropdown {
|
.comment-options-dropdown {
|
||||||
top: 0px;
|
top: 7px;
|
||||||
right: -160px;
|
right: 7px;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
|
|
||||||
border: 1px solid #B1B2B5;
|
border: 1px solid #B1B2B5;
|
||||||
|
|
|
@ -197,13 +197,20 @@
|
||||||
(mf/defc comment-item
|
(mf/defc comment-item
|
||||||
[{:keys [comment thread] :as props}]
|
[{:keys [comment thread] :as props}]
|
||||||
(let [profile (get @refs/workspace-users (:owner-id comment))
|
(let [profile (get @refs/workspace-users (:owner-id comment))
|
||||||
options? (mf/use-state false)
|
|
||||||
|
options (mf/use-state false)
|
||||||
edition? (mf/use-state false)
|
edition? (mf/use-state false)
|
||||||
|
|
||||||
|
on-show-options
|
||||||
|
(mf/use-callback #(reset! options true))
|
||||||
|
|
||||||
|
on-hide-options
|
||||||
|
(mf/use-callback #(reset! options false))
|
||||||
|
|
||||||
on-edit-clicked
|
on-edit-clicked
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(fn []
|
(fn []
|
||||||
(reset! options? false)
|
(reset! options false)
|
||||||
(reset! edition? true)))
|
(reset! edition? true)))
|
||||||
|
|
||||||
on-delete-comment
|
on-delete-comment
|
||||||
|
@ -259,7 +266,7 @@
|
||||||
[:span i/checkbox-unchecked])])
|
[:span i/checkbox-unchecked])])
|
||||||
|
|
||||||
[:div.options
|
[:div.options
|
||||||
[:div.options-icon {:on-click #(swap! options? not)} i/actions]]]
|
[:div.options-icon {:on-click on-show-options} i/actions]]]
|
||||||
|
|
||||||
[:div.content
|
[:div.content
|
||||||
(if @edition?
|
(if @edition?
|
||||||
|
@ -268,8 +275,8 @@
|
||||||
:on-cancel on-cancel}]
|
:on-cancel on-cancel}]
|
||||||
[:span.text (:content comment)])]]
|
[:span.text (:content comment)])]]
|
||||||
|
|
||||||
[:& dropdown {:show @options?
|
[:& dropdown {:show @options
|
||||||
:on-close identity}
|
:on-close on-hide-options}
|
||||||
[:ul.dropdown.comment-options-dropdown
|
[:ul.dropdown.comment-options-dropdown
|
||||||
[:li {:on-click on-edit-clicked} "Edit"]
|
[:li {:on-click on-edit-clicked} "Edit"]
|
||||||
(if thread
|
(if thread
|
||||||
|
@ -277,8 +284,8 @@
|
||||||
[:li {:on-click on-delete-comment} "Delete comment"])]]]))
|
[:li {:on-click on-delete-comment} "Delete comment"])]]]))
|
||||||
|
|
||||||
(defn comments-ref
|
(defn comments-ref
|
||||||
[thread-id]
|
[{:keys [id] :as thread}]
|
||||||
(l/derived (l/in [:comments thread-id]) st/state))
|
(l/derived (l/in [:comments id]) st/state))
|
||||||
|
|
||||||
(mf/defc thread-comments
|
(mf/defc thread-comments
|
||||||
[{:keys [thread zoom]}]
|
[{:keys [thread zoom]}]
|
||||||
|
@ -287,12 +294,11 @@
|
||||||
pos-x (+ (* (:x pos) zoom) 14)
|
pos-x (+ (* (:x pos) zoom) 14)
|
||||||
pos-y (- (* (:y pos) zoom) 14)
|
pos-y (- (* (:y pos) zoom) 14)
|
||||||
|
|
||||||
|
comments-ref (mf/use-memo (mf/deps thread) #(comments-ref thread))
|
||||||
comments-ref (mf/use-memo (mf/deps (:id thread)) #(comments-ref (:id thread)))
|
|
||||||
comments-map (mf/deref comments-ref)
|
comments-map (mf/deref comments-ref)
|
||||||
comments (->> (vals comments-map)
|
comments (->> (vals comments-map)
|
||||||
(sort-by :created-at))
|
(sort-by :created-at))
|
||||||
comment (first comments)]
|
comment (first comments)]
|
||||||
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(st/emitf (dwcm/update-comment-thread-status thread)))
|
(st/emitf (dwcm/update-comment-thread-status thread)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue