mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-12 10:34:30 +00:00
193 checkbox updated
This commit is contained in:
parent
fea8d4f0b5
commit
559f4f4212
@ -10,21 +10,6 @@
|
|||||||
:value @val-ratom
|
:value @val-ratom
|
||||||
:on-change #(reset! val-ratom (-> % .-target .-value))})]))
|
:on-change #(reset! val-ratom (-> % .-target .-value))})]))
|
||||||
|
|
||||||
(defn checkbox
|
|
||||||
"Common checkbox widget. Takes a boolean value wrapped into an atom
|
|
||||||
and updates its state when clicking in it. An additional `opt` map
|
|
||||||
is to override its attributes (class, id, etc)."
|
|
||||||
[val-atom & [opt]]
|
|
||||||
[:input
|
|
||||||
(merge
|
|
||||||
{:type :checkbox
|
|
||||||
:checked @val-atom
|
|
||||||
:on-change
|
|
||||||
(fn [e]
|
|
||||||
(let [value (-> e .-target .-checked)]
|
|
||||||
(reset! val-atom value)))}
|
|
||||||
opt)])
|
|
||||||
|
|
||||||
(defn dropdown [props title val-ratom items]
|
(defn dropdown [props title val-ratom items]
|
||||||
(fn []
|
(fn []
|
||||||
(if (= 1 (count items))
|
(if (= 1 (count items))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
(ns commiteth.update-address
|
(ns commiteth.update-address
|
||||||
(:require [re-frame.core :as rf]
|
(:require [re-frame.core :as rf]
|
||||||
[commiteth.common :refer [input dropdown checkbox]]
|
[commiteth.common :refer [input dropdown]]
|
||||||
[reagent.core :as r]
|
[reagent.core :as r]
|
||||||
[reagent.crypt :as crypt]
|
[reagent.crypt :as crypt]
|
||||||
[cljs-web3.eth :as web3-eth]))
|
[cljs-web3.eth :as web3-eth]))
|
||||||
@ -10,12 +10,7 @@
|
|||||||
user (rf/subscribe [:user])
|
user (rf/subscribe [:user])
|
||||||
updating-address (rf/subscribe [:get-in [:updating-address]])
|
updating-address (rf/subscribe [:get-in [:updating-address]])
|
||||||
address (r/atom @(rf/subscribe [:get-in [:user :address]]))
|
address (r/atom @(rf/subscribe [:get-in [:user :address]]))
|
||||||
hidden (r/atom @(rf/subscribe [:get-in [:user :is_hidden]]))]
|
hidden (rf/subscribe [:get-in [:user :is_hidden]])]
|
||||||
|
|
||||||
(add-watch hidden
|
|
||||||
:default
|
|
||||||
(fn [_ _ _ new-val]
|
|
||||||
(rf/dispatch [:mark-user-hidden (:id @user) new-val])))
|
|
||||||
|
|
||||||
(fn []
|
(fn []
|
||||||
(let [web3 (:web3 @db)
|
(let [web3 (:web3 @db)
|
||||||
@ -50,5 +45,14 @@
|
|||||||
|
|
||||||
[:h3 "Settings"]
|
[:h3 "Settings"]
|
||||||
[:div
|
[:div
|
||||||
[checkbox hidden {:id :input-hidden}]
|
|
||||||
|
[:input
|
||||||
|
{:type :checkbox
|
||||||
|
:id :input-hidden
|
||||||
|
:checked @hidden
|
||||||
|
:on-change
|
||||||
|
(fn [e]
|
||||||
|
(let [value (-> e .-target .-checked)]
|
||||||
|
(rf/dispatch [:mark-user-hidden (:id @user) value])))}]
|
||||||
|
|
||||||
[:label {:for :input-hidden} "Disguise myself from the top hunters and activity lists."]]]]))))
|
[:label {:for :input-hidden} "Disguise myself from the top hunters and activity lists."]]]]))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user