open menu for a single issue-id, but close for all

This commit is contained in:
Rob Culliton 2018-05-09 12:36:36 -04:00
parent 039295f157
commit fffe92f87d
No known key found for this signature in database
GPG Key ID: 6FDEF60B3DC84D94
3 changed files with 9 additions and 9 deletions

View File

@ -544,15 +544,15 @@
(reg-event-db
:three-dots-open
(fn [db [_]]
(fn [db [_ issue-id]]
(.addEventListener js/window "click" close-three-dots)
(assoc db :three-dots-open? true)))
(update db ::db/unclaimed-options (fnil conj #{}) issue-id)))
(reg-event-db
:three-dots-close
(fn [db [_]]
(fn [db [_ issue-id]]
(.removeEventListener js/window "click" close-three-dots)
(assoc db :three-dots-open? false)))
(assoc db ::db/unclaimed-options #{})))
(reg-event-db
::open-bounty-claim

View File

@ -259,18 +259,18 @@
[:span.pr2
[:img.w1.v-mid.o-50 {:src image-src}]])
(defn three-dots []
(defn three-dots [issue-id]
[:div
[:div
{:on-click #(rf/dispatch [:three-dots-open])}
{:on-click #(rf/dispatch [:three-dots-open issue-id])}
[three-dots-box "ic-more-vert-black-24dp-1x.png"]]])
(defn revoke-dropdown [bounty]
(let [menu (if @(rf/subscribe [:three-dots-open?])
(let [menu (if (contains? @(rf/subscribe [:three-dots-open?]) (:issue-id bounty))
[:div.ui.menu.revoke.transition {:tab-index -1}]
[:div.ui.menu.transition.hidden])]
[:div.fl.w-20
[three-dots]
[three-dots (:issue-id bounty)]
(into menu [[:div
[:a.pa2
{:on-click #(rf/dispatch [:revoke-bounty {:issue-id (:issue-id bounty)}])}

View File

@ -182,7 +182,7 @@
(reg-sub
:three-dots-open?
(fn [db _]
(:three-dots-open? db)))
(::db/unclaimed-options db)))
(reg-sub
:pending-revocations