|
1 | | - |
2 | 1 | (ns status-im.ui.screens.desktop.main.chat.views |
3 | 2 | (:require-macros [status-im.utils.views :as views]) |
4 | 3 | (:require [re-frame.core :as re-frame] |
|
18 | 17 | [status-im.ui.screens.desktop.main.tabs.profile.views :as profile.views] |
19 | 18 | [status-im.ui.components.icons.vector-icons :as vector-icons] |
20 | 19 | [status-im.ui.screens.desktop.main.chat.styles :as styles] |
21 | | - [status-im.i18n :as i18n])) |
| 20 | + [status-im.utils.contacts :as utils.contacts] |
| 21 | + [status-im.i18n :as i18n] |
| 22 | + [status-im.ui.screens.desktop.main.chat.events :as chat.events])) |
22 | 23 |
|
23 | 24 | (views/defview toolbar-chat-view [{:keys [chat-id color public-key public? group-chat] |
24 | 25 | :as current-chat}] |
|
47 | 48 | [react/view |
48 | 49 | (when (and (not group-chat) (not public?)) |
49 | 50 | [react/text {:style (styles/profile-actions-text colors/black) |
50 | | - :on-press #(re-frame/dispatch [:navigate-to :chat-profile])} |
| 51 | + :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} |
51 | 52 | (i18n/label :t/view-profile)]) |
52 | 53 |
|
53 | 54 | [react/text {:style (styles/profile-actions-text colors/red) |
|
74 | 75 |
|
75 | 76 | (views/defview member-photo [from] |
76 | 77 | (letsubs [photo-path [:get-photo-path from]] |
77 | | - [react/image {:source {:uri (if (string/blank? photo-path) |
78 | | - (identicon/identicon from) |
79 | | - photo-path)} |
80 | | - :style styles/photo-style}])) |
| 78 | + [react/touchable-highlight {:on-press #(re-frame/dispatch [:show-profile-desktop from])} |
| 79 | + [react/image {:source {:uri (if (string/blank? photo-path) |
| 80 | + (identicon/identicon from) |
| 81 | + photo-path)} |
| 82 | + :style styles/photo-style}]])) |
81 | 83 |
|
82 | 84 | (views/defview my-photo [from] |
83 | 85 | (views/letsubs [account [:get-current-account]] |
|
213 | 215 | [chat-text-input]])) |
214 | 216 |
|
215 | 217 | (views/defview chat-profile [] |
216 | | - (views/letsubs [{:keys [pending? whisper-identity public-key] :as contact} [:get-current-chat-contact]] |
217 | | - [react/view {:style styles/chat-profile-body} |
218 | | - [profile.views/profile-badge contact] |
| 218 | + (letsubs [identity [:get-current-contact-identity] |
| 219 | + maybe-contact [:get-current-contact]] |
| 220 | + |
| 221 | + (let [contact (or maybe-contact (utils.contacts/whisper-id->new-contact identity)) |
| 222 | + {:keys [pending? whisper-identity public-key]} contact] |
| 223 | + [react/view {:style styles/chat-profile-body} |
| 224 | + [profile.views/profile-badge contact] |
219 | 225 | ;; for private chat, public key will be chat-id |
220 | | - [react/view |
221 | | - (if pending? |
222 | | - [react/touchable-highlight {:on-press #(re-frame/dispatch [:add-contact whisper-identity])} |
| 226 | + [react/view |
| 227 | + (if (or (nil? pending?) pending?) |
| 228 | + [react/touchable-highlight {:on-press #(re-frame/dispatch [:add-contact whisper-identity])} |
| 229 | + [react/view {:style styles/chat-profile-row} |
| 230 | + [react/view {:style styles/chat-profile-icon-container |
| 231 | + :accessibility-label :add-contact-link} |
| 232 | + [vector-icons/icon :icons/add {:style (styles/chat-profile-icon colors/blue)}]] |
| 233 | + [react/text {:style (styles/contact-card-text colors/blue)} (i18n/label :t/add-to-contacts)]]] |
| 234 | + [react/view {:style styles/chat-profile-row} |
| 235 | + [react/view {:style styles/chat-profile-icon-container |
| 236 | + :accessibility-label :add-contact-link} |
| 237 | + [vector-icons/icon :icons/add {:style (styles/chat-profile-icon colors/gray)}]] |
| 238 | + [react/text {:style (styles/contact-card-text colors/gray)} (i18n/label :t/in-contacts)]]) |
| 239 | + [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to-chat public-key])} |
223 | 240 | [react/view {:style styles/chat-profile-row} |
224 | 241 | [react/view {:style styles/chat-profile-icon-container |
225 | | - :accessibility-label :add-contact-link} |
226 | | - [vector-icons/icon :icons/add {:style (styles/chat-profile-icon colors/blue)}]] |
227 | | - [react/text {:style (styles/contact-card-text colors/blue)} (i18n/label :t/add-to-contacts)]]] |
228 | | - [react/view {:style styles/chat-profile-row} |
229 | | - [react/view {:style styles/chat-profile-icon-container |
230 | | - :accessibility-label :add-contact-link} |
231 | | - [vector-icons/icon :icons/add {:style (styles/chat-profile-icon colors/gray)}]] |
232 | | - [react/text {:style (styles/contact-card-text colors/gray)} (i18n/label :t/in-contacts)]]) |
233 | | - [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to-chat public-key])} |
234 | | - [react/view {:style styles/chat-profile-row} |
235 | | - [react/view {:style styles/chat-profile-icon-container |
236 | | - :accessibility-label :send-message-link} |
237 | | - [vector-icons/icon :icons/chats {:style (styles/chat-profile-icon colors/blue)}]] |
238 | | - [react/text {:style (styles/contact-card-text colors/blue)} |
239 | | - (i18n/label :t/send-message)]]] |
240 | | - [react/text {:style styles/chat-profile-contact-code} (i18n/label :t/contact-code)] |
241 | | - [react/text {:style {:font-size 14} |
242 | | - :selectable true |
243 | | - :selection-color colors/hawkes-blue} public-key]]])) |
| 242 | + :accessibility-label :send-message-link} |
| 243 | + [vector-icons/icon :icons/chats {:style (styles/chat-profile-icon colors/blue)}]] |
| 244 | + [react/text {:style (styles/contact-card-text colors/blue)} |
| 245 | + (i18n/label :t/send-message)]]] |
| 246 | + [react/text {:style styles/chat-profile-contact-code} (i18n/label :t/contact-code)] |
| 247 | + [react/text {:style {:font-size 14} |
| 248 | + :selectable true |
| 249 | + :selection-color colors/hawkes-blue} whisper-identity]]]))) |
0 commit comments