Skip to content

Commit 913963f

Browse files
committed
feature: integrate contact-request sheet
1 parent e75187e commit 913963f

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(ns status-im.contexts.profile.contact.contact-request.style)
2+
3+
(def message-prompt-wrapper
4+
{:padding-top 4
5+
:padding-bottom 8
6+
:padding-horizontal 20})
7+
8+
(def message-input-wrapper
9+
{:padding-vertical 8
10+
:padding-horizontal 20})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
(ns status-im.contexts.profile.contact.contact-request.view
2+
(:require [clojure.string :as string]
3+
[quo.core :as quo]
4+
[react-native.core :as rn]
5+
[status-im.contexts.profile.contact.contact-request.style :as style]
6+
[utils.i18n :as i18n]
7+
[utils.re-frame :as rf]))
8+
9+
(defn view
10+
[{:keys [full-name profile-picture customization-color public-key]}]
11+
(let [[message set-message] (rn/use-state "")
12+
on-message-change (rn/use-callback #(set-message %))
13+
on-message-submit (rn/use-callback (fn []
14+
(rf/dispatch [:hide-bottom-sheet])
15+
(rf/dispatch [:contact.ui/send-contact-request
16+
public-key message]))
17+
[public-key message])]
18+
[:<>
19+
[quo/drawer-top
20+
{:type :context-tag
21+
:context-tag-type :default
22+
:title (i18n/label :t/send-contact-request)
23+
:full-name full-name
24+
:profile-picture profile-picture
25+
:customization-color customization-color}]
26+
[rn/text {:style style/message-prompt-wrapper}
27+
(i18n/label :t/contact-request-message-prompt)]
28+
[rn/view {:style style/message-input-wrapper}
29+
[quo/input
30+
{:type :text
31+
:multiline? true
32+
:char-limit 280
33+
:label (i18n/label :t/message)
34+
:on-change-text on-message-change}]]
35+
[quo/bottom-actions
36+
{:actions :one-action
37+
:button-one-props {:disabled? (string/blank? message)
38+
:on-press on-message-submit}
39+
:button-one-label (i18n/label :t/send-contact-request)}]]))

src/status_im/contexts/profile/contact/header/view.cljs

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[react-native.core :as rn]
66
[status-im.common.not-implemented]
77
[status-im.common.scalable-avatar.view :as avatar]
8+
[status-im.contexts.profile.contact.contact-request.view :as contact-request]
89
[status-im.contexts.profile.contact.header.style :as style]
910
[status-im.contexts.profile.utils :as profile.utils]
1011
[utils.i18n :as i18n]
@@ -36,6 +37,11 @@
3637
:emoji-dash emoji-hash}]
3738
[rn/view {:style style/button-wrapper}
3839
[quo/button
39-
{:on-press status-im.common.not-implemented/alert
40+
{:on-press #(rf/dispatch [:show-bottom-sheet
41+
{:content (fn [] [contact-request/view
42+
{:customization-color customization-color
43+
:profile-picture profile-picture
44+
:full-name full-name
45+
:public-key public-key}])}])
4046
:icon-left :i/add-user}
4147
(i18n/label :t/send-contact-request)]]]))

0 commit comments

Comments
 (0)