Skip to content

Commit

Permalink
tidy: subscribe to contact data inside contact-request view
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstrom committed Feb 29, 2024
1 parent 913963f commit 802d9c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 9 additions & 2 deletions src/status_im/contexts/profile/contact/contact_request/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
[quo.core :as quo]
[react-native.core :as rn]
[status-im.contexts.profile.contact.contact-request.style :as style]
[status-im.contexts.profile.utils :as profile.utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn view
[{:keys [full-name profile-picture customization-color public-key]}]
(let [[message set-message] (rn/use-state "")
[]
(let [{:keys [public-key customization-color]
:as profile} (rf/sub [:contacts/current-contact])
;; TODO: remove :blue when #18733 merged.
customization-color (or customization-color :blue)
full-name (profile.utils/displayed-name profile)
profile-picture (profile.utils/photo profile)
[message set-message] (rn/use-state "")
on-message-change (rn/use-callback #(set-message %))
on-message-submit (rn/use-callback (fn []
(rf/dispatch [:hide-bottom-sheet])
Expand Down
6 changes: 1 addition & 5 deletions src/status_im/contexts/profile/contact/header/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
[rn/view {:style style/button-wrapper}
[quo/button
{:on-press #(rf/dispatch [:show-bottom-sheet
{:content (fn [] [contact-request/view
{:customization-color customization-color
:profile-picture profile-picture
:full-name full-name
:public-key public-key}])}])
{:content (fn [] [contact-request/view])}])
:icon-left :i/add-user}
(i18n/label :t/send-contact-request)]]]))

0 comments on commit 802d9c0

Please sign in to comment.