@@ -10,6 +10,7 @@ import {
10
10
WithDrawConnectionRequestButton ,
11
11
} from "../common/buttons" ;
12
12
import { successMessage } from "../common/desktop-notification" ;
13
+ import { getChatBoxId } from "../messaging-section/helper/api_call" ;
13
14
import { connectionSpecificOperations } from "./helper/api_call" ;
14
15
15
16
const ConnectionCollectionItem = ( {
@@ -31,7 +32,7 @@ const ConnectionCollectionItem = ({
31
32
< ButtonCollectionPrediction
32
33
darkMode = { darkMode }
33
34
connectionType = { connectionType }
34
- userId = { user . id }
35
+ partnerUserId = { user . id }
35
36
setCollectiveIds = { setCollectiveIds }
36
37
/>
37
38
</ div >
@@ -42,30 +43,30 @@ const ConnectionCollectionItem = ({
42
43
const ButtonCollectionPrediction = ( {
43
44
connectionType,
44
45
darkMode,
45
- userId ,
46
+ partnerUserId ,
46
47
setCollectiveIds,
47
48
} ) => {
48
49
if ( connectionType === ConnectionType . AlreadyConnected ) {
49
50
return (
50
51
< ConnectedUsersButtonCollection
51
52
darkMode = { darkMode }
52
- userId = { userId }
53
+ partnerUserId = { partnerUserId }
53
54
setCollectiveIds = { setCollectiveIds }
54
55
/>
55
56
) ;
56
57
} else if ( connectionType === ConnectionType . RequestReceived ) {
57
58
return (
58
59
< ReceivedInvitationButtonsCollection
59
60
darkMode = { darkMode }
60
- userId = { userId }
61
+ partnerUserId = { partnerUserId }
61
62
setCollectiveIds = { setCollectiveIds }
62
63
/>
63
64
) ;
64
65
} else if ( connectionType === ConnectionType . RequestSent ) {
65
66
return (
66
67
< SentRequestButtonCollection
67
68
darkMode = { darkMode }
68
- userId = { userId }
69
+ partnerUserId = { partnerUserId }
69
70
setCollectiveIds = { setCollectiveIds }
70
71
/>
71
72
) ;
@@ -111,18 +112,28 @@ const ConnectionTile = ({ user }) => {
111
112
112
113
const ConnectedUsersButtonCollection = ( {
113
114
darkMode,
114
- userId ,
115
+ partnerUserId ,
115
116
setCollectiveIds,
116
117
} ) => {
117
118
// ** NOTE: Message Button Will be redirect to the specific chat..
118
119
// ** We will do it after implement chat feature.
119
120
121
+ const onMessageButtonClick = ( ) => {
122
+ getChatBoxId ( partnerUserId )
123
+ . then ( ( data ) => {
124
+ console . log ( "Chat Box Id is: " , data ) ;
125
+ } )
126
+ . catch ( ( e ) => {
127
+ console . log ( "Error in get chat box id: " , e ) ;
128
+ } ) ;
129
+ } ;
130
+
120
131
return (
121
132
< div className = "md:flex items-center sm:ml-5 text-sm md:text-md 2xl:text-lg md:tracking-wider" >
122
133
< MessageButton
123
134
darkMode = { darkMode }
124
135
customClassName = { "connection-screens-common-button-layout mx-3 md:mx-0" }
125
- onClickOperation = { ( ) => { } }
136
+ onClickOperation = { onMessageButtonClick }
126
137
/>
127
138
128
139
< RemoveConnectionButton
@@ -131,9 +142,9 @@ const ConnectedUsersButtonCollection = ({
131
142
"connection-screens-common-button-layout mt-3 md:mt-0 mx-3 md:ml-5"
132
143
}
133
144
onClickOperation = { ( ) => {
134
- connectionSpecificOperations ( userId , "removeConnections" ) ;
145
+ connectionSpecificOperations ( partnerUserId , "removeConnections" ) ;
135
146
successMessage ( "😔 Connection Removed" , 2000 ) ;
136
- setCollectiveIds ( ( prev ) => [ ...prev , userId ] ) ;
147
+ setCollectiveIds ( ( prev ) => [ ...prev , partnerUserId ] ) ;
137
148
} }
138
149
/>
139
150
</ div >
@@ -142,7 +153,7 @@ const ConnectedUsersButtonCollection = ({
142
153
143
154
const ReceivedInvitationButtonsCollection = ( {
144
155
darkMode,
145
- userId ,
156
+ partnerUserId ,
146
157
setCollectiveIds,
147
158
} ) => {
148
159
return (
@@ -151,9 +162,12 @@ const ReceivedInvitationButtonsCollection = ({
151
162
darkMode = { darkMode }
152
163
customClassName = { "connection-screens-common-button-layout mx-3" }
153
164
onClickOperation = { ( ) => {
154
- connectionSpecificOperations ( userId , "acceptConnectionRequest" ) ;
165
+ connectionSpecificOperations (
166
+ partnerUserId ,
167
+ "acceptConnectionRequest"
168
+ ) ;
155
169
successMessage ( "🥳 Connection request accepted" , 2000 ) ;
156
- setCollectiveIds ( ( prev ) => [ ...prev , userId ] ) ;
170
+ setCollectiveIds ( ( prev ) => [ ...prev , partnerUserId ] ) ;
157
171
} }
158
172
/>
159
173
@@ -164,11 +178,11 @@ const ReceivedInvitationButtonsCollection = ({
164
178
}
165
179
onClickOperation = { ( ) => {
166
180
connectionSpecificOperations (
167
- userId ,
181
+ partnerUserId ,
168
182
"removeIncomingConnectionRequest"
169
183
) ;
170
184
successMessage ( "😏 Incoming Connection Request Removed" , 2000 ) ;
171
- setCollectiveIds ( ( prev ) => [ ...prev , userId ] ) ;
185
+ setCollectiveIds ( ( prev ) => [ ...prev , partnerUserId ] ) ;
172
186
} }
173
187
/>
174
188
</ div >
@@ -177,7 +191,7 @@ const ReceivedInvitationButtonsCollection = ({
177
191
178
192
const SentRequestButtonCollection = ( {
179
193
darkMode,
180
- userId ,
194
+ partnerUserId ,
181
195
setCollectiveIds,
182
196
} ) => {
183
197
return (
@@ -188,9 +202,9 @@ const SentRequestButtonCollection = ({
188
202
"ml-3 md:mr-5 connection-screens-common-button-layout text-sm md:text-md 2xl:text-lg md:tracking-wider"
189
203
}
190
204
onClickOperation = { ( ) => {
191
- connectionSpecificOperations ( userId , "withDrawSentRequest" ) ;
205
+ connectionSpecificOperations ( partnerUserId , "withDrawSentRequest" ) ;
192
206
successMessage ( "😏 Outgoing Connection Request Removed" , 2000 ) ;
193
- setCollectiveIds ( ( prev ) => [ ...prev , userId ] ) ;
207
+ setCollectiveIds ( ( prev ) => [ ...prev , partnerUserId ] ) ;
194
208
} }
195
209
/>
196
210
</ div >
0 commit comments