Skip to content

Commit 7562207

Browse files
committed
Update contact screen to new designs
1 parent abe4dc7 commit 7562207

File tree

3 files changed

+70
-85
lines changed

3 files changed

+70
-85
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

+64-66
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
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]
11+
[status-im2.common.bottom-sheet-screen.view :as bottom-sheet-screen]
1212
[utils.debounce :as debounce]
1313
[utils.i18n :as i18n]
1414
[utils.re-frame :as rf]))
@@ -55,68 +55,66 @@
5555
show-paste-button? (and (not (string/blank? @clipboard))
5656
(string/blank? @default-value)
5757
(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}]
63-
[quo/button
64-
(merge (style/button-close)
65-
{:on-press
66-
(fn []
67-
(reset! clipboard nil)
68-
(reset! default-value nil)
69-
(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
113-
[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)]]]]))))
58+
59+
[bottom-sheet-screen/view
60+
(fn [{:keys [close]}]
61+
[rn/view (style/container-outer)
62+
[rn/view style/container-inner
63+
[quo/button
64+
(merge (style/button-close)
65+
{:on-press
66+
(fn []
67+
(reset! clipboard nil)
68+
(reset! default-value nil)
69+
(rf/dispatch [:contacts/clear-new-identity])
70+
(close))}) :i/close]
71+
[quo/text (style/text-title)
72+
(i18n/label :t/add-a-contact)]
73+
[quo/text (style/text-subtitle)
74+
(i18n/label :t/find-your-friends)]
75+
[quo/text (style/text-description)
76+
(i18n/label :t/ens-or-chat-key)]
77+
[rn/view style/container-text-input
78+
[rn/view (style/text-input-container invalid?)
79+
[rn/text-input
80+
(merge (style/text-input)
81+
{:default-value (or scanned @default-value input)
82+
:placeholder (i18n/label :t/type-some-chat-key)
83+
:on-change-text (fn [v]
84+
(reset! default-value v)
85+
(debounce/debounce-and-dispatch
86+
[:contacts/set-new-identity v nil]
87+
600))})]
88+
(when show-paste-button?
89+
[quo/button
90+
(merge style/button-paste
91+
{:on-press
92+
(fn []
93+
(reset! default-value @clipboard)
94+
(rf/dispatch
95+
[:contacts/set-new-identity @clipboard nil]))})
96+
(i18n/label :t/paste)])]
97+
[quo/button
98+
(merge style/button-qr
99+
{:on-press #(rf/dispatch
100+
[::qr-scanner/scan-code
101+
{:handler :contacts/qr-code-scanned}])})
102+
:i/scan]]
103+
(when invalid?
104+
[rn/view style/container-invalid
105+
[quo/icon :i/alert style/icon-invalid]
106+
[quo/text style/text-invalid
107+
(i18n/label (or msg :t/invalid-ens-or-key))]])
108+
(when (= state :valid)
109+
[found-contact public-key])]
110+
[rn/view
111+
[quo/button
112+
(merge (style/button-view-profile state)
113+
{:on-press
114+
(fn []
115+
(reset! clipboard nil)
116+
(reset! default-value nil)
117+
(rf/dispatch [:contacts/clear-new-identity])
118+
(close)
119+
(rf/dispatch [:chat.ui/show-profile public-key ens]))})
120+
(i18n/label :t/view-profile)]]])]))))

src/status_im2/navigation/screens.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@
107107
:component album-selector/album-selector}
108108

109109
{:name :new-contact
110-
:options {:topBar {:visible false}}
110+
:insets bottom-sheet-insets
111+
:options bottom-sheet-options
111112
:component add-new-contact/new-contact}
112113

113114
{:name :discover-communities

0 commit comments

Comments
 (0)