Jelajahi Sumber

"Send message" btn on Profile screen

Viktoriia 4 bulan lalu
induk
melakukan
1a1a29660d

+ 40 - 29
src/screens/InAppScreens/ProfileScreen/Components/PersonalInfo.tsx

@@ -20,6 +20,7 @@ import WHSIcon from 'assets/icons/travels-section/whs.svg';
 import ArrowIcon from 'assets/icons/next.svg';
 import UNPIcon from 'assets/icons/travels-section/unp.svg';
 import AuthIcon from 'assets/icons/authenticate-user.svg';
+import SendIcon from 'assets/icons/messages/send.svg';
 
 import { styles } from './styles';
 import { InfoItem } from './InfoItem';
@@ -58,6 +59,7 @@ type PersonalInfoProps = {
     lastSeenFlag: string | null;
     canBeAuthenticated: 0 | 1;
     setCanBeAuthenticated: (value: 0 | 1) => void;
+    goToChat: () => void;
   };
   updates: {
     un_visited: number;
@@ -248,7 +250,7 @@ export const PersonalInfo: FC<PersonalInfoProps> = ({
   const maxAvatars = Math.floor(availableWidth / (AVATAR_SIZE - AVATAR_MARGIN)) - 2;
 
   return (
-    <>
+    <View>
       <View style={styles.wrapper}>
         <View style={styles.scoreContainer}>
           {scores.map((score, index) => {
@@ -272,33 +274,42 @@ export const PersonalInfo: FC<PersonalInfoProps> = ({
           })}
         </View>
 
-        {isPublicView && token ? (
-          <View style={{ gap: 8, flexDirection: 'row', alignItems: 'flex-end' }}>
-            <FriendStatus
-              status={friendStatus}
-              data={data}
-              setModalInfo={setModalInfo}
-              handleSendFriendRequest={handleSendFriendRequest}
-              handleUpdateFriendStatus={handleUpdateFriendStatus}
-              authButton={data.canBeAuthenticated}
-            />
-            {data.canBeAuthenticated ? (
-              <TouchableOpacity
-                onPress={() =>
-                  setModalInfo({
-                    isVisible: true,
-                    type: 'authenticate',
-                    message: `Please confirm that you have personally met ${data.firstName} ${data.lastName}.`,
-                    action: handleAuthenticate,
-                    title: ''
-                  })
-                }
-                style={styles.authBtn}
-              >
-                <AuthIcon />
-                <Text style={styles.authText}>Authenticate</Text>
-              </TouchableOpacity>
-            ) : null}
+        {data.ownProfile === 0 && token ? (
+          <View style={{ gap: 8 }}>
+            <TouchableOpacity
+              style={[styles.authBtn, { backgroundColor: Colors.ORANGE }]}
+              onPress={data.goToChat}
+            >
+              <SendIcon fill={Colors.WHITE} height={15} />
+              <Text style={[styles.authText, { color: Colors.WHITE }]}>Send message</Text>
+            </TouchableOpacity>
+            <View style={{ gap: 8, flexDirection: 'row', alignItems: 'flex-end' }}>
+              <FriendStatus
+                status={friendStatus}
+                data={data}
+                setModalInfo={setModalInfo}
+                handleSendFriendRequest={handleSendFriendRequest}
+                handleUpdateFriendStatus={handleUpdateFriendStatus}
+                authButton={data.canBeAuthenticated}
+              />
+              {data.canBeAuthenticated ? (
+                <TouchableOpacity
+                  onPress={() =>
+                    setModalInfo({
+                      isVisible: true,
+                      type: 'authenticate',
+                      message: `Please confirm that you have personally met ${data.firstName} ${data.lastName}.`,
+                      action: handleAuthenticate,
+                      title: ''
+                    })
+                  }
+                  style={styles.authBtn}
+                >
+                  <AuthIcon />
+                  <Text style={styles.authText}>Authenticate</Text>
+                </TouchableOpacity>
+              ) : null}
+            </View>
           </View>
         ) : null}
 
@@ -569,6 +580,6 @@ export const PersonalInfo: FC<PersonalInfoProps> = ({
         onClose={() => setModalInfo({ ...modalInfo, isVisible: false })}
         title=""
       />
-    </>
+    </View>
   );
 };

+ 2 - 10
src/screens/InAppScreens/ProfileScreen/index.tsx

@@ -383,16 +383,7 @@ const ProfileScreen: FC<Props> = ({ navigation, route }) => {
                     />
                   </TouchableOpacity>
                 </>
-              ) : (
-                <TouchableOpacity style={styles.settings} onPress={handleGoToChat}>
-                  <CommentsIcon
-                    width={20}
-                    height={20}
-                    fill={Colors.DARK_BLUE}
-                    style={{ alignSelf: 'center' }}
-                  />
-                </TouchableOpacity>
-              )}
+              ) : null}
             </View>
 
             {hasActiveLinks() && (
@@ -446,6 +437,7 @@ const ProfileScreen: FC<Props> = ({ navigation, route }) => {
             isFriend,
             canBeAuthenticated,
             setCanBeAuthenticated,
+            goToChat: handleGoToChat,
             friendDbId: data.friend_db_id,
             ownProfile: data.own_profile,
             locationSharing: data.location_sharing,