mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-27 00:20:46 +00:00
[FIX #187] Add dummy value to Metamask dropdown;
do not automatically preselect first item in the list; convert addresses to lower-case
This commit is contained in:
parent
3f883a36c1
commit
3c4413b160
@ -10,18 +10,19 @@
|
||||
(merge props {:type "text"
|
||||
:value @val-ratom
|
||||
:on-change #(reset! val-ratom (-> % .-target .-value))})]))
|
||||
|
||||
(defn dropdown [props title val-ratom items]
|
||||
(fn []
|
||||
(if (= 1 (count items))
|
||||
(reset! val-ratom (first items)))
|
||||
[:select.ui.basic.selection.dropdown
|
||||
(merge props {:on-change
|
||||
#(reset! val-ratom (-> % .-target .-value))})
|
||||
(doall (for [item items]
|
||||
^{:key item} [:option
|
||||
{:value item}
|
||||
item]))]))
|
||||
#(let [selected-value (-> % .-target .-value)]
|
||||
(when (not= selected-value title)
|
||||
(reset! val-ratom selected-value)))
|
||||
:default-value (if (contains? (set items) @val-ratom)
|
||||
@val-ratom
|
||||
title)})
|
||||
(conj (doall (for [item items]
|
||||
^{:key item} [:option {:value item} item]))
|
||||
^{:key title} [:option {:value title :disabled true} title])]))
|
||||
|
||||
(defn moment-timestamp [time]
|
||||
(let [now (.now js/Date.)
|
||||
|
@ -3,6 +3,7 @@
|
||||
[commiteth.common :refer [input dropdown]]
|
||||
[reagent.core :as r]
|
||||
[reagent.crypt :as crypt]
|
||||
[clojure.string :as str]
|
||||
[cljs-web3.eth :as web3-eth]))
|
||||
|
||||
|
||||
@ -10,7 +11,9 @@
|
||||
(let [db (rf/subscribe [:db])
|
||||
user (rf/subscribe [:user])
|
||||
updating-address (rf/subscribe [:get-in [:updating-address]])
|
||||
address (r/atom @(rf/subscribe [:get-in [:user :address]]))]
|
||||
address (-> @(rf/subscribe [:get-in [:user :address]])
|
||||
str/lower-case
|
||||
r/atom)]
|
||||
(fn []
|
||||
(let [web3 (:web3 @db)
|
||||
web3-accounts (when web3
|
||||
@ -22,13 +25,12 @@
|
||||
[:p "Insert your Ethereum address in hex format."]
|
||||
[:div.field
|
||||
(if-not (empty? web3-accounts)
|
||||
[dropdown {:class "address-input"} "Select address"
|
||||
[dropdown {:class "address-input"}
|
||||
"Select address"
|
||||
address
|
||||
(vec
|
||||
(for [acc web3-accounts]
|
||||
acc))]
|
||||
(map str/lower-case web3-accounts)]
|
||||
[:div.ui.input.address-input
|
||||
[input address {:placeholder "0x0000000000000000000000000000000000000000"
|
||||
[input address {:placeholder "0x0000000000000000000000000000000000000000"
|
||||
:auto-complete "off"
|
||||
:auto-correct "off"
|
||||
:spell-check "false"
|
||||
|
Loading…
x
Reference in New Issue
Block a user