Skip to content

Commit ff22ba1

Browse files
erikseppanenibrkhalil
authored andcommitted
Update contact screen to new design (#15526)
1 parent 9490c5c commit ff22ba1

File tree

3 files changed

+58
-76
lines changed

3 files changed

+58
-76
lines changed

src/status_im2/contexts/add_new_contact/style.cljs

+4-18
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
[react-native.platform :as platform]
44
[quo2.foundations.typography :as typography]))
55

6-
(defn container-kbd
7-
[]
8-
{:style {:flex 1}
9-
:keyboardVerticalOffset 60})
10-
11-
(def container-image
12-
{:style {:flex 1
13-
:flex-direction :row}})
14-
15-
(def image
16-
{:flex 1})
17-
186
(defn container-outer
197
[]
208
{:style {:flex (if platform/ios? 4.5 5)
@@ -41,7 +29,8 @@
4129
[]
4230
{:size :heading-1
4331
:weight :semi-bold
44-
:style {:margin-bottom 6
32+
:style {:margin-top 32
33+
:margin-bottom 6
4534
:color (colors/theme-colors
4635
colors/neutral-100
4736
colors/white)}})
@@ -127,11 +116,8 @@
127116
:accessibility-label :new-contact-close-button
128117
:size 32
129118
:override-background-color (colors/theme-colors
130-
colors/white-opa-60
131-
colors/neutral-80-opa-60)
132-
:style {:position :absolute
133-
:left 20
134-
:top 20}})
119+
colors/neutral-10
120+
colors/neutral-90)})
135121

136122
(def button-qr
137123
{:type :outline

src/status_im2/contexts/add_new_contact/views.cljs

+53-58
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
[react-native.core :as rn]
66
[react-native.clipboard :as clipboard]
77
[reagent.core :as reagent]
8-
[status-im2.common.resources :as resources]
98
[status-im.qr-scanner.core :as qr-scanner]
109
[status-im.utils.utils :as utils]
1110
[status-im2.contexts.add-new-contact.style :as style]
@@ -55,68 +54,64 @@
5554
show-paste-button? (and (not (string/blank? @clipboard))
5655
(string/blank? @default-value)
5756
(string/blank? input))]
58-
[rn/keyboard-avoiding-view (style/container-kbd)
59-
[rn/view style/container-image
60-
[rn/image
61-
{:source (resources/get-image :add-new-contact)
62-
:style style/image}]
57+
58+
[rn/view (style/container-outer)
59+
[rn/view style/container-inner
6360
[quo/button
6461
(merge (style/button-close)
6562
{:on-press
6663
(fn []
6764
(reset! clipboard nil)
6865
(reset! default-value nil)
6966
(rf/dispatch [:contacts/clear-new-identity])
70-
(rf/dispatch [:navigate-back]))}) :i/close]]
71-
[rn/view (style/container-outer)
72-
[rn/view style/container-inner
73-
[quo/text (style/text-title)
74-
(i18n/label :t/add-a-contact)]
75-
[quo/text (style/text-subtitle)
76-
(i18n/label :t/find-your-friends)]
77-
[quo/text (style/text-description)
78-
(i18n/label :t/ens-or-chat-key)]
79-
[rn/view style/container-text-input
80-
[rn/view (style/text-input-container invalid?)
81-
[rn/text-input
82-
(merge (style/text-input)
83-
{:default-value (or scanned @default-value input)
84-
:placeholder (i18n/label :t/type-some-chat-key)
85-
:on-change-text (fn [v]
86-
(reset! default-value v)
87-
(debounce/debounce-and-dispatch
88-
[:contacts/set-new-identity v nil]
89-
600))})]
90-
(when show-paste-button?
91-
[quo/button
92-
(merge style/button-paste
93-
{:on-press
94-
(fn []
95-
(reset! default-value @clipboard)
96-
(rf/dispatch
97-
[:contacts/set-new-identity @clipboard nil]))})
98-
(i18n/label :t/paste)])]
99-
[quo/button
100-
(merge style/button-qr
101-
{:on-press #(rf/dispatch
102-
[::qr-scanner/scan-code
103-
{:handler :contacts/qr-code-scanned}])})
104-
:i/scan]]
105-
(when invalid?
106-
[rn/view style/container-invalid
107-
[quo/icon :i/alert style/icon-invalid]
108-
[quo/text style/text-invalid
109-
(i18n/label (or msg :t/invalid-ens-or-key))]])
110-
(when (= state :valid)
111-
[found-contact public-key])]
112-
[rn/view
67+
(rf/dispatch [:navigate-back]))}) :i/close]
68+
[quo/text (style/text-title)
69+
(i18n/label :t/add-a-contact)]
70+
[quo/text (style/text-subtitle)
71+
(i18n/label :t/find-your-friends)]
72+
[quo/text (style/text-description)
73+
(i18n/label :t/ens-or-chat-key)]
74+
[rn/view style/container-text-input
75+
[rn/view (style/text-input-container invalid?)
76+
[rn/text-input
77+
(merge (style/text-input)
78+
{:default-value (or scanned @default-value input)
79+
:placeholder (i18n/label :t/type-some-chat-key)
80+
:on-change-text (fn [v]
81+
(reset! default-value v)
82+
(debounce/debounce-and-dispatch
83+
[:contacts/set-new-identity v nil]
84+
600))})]
85+
(when show-paste-button?
86+
[quo/button
87+
(merge style/button-paste
88+
{:on-press
89+
(fn []
90+
(reset! default-value @clipboard)
91+
(rf/dispatch
92+
[:contacts/set-new-identity @clipboard nil]))})
93+
(i18n/label :t/paste)])]
11394
[quo/button
114-
(merge (style/button-view-profile state)
115-
{:on-press
116-
(fn []
117-
(reset! clipboard nil)
118-
(reset! default-value nil)
119-
(rf/dispatch [:contacts/clear-new-identity])
120-
(rf/dispatch [:navigate-back])
121-
(rf/dispatch [:chat.ui/show-profile public-key ens]))})
122-
(i18n/label :t/view-profile)]]]]))))
95+
(merge style/button-qr
96+
{:on-press #(rf/dispatch
97+
[::qr-scanner/scan-code
98+
{:handler :contacts/qr-code-scanned}])})
99+
:i/scan]]
100+
(when invalid?
101+
[rn/view style/container-invalid
102+
[quo/icon :i/alert style/icon-invalid]
103+
[quo/text style/text-invalid
104+
(i18n/label (or msg :t/invalid-ens-or-key))]])
105+
(when (= state :valid)
106+
[found-contact public-key])]
107+
[rn/view
108+
[quo/button
109+
(merge (style/button-view-profile state)
110+
{:on-press
111+
(fn []
112+
(reset! clipboard nil)
113+
(reset! default-value nil)
114+
(rf/dispatch [:contacts/clear-new-identity])
115+
(rf/dispatch [:navigate-back])
116+
(rf/dispatch [:chat.ui/show-profile public-key ens]))})
117+
(i18n/label :t/view-profile)]]]))))

src/status_im2/navigation/screens.cljs

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
:component album-selector/album-selector}
7272

7373
{:name :new-contact
74+
:options {:sheet? true}
7475
:component add-new-contact/new-contact}
7576

7677
{:name :discover-communities

0 commit comments

Comments
 (0)