dashboard - routing cleanup
This commit is contained in:
parent
19f8356505
commit
0fab0047ec
|
@ -75,9 +75,10 @@
|
|||
(defn tabs [mobile?]
|
||||
(let [user (rf/subscribe [:user])
|
||||
owner-bounties (rf/subscribe [:owner-bounties])
|
||||
current-page (rf/subscribe [:page])]
|
||||
route (rf/subscribe [:route])]
|
||||
(fn tabs-render []
|
||||
(let [tabs [[:bounties (str (when-not @user "Open ") "Bounties")]
|
||||
(let [route-id (:route-id @route)
|
||||
tabs [[:bounties (str (when-not @user "Open ") "Bounties")]
|
||||
[:activity "Activity"]
|
||||
(when (seq @owner-bounties)
|
||||
[:dashboard "Dashboard"])
|
||||
|
@ -86,7 +87,10 @@
|
|||
(into [:div.ui.attached.tabular.menu.tiny]
|
||||
(for [[page caption] (remove nil? tabs)]
|
||||
(let [props {:class (str "ui item"
|
||||
(when (= @current-page page) " active"))
|
||||
(if (= :dashboard page)
|
||||
(when (contains? #{:dashboard :dashboard/to-confirm :dashboard/to-merge} route-id)
|
||||
" active")
|
||||
(when (= route-id page) " active")))
|
||||
:on-click #(commiteth.routes/nav! page)}]
|
||||
^{:key page} [:div props caption])))))))
|
||||
|
||||
|
@ -189,8 +193,8 @@
|
|||
[:div.version-footer "version " [:a {:href (str "https://github.com/status-im/commiteth/commit/" version)} version]])]))
|
||||
|
||||
(defn page []
|
||||
(let [current-page (rf/subscribe [:page])
|
||||
show-top-hunters? #(contains? #{:bounties :activity} @current-page)]
|
||||
(let [route (rf/subscribe [:route])
|
||||
show-top-hunters? #(contains? #{:bounties :activity} (:route-id @route))]
|
||||
(fn []
|
||||
[:div.ui.pusher
|
||||
[page-header]
|
||||
|
@ -200,13 +204,13 @@
|
|||
[:div {:class (str (if (show-top-hunters?) "eleven" "sixteen")
|
||||
" wide computer sixteen wide tablet column")}
|
||||
[:div.ui.container
|
||||
(case @current-page
|
||||
(case (:route-id @route)
|
||||
:activity [activity-page]
|
||||
:bounties [bounties-page]
|
||||
:repos [repos-page]
|
||||
(:dashboard
|
||||
:issuer-dashboard/to-confirm
|
||||
:issuer-dashboard/to-merge) [manage-payouts-page]
|
||||
:dashboard/to-confirm
|
||||
:dashboard/to-merge) [manage-payouts-page]
|
||||
:settings [update-address-page]
|
||||
:usage-metrics [usage-metrics-page])]]
|
||||
(when (show-top-hunters?)
|
||||
|
|
|
@ -81,8 +81,8 @@
|
|||
(reg-event-db
|
||||
:set-active-page
|
||||
(fn [db [_ page params query]]
|
||||
(assoc db :page page
|
||||
:page-number 1
|
||||
(assoc db :page-number 1
|
||||
:route {:route-id page :params params :query query}
|
||||
::db/open-bounties-filters
|
||||
(reduce-kv
|
||||
#(let [type (ui-model/query-param->bounty-filter-type %2)]
|
||||
|
|
|
@ -281,7 +281,7 @@
|
|||
;; TODO fix `page` subscription to subscribe to full route info
|
||||
;; do this after @msuess PR with some related routing changes has
|
||||
;; been merged
|
||||
(let [page (rf/subscribe [:page])
|
||||
(let [route (rf/subscribe [:route])
|
||||
owner-bounties (rf/subscribe [:owner-bounties])
|
||||
bounty-stats-data (rf/subscribe [:owner-bounties-stats])
|
||||
owner-bounties-loading? (rf/subscribe [:get-in [:owner-bounties-loading?]])]
|
||||
|
@ -290,7 +290,8 @@
|
|||
[:div.pa5
|
||||
[:div.ui.active.inverted.dimmer.bg-none
|
||||
[:div.ui.text.loader "Loading"]]]
|
||||
(let [bounties (vals @owner-bounties)
|
||||
(let [route-id (:route-id @route)
|
||||
bounties (vals @owner-bounties)
|
||||
grouped (group-by (comp state-mapping :state) bounties)
|
||||
unclaimed (into (get grouped :funded)
|
||||
(get grouped :open))]
|
||||
|
@ -308,29 +309,29 @@
|
|||
[:div.mv4
|
||||
[:span.dib.f6.tracked.ttu.pg-med.mr4.pb2
|
||||
{:role "button"
|
||||
:class (if (= @page :issuer-dashboard/to-confirm) active-classes non-active-classes)
|
||||
:on-click #(routes/nav! :issuer-dashboard/to-confirm)}
|
||||
:class (if (= route-id :dashboard/to-confirm) active-classes non-active-classes)
|
||||
:on-click #(routes/nav! :dashboard/to-confirm)}
|
||||
"To confirm payment"]
|
||||
[:span.dib.f6.tracked.ttu.pg-med.mr4.pb2
|
||||
{:role "button"
|
||||
:class (if (= @page :issuer-dashboard/to-merge) active-classes non-active-classes)
|
||||
:on-click #(routes/nav! :issuer-dashboard/to-merge)}
|
||||
:class (if (= route-id :dashboard/to-merge) active-classes non-active-classes)
|
||||
:on-click #(routes/nav! :dashboard/to-merge)}
|
||||
"To merge"]])
|
||||
[:div.cf
|
||||
[:div.fr.w-third.pl4.mb3.dn.db-l
|
||||
[bounty-stats-new @bounty-stats-data]]
|
||||
[:div.fr-l.w-two-thirds-l
|
||||
(case @page
|
||||
:issuer-dashboard/to-confirm (to-confirm-list (get grouped :pending-maintainer-confirmation))
|
||||
:issuer-dashboard/to-merge (to-merge-list (get grouped :claimed))
|
||||
(case route-id
|
||||
:dashboard/to-confirm (to-confirm-list (get grouped :pending-maintainer-confirmation))
|
||||
:dashboard/to-merge (to-merge-list (get grouped :claimed))
|
||||
(cond
|
||||
(seq (get grouped :pending-maintainer-confirmation))
|
||||
(routes/nav! :issuer-dashboard/to-confirm)
|
||||
(routes/nav! :dashboard/to-confirm)
|
||||
|
||||
(seq (get grouped :claimed))
|
||||
(routes/nav! :issuer-dashboard/to-merge)
|
||||
(routes/nav! :dashboard/to-merge)
|
||||
|
||||
:else (routes/nav! :issuer-dashboard/to-confirm)))
|
||||
:else (routes/nav! :dashboard/to-confirm)))
|
||||
(let [heading :h4.f3.normal.pg-book.sob-muted-blue]
|
||||
[:div.mt5
|
||||
[:div.mt4
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
["/activity" :activity]
|
||||
["/repos" :repos]
|
||||
["/dashboard" :dashboard]
|
||||
["/dashboard/to-confirm" :issuer-dashboard/to-confirm]
|
||||
["/dashboard/to-merge" :issuer-dashboard/to-merge]
|
||||
["/dashboard/to-confirm" :dashboard/to-confirm]
|
||||
["/dashboard/to-merge" :dashboard/to-merge]
|
||||
["/settings" :settings]
|
||||
["/usage-metrics" :usage-metrics]]))
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
(fn [db _] db))
|
||||
|
||||
(reg-sub
|
||||
:page
|
||||
(fn [db _]
|
||||
(:page db)))
|
||||
:route
|
||||
(fn [db _]
|
||||
(:route db)))
|
||||
|
||||
(reg-sub
|
||||
:user
|
||||
|
|
Loading…
Reference in New Issue