|
@@ -1,4 +1,4 @@
|
|
-import React, { FC, ReactNode, useEffect, useState } from 'react';
|
|
|
|
|
|
+import React, { FC, ReactNode, useState } from 'react';
|
|
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
import { Image } from 'expo-image';
|
|
import { Image } from 'expo-image';
|
|
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
|
|
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
|
|
@@ -12,7 +12,7 @@ import {
|
|
usePostGetProfileInfoQuery
|
|
usePostGetProfileInfoQuery
|
|
} from '@api/user';
|
|
} from '@api/user';
|
|
|
|
|
|
-import { BigText, Button, PageWrapper, Loading } from '../../../components';
|
|
|
|
|
|
+import { BigText, Button, PageWrapper, Loading, AvatarWithInitials } from '../../../components';
|
|
import { Colors } from '../../../theme';
|
|
import { Colors } from '../../../theme';
|
|
import { styles } from './styles';
|
|
import { styles } from './styles';
|
|
import { ButtonVariants } from '../../../types/components';
|
|
import { ButtonVariants } from '../../../types/components';
|
|
@@ -58,10 +58,18 @@ const ProfileScreen: FC<Props> = ({ navigation, route }) => {
|
|
<PageWrapper>
|
|
<PageWrapper>
|
|
<View style={styles.pageWrapper}>
|
|
<View style={styles.pageWrapper}>
|
|
<View>
|
|
<View>
|
|
- <Image
|
|
|
|
- style={{ borderRadius: 64 / 2, width: 64, height: 64 }}
|
|
|
|
- source={{ uri: API_HOST + data.avatar }}
|
|
|
|
- />
|
|
|
|
|
|
+ {data.avatar ? (
|
|
|
|
+ <Image
|
|
|
|
+ style={{ borderRadius: 64 / 2, width: 64, height: 64 }}
|
|
|
|
+ source={{ uri: API_HOST + data.avatar }}
|
|
|
|
+ />
|
|
|
|
+ ) : (
|
|
|
|
+ <AvatarWithInitials
|
|
|
|
+ text={`${data.first_name[0] ?? ''}${data.last_name[0] ?? ''}`}
|
|
|
|
+ flag={API_HOST + data.homebase_flag}
|
|
|
|
+ size={64}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
</View>
|
|
</View>
|
|
<View style={{ gap: 5, width: '75%' }}>
|
|
<View style={{ gap: 5, width: '75%' }}>
|
|
<Text style={[styles.headerText, { fontSize: getFontSize(18), flex: 0 }]}>
|
|
<Text style={[styles.headerText, { fontSize: getFontSize(18), flex: 0 }]}>
|
|
@@ -82,7 +90,7 @@ const ProfileScreen: FC<Props> = ({ navigation, route }) => {
|
|
Age: {getYears(data.date_of_birth)}
|
|
Age: {getYears(data.date_of_birth)}
|
|
</Text>
|
|
</Text>
|
|
<Image source={{ uri: API_HOST + data.homebase_flag }} style={styles.countryFlag} />
|
|
<Image source={{ uri: API_HOST + data.homebase_flag }} style={styles.countryFlag} />
|
|
- {data.homebase2_flag ? (
|
|
|
|
|
|
+ {data.homebase2_flag && data.homebase2_flag !== data.homebase_flag ? (
|
|
<Image
|
|
<Image
|
|
source={{ uri: API_HOST + data.homebase2_flag }}
|
|
source={{ uri: API_HOST + data.homebase2_flag }}
|
|
style={[styles.countryFlag, { marginLeft: -15 }]}
|
|
style={[styles.countryFlag, { marginLeft: -15 }]}
|
|
@@ -108,9 +116,8 @@ const ProfileScreen: FC<Props> = ({ navigation, route }) => {
|
|
)
|
|
)
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- <Tab.Screen
|
|
|
|
- name="Personal Info"
|
|
|
|
- component={() => (
|
|
|
|
|
|
+ <Tab.Screen name="Personal Info">
|
|
|
|
+ {() => (
|
|
<PersonalInfo
|
|
<PersonalInfo
|
|
data={{
|
|
data={{
|
|
bio: data.bio,
|
|
bio: data.bio,
|
|
@@ -123,7 +130,9 @@ const ProfileScreen: FC<Props> = ({ navigation, route }) => {
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
)}
|
|
)}
|
|
- />
|
|
|
|
|
|
+ </Tab.Screen>
|
|
|
|
+ <Tab.Screen name="Ranking">{() => <View></View>}</Tab.Screen>
|
|
|
|
+ <Tab.Screen name="Photos">{() => <View></View>}</Tab.Screen>
|
|
</Tab.Navigator>
|
|
</Tab.Navigator>
|
|
</PageWrapper>
|
|
</PageWrapper>
|
|
);
|
|
);
|
|
@@ -158,10 +167,11 @@ const PersonalInfo: FC<PersonalInfoProps> = ({ data }) => {
|
|
style={{ marginTop: 20 }}
|
|
style={{ marginTop: 20 }}
|
|
>
|
|
>
|
|
<InfoItem inline={true} title={'RANKING'}>
|
|
<InfoItem inline={true} title={'RANKING'}>
|
|
- {data.scores?.map((data) => {
|
|
|
|
|
|
+ {data.scores?.map((data, index) => {
|
|
if (!data.score) return null;
|
|
if (!data.score) return null;
|
|
return (
|
|
return (
|
|
<View
|
|
<View
|
|
|
|
+ key={index}
|
|
style={{ display: 'flex', flexDirection: 'column', gap: 5, alignItems: 'center' }}
|
|
style={{ display: 'flex', flexDirection: 'column', gap: 5, alignItems: 'center' }}
|
|
>
|
|
>
|
|
<Text style={[styles.headerText, { flex: 0 }]}>{data.score}</Text>
|
|
<Text style={[styles.headerText, { flex: 0 }]}>{data.score}</Text>
|
|
@@ -171,8 +181,11 @@ const PersonalInfo: FC<PersonalInfoProps> = ({ data }) => {
|
|
})}
|
|
})}
|
|
</InfoItem>
|
|
</InfoItem>
|
|
<InfoItem showMore={showMoreSeries} inline={true} title={'SERIES BADGES'}>
|
|
<InfoItem showMore={showMoreSeries} inline={true} title={'SERIES BADGES'}>
|
|
- {data.series?.slice(0, showMoreSeries ? data.series.length : 8).map((data) => (
|
|
|
|
- <View style={{ display: 'flex', flexDirection: 'column', gap: 5, alignItems: 'center' }}>
|
|
|
|
|
|
+ {data.series?.slice(0, showMoreSeries ? data.series.length : 8).map((data, index) => (
|
|
|
|
+ <View
|
|
|
|
+ key={index}
|
|
|
|
+ style={{ display: 'flex', flexDirection: 'column', gap: 5, alignItems: 'center' }}
|
|
|
|
+ >
|
|
<Image source={{ uri: API_HOST + data.icon_png }} style={{ width: 28, height: 28 }} />
|
|
<Image source={{ uri: API_HOST + data.icon_png }} style={{ width: 28, height: 28 }} />
|
|
<Text style={[styles.headerText, { flex: 0 }]}>{data.score}</Text>
|
|
<Text style={[styles.headerText, { flex: 0 }]}>{data.score}</Text>
|
|
</View>
|
|
</View>
|
|
@@ -204,12 +217,12 @@ const PersonalInfo: FC<PersonalInfoProps> = ({ data }) => {
|
|
</InfoItem>
|
|
</InfoItem>
|
|
<InfoItem title={'SOCIAL LINKS'}>
|
|
<InfoItem title={'SOCIAL LINKS'}>
|
|
<View style={{ display: 'flex', flexDirection: 'row', gap: 15, alignItems: 'center' }}>
|
|
<View style={{ display: 'flex', flexDirection: 'row', gap: 15, alignItems: 'center' }}>
|
|
- {data.links.f?.link ? <IconFacebook fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
- {data.links.i?.link ? <IconInstagram fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
- {data.links.t?.link ? <IconTwitter fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
- {data.links.y?.link ? <IconYouTube fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
- {data.links.www?.link ? <IconGlobe fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
- {data.links.other?.link ? <IconLink fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
|
|
+ {data.links?.f?.link ? <IconFacebook fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
+ {data.links?.i?.link ? <IconInstagram fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
+ {data.links?.t?.link ? <IconTwitter fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
+ {data.links?.y?.link ? <IconYouTube fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
+ {data.links?.www?.link ? <IconGlobe fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
+ {data.links?.other?.link ? <IconLink fill={Colors.DARK_BLUE} /> : null}
|
|
</View>
|
|
</View>
|
|
</InfoItem>
|
|
</InfoItem>
|
|
</ScrollView>
|
|
</ScrollView>
|