Improve flash message styling & invalid address error message

* more readable flash message popup
* close flash message popup by clicking outside
* show input in "invalid address" error message
This commit is contained in:
Teemu Patja 2017-11-03 09:50:15 +02:00
parent d265977e03
commit e39d07c37f
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
4 changed files with 19 additions and 6 deletions

View File

@ -235,8 +235,10 @@
:body-params [user-id :- Long, address :- String] :body-params [user-id :- Long, address :- String]
:summary "Update user address" :summary "Update user address"
(if-not (eth/valid-address? address) (if-not (eth/valid-address? address)
{:status 400 (do
:body "Invalid Ethereum address"} (log/debug "POST /address: invalid input" address)
{:status 400
:body (str "Invalid Ethereum address '" address "'")})
(let [result (users/update-user-address (let [result (users/update-user-address
user-id user-id
address)] address)]

View File

@ -285,4 +285,5 @@
(load-interceptors!) (load-interceptors!)
(hook-browser-navigation!) (hook-browser-navigation!)
(load-data true) (load-data true)
(.addEventListener js/window "click" #(rf/dispatch [:clear-flash-message]))
(on-js-load)) (on-js-load))

View File

@ -324,9 +324,11 @@
(dispatch [:set-flash-message (dispatch [:set-flash-message
:success :success
"Address saved"])) "Address saved"]))
:on-error #(dispatch [:set-flash-message :on-error #(do
:error (println %)
(:response %)]) (dispatch [:set-flash-message
:error
(:response %)]))
:finally #(dispatch [:clear-updating-address]) :finally #(dispatch [:clear-updating-address])
:params {:user-id user-id :address address}}})) :params {:user-id user-id :address address}}}))

View File

@ -607,11 +607,14 @@
&.error { &.error {
background-color: #e96868; background-color: #e96868;
} }
display: flex;
flex-direction: column;
color: #fff; color: #fff;
border-radius: 8px; border-radius: 8px;
z-index: 100; z-index: 100;
padding: 1.4em 1em 1.4em; padding: 40px 60px 40px;
height: auto;
i { i {
position: absolute; position: absolute;
margin: 0; margin: 0;
@ -619,6 +622,11 @@
top: 1.5em; top: 1.5em;
cursor: pointer; cursor: pointer;
} }
p {
font-family: "PostGrotesk-Book";
font-weight: 500;
font-size: 15px;
}
} }