|
@@ -4,14 +4,14 @@ import { Image } from 'expo-image';
|
|
|
import { useNavigation } from '@react-navigation/native';
|
|
|
import * as FileSystem from 'expo-file-system';
|
|
|
|
|
|
-import { styles } from './styles';
|
|
|
+import { ProfileStyles, ScoreStyles, TBTStyles } from './styles';
|
|
|
|
|
|
import { getOnlineStatus } from 'src/storage';
|
|
|
import { AvatarWithInitials } from 'src/components';
|
|
|
|
|
|
import { API_HOST } from '../../../../constants';
|
|
|
import { getFontSize } from '../../../../utils';
|
|
|
-import { Colors } from '../../../../theme';
|
|
|
+import { adaptiveStyle } from '../../../../theme';
|
|
|
|
|
|
import TickIcon from '../../../../../assets/icons/tick.svg';
|
|
|
import UNIcon from '../../../../../assets/icons/un_icon.svg';
|
|
@@ -50,7 +50,6 @@ export const Profile: FC<Props> = ({
|
|
|
index,
|
|
|
score,
|
|
|
active_score,
|
|
|
- tbt_score,
|
|
|
tbt_rank,
|
|
|
badge_tbt,
|
|
|
badge_1281,
|
|
@@ -60,7 +59,7 @@ export const Profile: FC<Props> = ({
|
|
|
}) => {
|
|
|
const navigation = useNavigation();
|
|
|
|
|
|
- const scoreNames = ['NM', 'DARE', 'UN', 'UN+', 'TCC', 'DEEP', 'YES', 'SLOW', 'WHS', 'KYE', 'TBT'];
|
|
|
+ const scoreNames = ['NM', 'DARE', 'UN', 'UN+', 'TCC', 'DEEP', 'YES', 'SLOW', 'WHS', 'KYE'];
|
|
|
const isOnline = getOnlineStatus();
|
|
|
|
|
|
const avatarBaseUri = isOnline
|
|
@@ -81,21 +80,16 @@ export const Profile: FC<Props> = ({
|
|
|
];
|
|
|
|
|
|
const Rank = ({ color }: { color: string }) => (
|
|
|
- <View style={[styles.badge, { backgroundColor: color }]}>
|
|
|
+ <View style={adaptiveStyle([ProfileStyles.badge, { backgroundColor: color }], {})}>
|
|
|
<TBTIcon />
|
|
|
</View>
|
|
|
);
|
|
|
|
|
|
return tbt_rank && tbt_rank >= 1 ? (
|
|
|
- <View
|
|
|
- style={{
|
|
|
- display: 'flex',
|
|
|
- marginTop: 10
|
|
|
- }}
|
|
|
- >
|
|
|
- <View style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
+ <View style={adaptiveStyle(TBTStyles.badgeRoot, {})}>
|
|
|
+ <View style={adaptiveStyle(TBTStyles.badgeWrapper, {})}>
|
|
|
{badge_tbt ? <Rank color={colors[tbt_rank - 1]} /> : null}
|
|
|
- <Text style={[styles.titleText, { flex: 0 }]}>TBT # {tbt_rank}</Text>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>TBT # {tbt_rank}</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
) : null;
|
|
@@ -103,9 +97,9 @@ export const Profile: FC<Props> = ({
|
|
|
|
|
|
const EmptyScore: FC<{ scoreName: string }> = ({ scoreName }) => {
|
|
|
return (
|
|
|
- <View style={styles.scoreWrapper}>
|
|
|
- <Text style={[styles.scoreHeaderText, { flex: 0 }]}>-</Text>
|
|
|
- <Text style={[styles.scoreNameText, { flex: 0 }]}>{scoreName}</Text>
|
|
|
+ <View style={adaptiveStyle(ScoreStyles.scoreWrapper, {})}>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreHeaderText], {})}>-</Text>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>{scoreName}</Text>
|
|
|
</View>
|
|
|
);
|
|
|
};
|
|
@@ -117,52 +111,53 @@ export const Profile: FC<Props> = ({
|
|
|
navigation.navigate(...([NAVIGATION_PAGES.PUBLIC_PROFILE_VIEW, { userId }] as never))
|
|
|
}
|
|
|
>
|
|
|
- <View style={{ alignItems: 'center', flexDirection: 'row', gap: 10, marginBottom: 5 }}>
|
|
|
+ <View style={adaptiveStyle(ProfileStyles.profileRoot, {})}>
|
|
|
<View style={{ paddingLeft: 20 }}>
|
|
|
- <View style={{ marginRight: 5 }}>
|
|
|
- <Text style={styles.rankText}>{index + 1}</Text>
|
|
|
+ {index + 1 < 100 ? (
|
|
|
+ <View>
|
|
|
+ <Text style={adaptiveStyle(ScoreStyles.rankText, {})}>{index + 1}</Text>
|
|
|
+ </View>
|
|
|
+ ) : null}
|
|
|
+ <View style={{ marginLeft: 5 }}>
|
|
|
+ {avatar ? (
|
|
|
+ <Image
|
|
|
+ style={adaptiveStyle(ProfileStyles.profileAvatar, {})}
|
|
|
+ source={{ uri: avatarBaseUri + avatar }}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <AvatarWithInitials
|
|
|
+ text={`${first_name[0] ?? ''}${last_name[0] ?? ''}`}
|
|
|
+ flag={flagBaseUri + homebase_flag}
|
|
|
+ size={48}
|
|
|
+ />
|
|
|
+ )}
|
|
|
</View>
|
|
|
- {avatar ? (
|
|
|
- <Image
|
|
|
- style={{ borderRadius: 24, width: 48, height: 48 }}
|
|
|
- source={{ uri: avatarBaseUri + avatar }}
|
|
|
- />
|
|
|
- ) : (
|
|
|
- <AvatarWithInitials
|
|
|
- text={`${first_name[0] ?? ''}${last_name[0] ?? ''}`}
|
|
|
- flag={flagBaseUri + homebase_flag}
|
|
|
- size={48}
|
|
|
- />
|
|
|
- )}
|
|
|
</View>
|
|
|
- <View style={{ gap: 5, width: '75%' }}>
|
|
|
- <Text style={[styles.headerText, { fontSize: getFontSize(14), flex: 0 }]}>
|
|
|
+ <View style={adaptiveStyle(ProfileStyles.profileDataRoot, {})}>
|
|
|
+ <Text
|
|
|
+ style={adaptiveStyle(
|
|
|
+ [ProfileStyles.profileFirstLastName, { fontSize: getFontSize(14), flex: 0 }],
|
|
|
+ {}
|
|
|
+ )}
|
|
|
+ >
|
|
|
{first_name ?? ''} {last_name ?? ''}
|
|
|
</Text>
|
|
|
- <View
|
|
|
- style={{ display: 'flex', justifyContent: 'space-between', flexDirection: 'row' }}
|
|
|
- >
|
|
|
- <View
|
|
|
- style={{
|
|
|
- display: 'flex',
|
|
|
- flexDirection: 'row',
|
|
|
- gap: 10,
|
|
|
- alignItems: 'center'
|
|
|
- }}
|
|
|
- >
|
|
|
- <Text
|
|
|
- style={{ color: Colors.DARK_BLUE, fontWeight: '600', fontSize: getFontSize(12) }}
|
|
|
- >
|
|
|
+ <View style={adaptiveStyle(ProfileStyles.profileDataContainer, {})}>
|
|
|
+ <View style={adaptiveStyle(ProfileStyles.profileDataWrapper, {})}>
|
|
|
+ <Text style={adaptiveStyle(ProfileStyles.profileAge, {})}>
|
|
|
Age: {date_of_birth ?? ''}
|
|
|
</Text>
|
|
|
- <Image source={{ uri: flagBaseUri + homebase_flag }} style={styles.countryFlag} />
|
|
|
+ <Image
|
|
|
+ source={{ uri: flagBaseUri + homebase_flag }}
|
|
|
+ style={adaptiveStyle(ProfileStyles.countryFlag, {})}
|
|
|
+ />
|
|
|
{homebase2_flag && homebase2_flag !== homebase_flag ? (
|
|
|
<Image
|
|
|
source={{ uri: flagBaseUri + homebase2_flag }}
|
|
|
- style={[styles.countryFlag, { marginLeft: -15 }]}
|
|
|
+ style={adaptiveStyle([ProfileStyles.countryFlag, { marginLeft: -15 }], {})}
|
|
|
/>
|
|
|
) : null}
|
|
|
- <View style={{ display: 'flex', flexDirection: 'row', gap: 3, marginLeft: 10 }}>
|
|
|
+ <View style={adaptiveStyle(ProfileStyles.badgesWrapper, {})}>
|
|
|
{auth ? <TickIcon /> : null}
|
|
|
{badge_un ? <UNIcon /> : null}
|
|
|
{badge_1281 ? <NMIcon /> : null}
|
|
@@ -172,36 +167,34 @@ export const Profile: FC<Props> = ({
|
|
|
</View>
|
|
|
</View>
|
|
|
</TouchableOpacity>
|
|
|
- <View style={styles.rankingWrapper}>
|
|
|
- <View style={styles.nmWrapper}>
|
|
|
- <Text style={{ fontSize: 20, color: Colors.DARK_BLUE, fontWeight: '700' }}>
|
|
|
+ <View style={adaptiveStyle(ScoreStyles.rankingWrapper, {})}>
|
|
|
+ <View style={adaptiveStyle(ScoreStyles.nmWrapper, {})}>
|
|
|
+ <Text style={adaptiveStyle(ScoreStyles.activeScoreRanking, {})}>
|
|
|
{score[active_score]}
|
|
|
</Text>
|
|
|
- <Text style={{ fontSize: 14, color: Colors.DARK_BLUE, fontWeight: '500' }}>
|
|
|
+ <Text style={adaptiveStyle(ScoreStyles.activeScoreName, {})}>
|
|
|
{scoreNames[active_score]}
|
|
|
</Text>
|
|
|
+ <TBRanking />
|
|
|
</View>
|
|
|
|
|
|
- <View style={styles.rankingScoresWrapper}>
|
|
|
+ <View style={adaptiveStyle(ScoreStyles.rankingScoresWrapper, {})}>
|
|
|
{score.map((number, index) => {
|
|
|
if (scoreNames[index] === 'SLOW' && number >= 4500)
|
|
|
return <EmptyScore scoreName={scoreNames[index]} />;
|
|
|
if (scoreNames[index] === 'YES' && number >= 10000)
|
|
|
return <EmptyScore scoreName={scoreNames[index]} />;
|
|
|
if (!number) return <EmptyScore scoreName={scoreNames[index]} />;
|
|
|
- if (index === active_score) return;
|
|
|
return (
|
|
|
- <View style={styles.scoreWrapper}>
|
|
|
- <Text style={[styles.scoreHeaderText, { flex: 0 }]}>{number}</Text>
|
|
|
- <Text style={[styles.scoreNameText, { flex: 0 }]}>{scoreNames[index]}</Text>
|
|
|
+ <View style={adaptiveStyle(ScoreStyles.scoreWrapper, {})}>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreHeaderText], {})}>{number}</Text>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>
|
|
|
+ {scoreNames[index]}
|
|
|
+ </Text>
|
|
|
</View>
|
|
|
);
|
|
|
})}
|
|
|
</View>
|
|
|
-
|
|
|
- <View style={{ marginRight: 15, marginLeft: 15 }}>
|
|
|
- <TBRanking />
|
|
|
- </View>
|
|
|
</View>
|
|
|
</View>
|
|
|
);
|