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