Merge branch 'develop' into test/newJenkins
This commit is contained in:
commit
2b65eab596
|
@ -65,6 +65,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|||
src="https://www.facebook.com/tr?id=293089407869419&ev=PageView&noscript=1"
|
||||
/></noscript>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="https://unpkg.com/tachyons@4.9.1/css/tachyons.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/css/style.css?v={{commiteth-version}}" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="/js/app.js?v={{commiteth-version}}"></script>
|
||||
<script>
|
||||
|
|
|
@ -135,4 +135,10 @@
|
|||
[:div.page-nav-text [:span (str "Page " page-number " of " page-count)]]
|
||||
[draw-page-numbers page-number page-count container-element]]])))
|
||||
|
||||
(defn usd-string
|
||||
"Turn a given float into a USD currency string based on the browsers locale setting.
|
||||
|
||||
A more complex and customizable approach can be found in goog.i18n.NumberFormat:
|
||||
https://google.github.io/closure-library/api/goog.i18n.NumberFormat.html"
|
||||
[usd-float]
|
||||
(.toLocaleString usd-float js/navigator.language #js {:style "currency" :currency "USD"}))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(ns commiteth.manage-payouts
|
||||
(:require [re-frame.core :as rf]
|
||||
[commiteth.common :refer [human-time]]))
|
||||
[commiteth.common :as common :refer [human-time]]))
|
||||
|
||||
|
||||
|
||||
|
@ -57,9 +57,21 @@
|
|||
(:claims bounty))]
|
||||
[claim-card bounty claim]))))
|
||||
|
||||
(defn bounty-stats [{:keys [paid unpaid]}]
|
||||
[:div.cf
|
||||
[:div.fl-ns.w-50-ns.tc.pv4
|
||||
[:div.ttu.tracked "Open"]
|
||||
[:div.f2.pa2 (common/usd-string (:combined-usd-value unpaid))]
|
||||
[:div (:count unpaid) " bounties"]]
|
||||
|
||||
[:div.fl-ns.w-50-ns.tc.pv4
|
||||
[:div.ttu.tracked "Paid"]
|
||||
[:div.f2.pa2 (common/usd-string (:combined-usd-value paid))]
|
||||
[:div (:count paid) " bounties"]]])
|
||||
|
||||
(defn manage-payouts-page []
|
||||
(let [owner-bounties (rf/subscribe [:owner-bounties])
|
||||
bounty-stats-data (rf/subscribe [:owner-bounties-stats])
|
||||
owner-bounties-loading? (rf/subscribe [:get-in [:owner-bounties-loading?]])]
|
||||
(fn []
|
||||
(if @owner-bounties-loading?
|
||||
|
@ -67,17 +79,14 @@
|
|||
[:div.ui.active.inverted.dimmer
|
||||
[:div.ui.text.loader "Loading"]]]
|
||||
(let [web3 (.-web3 js/window)
|
||||
bounties (vals @owner-bounties)
|
||||
unpaid? #(empty? (:payout_hash %))
|
||||
paid? #(not-empty (:payout_hash %))
|
||||
unpaid-bounties (filter unpaid? bounties)
|
||||
paid-bounties (filter paid? bounties)]
|
||||
bounties (vals @owner-bounties)]
|
||||
[:div.ui.container
|
||||
(when (nil? web3)
|
||||
[:div.ui.warning.message
|
||||
[:i.warning.icon]
|
||||
"To sign off claims, please view Status Open Bounty in Status, Mist or Metamask"])
|
||||
[bounty-stats @bounty-stats-data]
|
||||
[:h3 "New claims"]
|
||||
[claim-list unpaid-bounties]
|
||||
[claim-list (filter (complement :paid?) bounties)]
|
||||
[:h3 "Old claims"]
|
||||
[claim-list paid-bounties]])))))
|
||||
[claim-list (filter :paid? bounties)]])))))
|
||||
|
|
|
@ -68,7 +68,26 @@
|
|||
(reg-sub
|
||||
:owner-bounties
|
||||
(fn [db _]
|
||||
(:owner-bounties db)))
|
||||
(->> (for [[id bounty] (:owner-bounties db)]
|
||||
;; TODO(martinklepsch) we might want to consider using a
|
||||
;; special prefix or namespace for derived properties that
|
||||
;; are added to domain records like this
|
||||
;; e.g. `derived/paid?`
|
||||
[id (assoc bounty :paid? (boolean (:payout_hash bounty)))])
|
||||
(into {}))))
|
||||
|
||||
(reg-sub
|
||||
:owner-bounties-stats
|
||||
:<- [:owner-bounties]
|
||||
(fn [owner-bounties _]
|
||||
(let [sum-dollars (fn sum-dollars [bounties]
|
||||
(reduce + (map #(js/parseFloat (:value_usd %)) bounties)))
|
||||
{:keys [paid unpaid]} (group-by #(if (:paid? %) :paid :unpaid)
|
||||
(vals owner-bounties))]
|
||||
{:paid {:count (count paid)
|
||||
:combined-usd-value (sum-dollars paid)}
|
||||
:unpaid {:count (count unpaid)
|
||||
:combined-usd-value (sum-dollars unpaid)}})))
|
||||
|
||||
(reg-sub
|
||||
:pagination
|
||||
|
|
Loading…
Reference in New Issue