Hide move options when no targets

This commit is contained in:
Andrés Moya 2021-03-04 16:52:53 +01:00
parent 2adc45fc19
commit 161b8cdabb
3 changed files with 47 additions and 36 deletions

View file

@ -87,10 +87,12 @@
(fn []
(if show?
(->> (rp/query! :teams)
(rx/map (fn [teams]
(remove #(= (:id %) current-team-id) teams)))
(rx/subs #(reset! teams %)))
(reset! teams []))))
(when (seq @teams)
(when @teams
[:& context-menu {:on-close on-menu-close
:show show?
:fixed? (or (not= top 0) (not= left 0))
@ -99,9 +101,10 @@
:options [[(tr "labels.rename") on-edit]
[(tr "dashboard.duplicate") on-duplicate]
[(tr "dashboard.pin-unpin") toggle-pin]
[(tr "dashboard.move-to") nil
(for [team @teams]
[(:name team) (on-move (:id team))])]
(when (seq @teams)
[(tr "dashboard.move-to") nil
(for [team @teams]
[(:name team) (on-move (:id team))])])
[:separator]
[(tr "labels.delete") on-delete]]}])))