Add contact form fixes (#405)

Former-commit-id: 11c477756c
This commit is contained in:
Alexander Pantyuhov 2016-11-03 00:19:45 +03:00
parent 4218014337
commit 54da5d5005
2 changed files with 19 additions and 14 deletions

View File

@ -189,7 +189,8 @@
(def form-container (def form-container
{:margin-left 16 {:margin-left 16
:margin-top 16}) :margin-top 16
:height 72})
(def address-explication-container (def address-explication-container
{:flex 1 {:flex 1

View File

@ -13,9 +13,10 @@
[status-im.components.status-bar :refer [status-bar]] [status-im.components.status-bar :refer [status-bar]]
[status-im.components.toolbar.view :refer [toolbar]] [status-im.components.toolbar.view :refer [toolbar]]
[status-im.components.toolbar.styles :refer [toolbar-title-container [status-im.components.toolbar.styles :refer [toolbar-title-container
toolbar-title-text]] toolbar-title-text
toolbar-background1]]
[status-im.utils.utils :refer [log http-post]] [status-im.utils.utils :refer [log http-post]]
[status-im.components.styles :refer [icon-search [status-im.components.styles :refer [icon-ok
icon-back icon-back
button-input-container button-input-container
button-input]] button-input]]
@ -25,7 +26,8 @@
[status-im.contacts.validations :as v] [status-im.contacts.validations :as v]
[status-im.contacts.styles :as st] [status-im.contacts.styles :as st]
[status-im.utils.gfycat.core :refer [generate-gfy]] [status-im.utils.gfycat.core :refer [generate-gfy]]
[status-im.utils.hex :refer [normalize-hex]])) [status-im.utils.hex :refer [normalize-hex]]
[status-im.utils.platform :refer [platform-specific]]))
(def toolbar-title (def toolbar-title
@ -69,7 +71,7 @@
[{:image {:source {:uri (if (str/blank? error-message) [{:image {:source {:uri (if (str/blank? error-message)
:icon_ok_blue :icon_ok_blue
:icon_ok_disabled)} :icon_ok_disabled)}
:style icon-search} :style icon-ok}
:handler #(when (str/blank? error-message) :handler #(when (str/blank? error-message)
(on-add-contact new-contact-identity))}])) (on-add-contact new-contact-identity))}]))
@ -89,7 +91,9 @@
(dispatch [:set-in [:new-contact-identity] %]) (dispatch [:set-in [:new-contact-identity] %])
(dispatch [:set :new-contact-address-error nil]))}] (dispatch [:set :new-contact-address-error nil]))}]
[scan-button {:showLabel (zero? (count whisper-identity)) [scan-button {:showLabel (zero? (count whisper-identity))
:handler #(dispatch [:scan-qr-code {:toolbar-title (label :t/new-contact)} :set-contact-identity-from-qr])}]])) :handler #(dispatch [:scan-qr-code
{:toolbar-title (label :t/new-contact)}
:set-contact-identity-from-qr])}]]))
(defview new-contact [] (defview new-contact []
@ -97,14 +101,14 @@
error [:get :new-contact-address-error] error [:get :new-contact-address-error]
account [:get-current-account]] account [:get-current-account]]
[view st/contact-form-container [view st/contact-form-container
[view [status-bar]
[status-bar] [toolbar {:background-color toolbar-background1
[toolbar {:background-color :white :style (get-in platform-specific [:component-styles :toolbar])
:nav-action {:image {:source {:uri :icon_back} :nav-action {:image {:source {:uri :icon_back}
:style icon-back} :style icon-back}
:handler #(dispatch [:navigate-back])} :handler #(dispatch [:navigate-back])}
:custom-content toolbar-title :title (label :t/add-new-contact)
:actions (toolbar-actions new-contact-identity account error)}]] :actions (toolbar-actions new-contact-identity account error)}]
[view st/form-container [view st/form-container
[contact-whisper-id-input new-contact-identity error]] [contact-whisper-id-input new-contact-identity error]]
[view st/address-explication-container [view st/address-explication-container