fix #301: add basic stats to manage payouts screen
This commit is contained in:
parent
9d9ebefc30
commit
3cdfa549b7
|
@ -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>
|
||||
|
|
|
@ -57,6 +57,19 @@
|
|||
(:claims bounty))]
|
||||
[claim-card bounty claim]))))
|
||||
|
||||
(defn bounty-stats [{:keys [paid unpaid]}]
|
||||
(let [sum-dollars (fn [bounties]
|
||||
(reduce + (map #(js/parseFloat (:value_usd %)) bounties)))]
|
||||
[:div.cf.pv4
|
||||
[:div.fl.w-50.tc
|
||||
[:div.ttu.tracked "Open"]
|
||||
[:div.f2.pa2 "$" (sum-dollars unpaid)]
|
||||
[:div (count unpaid) " bounties"]]
|
||||
|
||||
[:div.fl.w-50.tc
|
||||
[:div.ttu.tracked "Paid"]
|
||||
[:div.f2.pa2 "$" (sum-dollars paid)]
|
||||
[:div (count paid) " bounties"]]]))
|
||||
|
||||
(defn manage-payouts-page []
|
||||
(let [owner-bounties (rf/subscribe [:owner-bounties])
|
||||
|
@ -68,15 +81,16 @@
|
|||
[: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? :payout_hash
|
||||
unpaid-bounties (filter (complement paid?) bounties)
|
||||
paid-bounties (filter paid? 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 {:paid paid-bounties
|
||||
:unpaid unpaid-bounties}]
|
||||
[:h3 "New claims"]
|
||||
[claim-list unpaid-bounties]
|
||||
[:h3 "Old claims"]
|
||||
|
|
Loading…
Reference in New Issue