|
@@ -10,6 +10,7 @@ import { Colors } from '../../../../theme';
|
|
import TickIcon from '../../../../../assets/icons/tick.svg';
|
|
import TickIcon from '../../../../../assets/icons/tick.svg';
|
|
import UNIcon from '../../../../../assets/icons/un_icon.svg';
|
|
import UNIcon from '../../../../../assets/icons/un_icon.svg';
|
|
import NMIcon from '../../../../../assets/icons/nm_icon.svg';
|
|
import NMIcon from '../../../../../assets/icons/nm_icon.svg';
|
|
|
|
+import TBTIcon from '../../../../../assets/icons/tbt.svg';
|
|
import { getOnlineStatus } from 'src/storage';
|
|
import { getOnlineStatus } from 'src/storage';
|
|
import * as FileSystem from 'expo-file-system';
|
|
import * as FileSystem from 'expo-file-system';
|
|
import { AvatarWithInitials } from 'src/components';
|
|
import { AvatarWithInitials } from 'src/components';
|
|
@@ -23,7 +24,12 @@ type Props = {
|
|
homebase2_flag: string;
|
|
homebase2_flag: string;
|
|
index: number;
|
|
index: number;
|
|
score: any[];
|
|
score: any[];
|
|
- tbt_score: number;
|
|
|
|
|
|
+ tbt_score?: number;
|
|
|
|
+ tbt_rank?: number;
|
|
|
|
+ badge_tbt?: number;
|
|
|
|
+ badge_1281: number;
|
|
|
|
+ badge_un: number;
|
|
|
|
+ auth: number;
|
|
};
|
|
};
|
|
|
|
|
|
//TODO: Profile
|
|
//TODO: Profile
|
|
@@ -36,12 +42,51 @@ export const Profile: FC<Props> = ({
|
|
homebase2_flag,
|
|
homebase2_flag,
|
|
index,
|
|
index,
|
|
score,
|
|
score,
|
|
- tbt_score
|
|
|
|
|
|
+ tbt_score,
|
|
|
|
+ tbt_rank,
|
|
|
|
+ badge_tbt,
|
|
|
|
+ badge_1281,
|
|
|
|
+ badge_un,
|
|
|
|
+ auth
|
|
}) => {
|
|
}) => {
|
|
const scoreNames = ['NM1301', 'DARE', 'UN', 'UN+', 'TCC', 'YES', 'SLOW', 'WHS', 'KYE'];
|
|
const scoreNames = ['NM1301', 'DARE', 'UN', 'UN+', 'TCC', 'YES', 'SLOW', 'WHS', 'KYE'];
|
|
const isOnline = getOnlineStatus();
|
|
const isOnline = getOnlineStatus();
|
|
- const avatarBaseUri = isOnline ? `${API_HOST}/img/avatars/` : `${FileSystem.documentDirectory}avatars/`;
|
|
|
|
- const flagBaseUri = isOnline ? `${API_HOST}/img/flags_new/` : `${FileSystem.documentDirectory}flags/`;
|
|
|
|
|
|
+ const avatarBaseUri = isOnline
|
|
|
|
+ ? `${API_HOST}/img/avatars/`
|
|
|
|
+ : `${FileSystem.documentDirectory}avatars/`;
|
|
|
|
+ const flagBaseUri = isOnline
|
|
|
|
+ ? `${API_HOST}/img/flags_new/`
|
|
|
|
+ : `${FileSystem.documentDirectory}flags/`;
|
|
|
|
+
|
|
|
|
+ const TBRanking = () => {
|
|
|
|
+ const colors = [
|
|
|
|
+ 'rgba(237, 147, 52, 1)',
|
|
|
|
+ 'rgba(128, 128, 128, 1)',
|
|
|
|
+ 'rgba(211, 211, 211, 1)',
|
|
|
|
+ 'rgba(187, 95, 5, 1)',
|
|
|
|
+ '#808080'
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ const Rank = ({ color }: { color: string }) => (
|
|
|
|
+ <View style={[styles.badge, { backgroundColor: color }]}>
|
|
|
|
+ {badge_tbt ? <TBTIcon /> : <Text style={{ fontSize: getFontSize(12) }}>{tbt_score}</Text>}
|
|
|
|
+ </View>
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ return tbt_rank && tbt_rank >= 1 ? (
|
|
|
|
+ <View
|
|
|
|
+ style={{
|
|
|
|
+ display: 'flex',
|
|
|
|
+ marginTop: 10
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <View style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
|
+ <Rank color={colors[tbt_rank - 1]} />
|
|
|
|
+ <Text style={[styles.titleText, { flex: 0 }]}>TBT # {tbt_rank}</Text>
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+ ) : null;
|
|
|
|
+ };
|
|
|
|
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
@@ -53,7 +98,7 @@ export const Profile: FC<Props> = ({
|
|
{avatar ? (
|
|
{avatar ? (
|
|
<Image
|
|
<Image
|
|
style={{ borderRadius: 24, width: 48, height: 48 }}
|
|
style={{ borderRadius: 24, width: 48, height: 48 }}
|
|
- source={{uri: avatarBaseUri + avatar}}
|
|
|
|
|
|
+ source={{ uri: avatarBaseUri + avatar }}
|
|
/>
|
|
/>
|
|
) : (
|
|
) : (
|
|
<AvatarWithInitials
|
|
<AvatarWithInitials
|
|
@@ -81,20 +126,17 @@ export const Profile: FC<Props> = ({
|
|
>
|
|
>
|
|
Age: {date_of_birth}
|
|
Age: {date_of_birth}
|
|
</Text>
|
|
</Text>
|
|
- <Image
|
|
|
|
- source={{ uri: flagBaseUri + homebase_flag }}
|
|
|
|
- style={styles.countryFlag}
|
|
|
|
- />
|
|
|
|
- {homebase2_flag ? (
|
|
|
|
|
|
+ <Image source={{ uri: flagBaseUri + homebase_flag }} style={styles.countryFlag} />
|
|
|
|
+ {homebase2_flag && homebase2_flag !== homebase_flag ? (
|
|
<Image
|
|
<Image
|
|
source={{ uri: flagBaseUri + homebase2_flag }}
|
|
source={{ uri: flagBaseUri + homebase2_flag }}
|
|
style={[styles.countryFlag, { marginLeft: -15 }]}
|
|
style={[styles.countryFlag, { marginLeft: -15 }]}
|
|
/>
|
|
/>
|
|
) : null}
|
|
) : null}
|
|
<View style={{ display: 'flex', flexDirection: 'row', gap: 10 }}>
|
|
<View style={{ display: 'flex', flexDirection: 'row', gap: 10 }}>
|
|
- <TickIcon />
|
|
|
|
- <UNIcon />
|
|
|
|
- <NMIcon />
|
|
|
|
|
|
+ {auth ? <TickIcon /> : null}
|
|
|
|
+ {badge_un ? <UNIcon /> : null}
|
|
|
|
+ {badge_1281 ? <NMIcon /> : null}
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
@@ -109,21 +151,12 @@ export const Profile: FC<Props> = ({
|
|
marginBottom: 15
|
|
marginBottom: 15
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- {/*TBT Score*/}
|
|
|
|
- {/*<View*/}
|
|
|
|
- {/* style={{*/}
|
|
|
|
- {/* display: 'flex',*/}
|
|
|
|
- {/* marginTop: 10*/}
|
|
|
|
- {/* }}*/}
|
|
|
|
- {/*>*/}
|
|
|
|
- {/* <View style={{ display: 'flex', alignItems: 'center' }}>*/}
|
|
|
|
- {/* <Text style={[styles.headerText, { flex: 0 }]}>Icon</Text>*/}
|
|
|
|
- {/* <Text style={[styles.titleText, { flex: 0 }]}>TBT #{tbt_score}</Text>*/}
|
|
|
|
- {/* </View>*/}
|
|
|
|
- {/*</View>*/}
|
|
|
|
|
|
+ <TBRanking />
|
|
|
|
|
|
{score.map((number, index) => {
|
|
{score.map((number, index) => {
|
|
if (!number) return;
|
|
if (!number) return;
|
|
|
|
+ if (scoreNames[index] === 'YES' && number >= 10000) return;
|
|
|
|
+ if (scoreNames[index] === 'SLOW' && number >= 4500) return;
|
|
return (
|
|
return (
|
|
<View
|
|
<View
|
|
style={{
|
|
style={{
|