193 checkbox updated
This commit is contained in:
parent
fea8d4f0b5
commit
559f4f4212
|
@ -10,21 +10,6 @@
|
|||
:value @val-ratom
|
||||
: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]
|
||||
(fn []
|
||||
(if (= 1 (count items))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(ns commiteth.update-address
|
||||
(:require [re-frame.core :as rf]
|
||||
[commiteth.common :refer [input dropdown checkbox]]
|
||||
[commiteth.common :refer [input dropdown]]
|
||||
[reagent.core :as r]
|
||||
[reagent.crypt :as crypt]
|
||||
[cljs-web3.eth :as web3-eth]))
|
||||
|
@ -10,12 +10,7 @@
|
|||
user (rf/subscribe [:user])
|
||||
updating-address (rf/subscribe [:get-in [:updating-address]])
|
||||
address (r/atom @(rf/subscribe [:get-in [:user :address]]))
|
||||
hidden (r/atom @(rf/subscribe [:get-in [:user :is_hidden]]))]
|
||||
|
||||
(add-watch hidden
|
||||
:default
|
||||
(fn [_ _ _ new-val]
|
||||
(rf/dispatch [:mark-user-hidden (:id @user) new-val])))
|
||||
hidden (rf/subscribe [:get-in [:user :is_hidden]])]
|
||||
|
||||
(fn []
|
||||
(let [web3 (:web3 @db)
|
||||
|
@ -50,5 +45,14 @@
|
|||
|
||||
[:h3 "Settings"]
|
||||
[: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."]]]]))))
|
||||
|
|
Loading…
Reference in New Issue