Merge branch 'develop' of https://github.com/status-im/open-bounty into 193-hide-myself

This commit is contained in:
Ivan Grishaev 2018-02-12 18:12:01 +03:00
commit 34c16456ea
2 changed files with 13 additions and 25 deletions

View File

@ -12,17 +12,16 @@
:on-change #(reset! val-ratom (-> % .-target .-value))})]))
(defn dropdown [props title val-ratom items]
"If val-ratom is set, preselect it in the dropdown.
Otherwise, prepend title as a disabled option."
(fn []
(if (= 1 (count items))
(reset! val-ratom (first items)))
[:select.ui.basic.selection.dropdown
(merge props {:on-change
#(reset! val-ratom (-> % .-target .-value))
:default-value (or @val-ratom title)})
(for [item items]
^{:key item} [:option {:value item
:disabled (= item title)}
item])]))
#(reset! val-ratom (-> % .-target .-value))})
(doall (for [item items]
^{:key item} [:option
{:value item}
item]))]))
(defn moment-timestamp [time]
(let [now (.now js/Date.)

View File

@ -3,7 +3,6 @@
[commiteth.common :refer [input dropdown]]
[reagent.core :as r]
[reagent.crypt :as crypt]
[clojure.string :as str]
[cljs-web3.eth :as web3-eth]))
(defn update-address-page []
@ -22,25 +21,15 @@
[:p "Insert your Ethereum address in hex format."]
[:div.field
(if-not (empty? web3-accounts)
; Add value of address if it's missing from items list.
[dropdown {:class "address-input"} "Select address"
; If address is empty, add title
(let [accounts (map str/lower-case web3-accounts)
addr @address
title "Select address"
addr-not-in-web3? (and addr (as-> web3-accounts acc
(map str/lower-case acc)
(set acc)
(contains? acc addr)
(not acc)))
items (cond->> web3-accounts
addr-not-in-web3? (into [addr])
(not addr) (into [title]))]
[dropdown {:class "address-input"}
title
address
items])
address
(vec
(for [acc web3-accounts]
acc))]
[:div.ui.input.address-input
[input address {:placeholder "0x0000000000000000000000000000000000000000"
[input address {:placeholder "0x0000000000000000000000000000000000000000"
:auto-complete "off"
:auto-correct "off"
:spell-check "false"