|
5 | 5 | [react-native.core :as rn]
|
6 | 6 | [react-native.clipboard :as clipboard]
|
7 | 7 | [reagent.core :as reagent]
|
8 |
| - [status-im2.common.resources :as resources] |
9 | 8 | [status-im.qr-scanner.core :as qr-scanner]
|
10 | 9 | [status-im.utils.utils :as utils]
|
11 | 10 | [status-im2.contexts.add-new-contact.style :as style]
|
| 11 | + [status-im2.common.bottom-sheet-screen.view :as bottom-sheet-screen] |
12 | 12 | [utils.debounce :as debounce]
|
13 | 13 | [utils.i18n :as i18n]
|
14 | 14 | [utils.re-frame :as rf]))
|
|
55 | 55 | show-paste-button? (and (not (string/blank? @clipboard))
|
56 | 56 | (string/blank? @default-value)
|
57 | 57 | (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)]]])])))) |
0 commit comments