🐛 Fix issues with viewer comments menu

This commit is contained in:
Andrey Antukh 2024-02-22 17:54:50 +01:00 committed by Alonso Torres
parent 9db714b25d
commit a6edc184f0

View file

@ -52,67 +52,65 @@
(fn [event] (fn [event]
(let [mode (-> (dom/get-current-target event) (let [mode (-> (dom/get-current-target event)
(dom/get-data "value") (dom/get-data "value")
(d/read-string))] (keyword))
mode (if (= :pending mode) :all :pending)]
(st/emit! (dcm/update-filters {:show mode}))))) (st/emit! (dcm/update-filters {:show mode})))))
update-options update-options
(mf/use-fn (mf/use-fn
(fn [event] (fn [event]
(let [mode (-> (dom/get-target event) (let [mode (-> (dom/get-current-target event)
(dom/get-data "value") (dom/get-data "value")
(boolean))] (parse-boolean))]
(st/emit! (dcm/update-options {:show-sidebar? (not mode)})))))] (st/emit! (dcm/update-options {:show-sidebar? (not mode)})))))]
[:div {:class (stl/css :view-options) [:div {:class (stl/css :view-options)
:on-click toggle-dropdown} :on-click toggle-dropdown}
[:span {:class (stl/css :dropdown-title)} [:span {:class (stl/css :dropdown-title)} (tr "labels.comments")]
(tr "labels.comments")] [:span {:class (stl/css :icon-dropdown)} i/arrow-refactor]
[:span {:class (stl/css :icon-dropdown)}
i/arrow-refactor]
[:& dropdown {:show @show-dropdown? [:& dropdown {:show @show-dropdown?
:on-close hide-dropdown} :on-close hide-dropdown}
[:ul {:class (stl/css :dropdown)} [:ul {:class (stl/css :dropdown)}
[:li {:class (stl/css-case :dropdown-element true
:selected (or (= :all cmode) (nil? cmode))) [:li {:class (stl/css-case
:dropdown-element true
:selected (or (= :all cmode) (nil? cmode)))
:data-value "all" :data-value "all"
:on-click update-mode} :on-click update-mode}
[:span {:class (stl/css :label)} (tr "labels.show-all-comments")] [:span {:class (stl/css :label)} (tr "labels.show-all-comments")]
(when (or (= :all cmode) (nil? cmode)) (when (or (= :all cmode) (nil? cmode))
[:span {:class (stl/css :icon)} i/tick-refactor])] [:span {:class (stl/css :icon)} i/tick-refactor])]
[:li {:class (stl/css-case :dropdown-element true [:li {:class (stl/css-case
:selected (= :yours cmode)) :dropdown-element true
:selected (= :yours cmode))
:data-value "yours" :data-value "yours"
:on-click update-mode} :on-click update-mode}
[:span {:class (stl/css :label)} (tr "labels.show-your-comments")]
[:span {:class (stl/css :label)}
(tr "labels.show-your-comments")]
(when (= :yours cmode) (when (= :yours cmode)
[:span {:class (stl/css :icon)} [:span {:class (stl/css :icon)}
i/tick-refactor])] i/tick-refactor])]
[:li {:class (stl/css :separator)}] [:li {:class (stl/css :separator)}]
[:li {:class (stl/css-case :dropdown-element true [:li {:class (stl/css-case
:selected (= :pending cshow)) :dropdown-element true
:data-value (if (= :pending cshow) "all" "pending") :selected (= :pending cshow))
:data-value (d/name cshow)
:on-click update-show} :on-click update-show}
[:span {:class (stl/css :label)} (tr "labels.hide-resolved-comments")]
[:span {:class (stl/css :label)}
(tr "labels.hide-resolved-comments")]
(when (= :pending cshow) (when (= :pending cshow)
[:span {:class (stl/css :icon)} [:span {:class (stl/css :icon)}
i/tick-refactor])] i/tick-refactor])]
[:li {:class (stl/css :separator)}] [:li {:class (stl/css :separator)}]
[:li {:class (stl/css-case :dropdown-element true [:li {:class (stl/css-case
:selected show-sidebar?) :dropdown-element true
:selected show-sidebar?)
:data-value (dm/str show-sidebar?) :data-value (dm/str show-sidebar?)
:on-click update-options} :on-click update-options}
[:span {:class (stl/css :label)} (tr "labels.show-comments-list")] [:span {:class (stl/css :label)} (tr "labels.show-comments-list")]
(when show-sidebar? (when show-sidebar?
[:span {:class (stl/css :icon)} i/tick-refactor])]]]])) [:span {:class (stl/css :icon)} i/tick-refactor])]]]]))