0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 15:51:37 -05:00

Merge pull request #2505 from penpot/palba-filter-comments-st

Fix displaying comments settings are not applied via "Comments" menu …
This commit is contained in:
Eva Marco 2022-10-25 10:02:00 +02:00 committed by GitHub
commit 190d67a0cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 26 deletions

View file

@ -14,6 +14,7 @@
- Fix transform to path RMB menu item is not relevant if shape is already path [Taiga #4302](https://tree.taiga.io/project/penpot/issue/4302) - Fix transform to path RMB menu item is not relevant if shape is already path [Taiga #4302](https://tree.taiga.io/project/penpot/issue/4302)
- Fix join nodes icon is active when 2 already joined nodes are selected [Taiga #4370](https://tree.taiga.io/project/penpot/issue/4370) - Fix join nodes icon is active when 2 already joined nodes are selected [Taiga #4370](https://tree.taiga.io/project/penpot/issue/4370)
- Fix path nodes panel. "To curve" and "To corner" icons are active if node is already curved/cornered [Taiga #4371](https://tree.taiga.io/project/penpot/issue/4371) - Fix path nodes panel. "To curve" and "To corner" icons are active if node is already curved/cornered [Taiga #4371](https://tree.taiga.io/project/penpot/issue/4371)
- Fix displaying comments settings are not applied via "Comments" menu drop-down on the top navbar on view mode [Taiga #4389](https://tree.taiga.io/project/penpot/issue/4389)
## 1.16.0-beta ## 1.16.0-beta

View file

@ -6,7 +6,6 @@
(ns app.main.ui.viewer.comments (ns app.main.ui.viewer.comments
(:require (:require
[app.common.data :as d]
[app.common.geom.matrix :as gmt] [app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt] [app.common.geom.point :as gpt]
[app.common.geom.shapes :as gsh] [app.common.geom.shapes :as gsh]
@ -27,21 +26,26 @@
{::mf/wrap [mf/memo] {::mf/wrap [mf/memo]
::mf/wrap-props false} ::mf/wrap-props false}
[] []
(let [local (mf/deref refs/comments-local) (let [{cmode :mode cshow :show show-sidebar? :show-sidebar?} (mf/deref refs/comments-local)
owner-filter (:owner-filter local)
status-filter (:status-filter local)
show-sidebar? (:show-sidebar? local)
show-dropdown? (mf/use-state false) show-dropdown? (mf/use-state false)
toggle-dropdown (mf/use-fn #(swap! show-dropdown? not)) toggle-dropdown (mf/use-fn #(swap! show-dropdown? not))
hide-dropdown (mf/use-fn #(reset! show-dropdown? false)) hide-dropdown (mf/use-fn #(reset! show-dropdown? false))
update-option (mf/use-fn update-mode
(fn [event] (mf/use-callback
(let [target (dom/get-current-target event) (fn [mode]
key (d/read-string (dom/get-attribute target "data-key")) (st/emit! (dcm/update-filters {:mode mode}))))
val (d/read-string (dom/get-attribute target "data-val"))]
(st/emit! (dcm/update-options {key val})))))] update-show
(mf/use-callback
(fn [mode]
(st/emit! (dcm/update-filters {:show mode}))))
update-options
(mf/use-callback
(fn [mode]
(st/emit! (dcm/update-options {:show-sidebar? mode}))))]
[:div.view-options {:on-click toggle-dropdown} [:div.view-options {:on-click toggle-dropdown}
[:span.label (tr "labels.comments")] [:span.label (tr "labels.comments")]
@ -50,34 +54,26 @@
:on-close hide-dropdown} :on-close hide-dropdown}
[:ul.dropdown.with-check [:ul.dropdown.with-check
[:li {:class (dom/classnames :selected (= :all owner-filter)) [:li {:class (dom/classnames :selected (or (= :all cmode) (nil? cmode)))
:data-key ":owner-filter" :on-click #(update-mode :all)}
:data-val ":all"
:on-click update-option}
[:span.icon i/tick] [:span.icon i/tick]
[:span.label (tr "labels.show-all-comments")]] [:span.label (tr "labels.show-all-comments")]]
[:li {:class (dom/classnames :selected (= :yours owner-filter)) [:li {:class (dom/classnames :selected (= :yours cmode))
:data-key ":owner-filter" :on-click #(update-mode :yours)}
:data-val ":yours"
:on-click update-option}
[:span.icon i/tick] [:span.icon i/tick]
[:span.label (tr "labels.show-your-comments")]] [:span.label (tr "labels.show-your-comments")]]
[:hr] [:hr]
[:li {:class (dom/classnames :selected (= :pending status-filter)) [:li {:class (dom/classnames :selected (= :pending cshow))
:data-key ":status-filter" :on-click #(update-show (if (= :pending cshow) :all :pending))}
:data-val (if (= :pending status-filter) ":all" ":pending")
:on-click update-option}
[:span.icon i/tick] [:span.icon i/tick]
[:span.label (tr "labels.hide-resolved-comments")]] [:span.label (tr "labels.hide-resolved-comments")]]
[:hr] [:hr]
[:li {:class (dom/classnames :selected show-sidebar?) [:li {:class (dom/classnames :selected show-sidebar?)
:data-key ":show-sidebar?" :on-click #(update-options (not show-sidebar?))}
:data-val (if show-sidebar? "false" "true")
:on-click update-option}
[:span.icon i/tick] [:span.icon i/tick]
[:span.label (tr "labels.show-comments-list")]]]]])) [:span.label (tr "labels.show-comments-list")]]]]]))