|
@@ -20,6 +20,7 @@ import TBTIcon from '../../../../../assets/icons/tbt.svg';
|
|
|
|
|
|
import { NAVIGATION_PAGES } from '../../../../types';
|
|
|
import { useConnection } from 'src/contexts/ConnectionContext';
|
|
|
+import Tooltip from 'react-native-walkthrough-tooltip';
|
|
|
|
|
|
type Props = {
|
|
|
avatar: string;
|
|
@@ -64,6 +65,7 @@ export const Profile: FC<Props> = ({
|
|
|
const netInfo = useConnection();
|
|
|
const token = storage.get('token', StoreType.STRING);
|
|
|
const [modalType, setModalType] = useState<string | null>(null);
|
|
|
+ const [toolTipVisible, setToolTipVisible] = useState<number | string | null>(null);
|
|
|
|
|
|
const handlePress = () => {
|
|
|
if (!netInfo?.isInternetReachable) {
|
|
@@ -99,32 +101,101 @@ export const Profile: FC<Props> = ({
|
|
|
);
|
|
|
|
|
|
return (
|
|
|
- <View style={adaptiveStyle(TBTStyles.badgeRoot, {})}>
|
|
|
- <View style={adaptiveStyle(TBTStyles.badgeWrapper, {})}>
|
|
|
- {badge_tbt && tbt_rank ? (
|
|
|
- <Rank color={colors[tbt_rank - 1]} />
|
|
|
- ) : (
|
|
|
- <View style={adaptiveStyle(ProfileStyles.badge, {})} />
|
|
|
- )}
|
|
|
- {tbt_rank && tbt_rank >= 1 ? (
|
|
|
- <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>TBT # {tbt_rank}</Text>
|
|
|
- ) : (
|
|
|
- <View style={{ height: 11 }} />
|
|
|
- )}
|
|
|
- </View>
|
|
|
- </View>
|
|
|
+ <Tooltip
|
|
|
+ isVisible={toolTipVisible === 'TBT'}
|
|
|
+ content={<Text style={{ color: Colors.DARK_BLUE }}>{handleGetTooltip('TBT')}</Text>}
|
|
|
+ contentStyle={{ backgroundColor: Colors.WHITE }}
|
|
|
+ placement="top"
|
|
|
+ onClose={() => setToolTipVisible(null)}
|
|
|
+ backgroundColor="transparent"
|
|
|
+ allowChildInteraction={false}
|
|
|
+ parentWrapperStyle={adaptiveStyle(TBTStyles.badgeRoot, {})}
|
|
|
+ >
|
|
|
+ <TouchableOpacity
|
|
|
+ style={{ flex: 1 }}
|
|
|
+ disabled={!tbt_rank || tbt_rank < 1}
|
|
|
+ onPress={() => setToolTipVisible('TBT')}
|
|
|
+ >
|
|
|
+ <View style={adaptiveStyle(TBTStyles.badgeWrapper, {})}>
|
|
|
+ {badge_tbt && tbt_rank ? (
|
|
|
+ <Rank color={colors[tbt_rank - 1]} />
|
|
|
+ ) : (
|
|
|
+ <View style={adaptiveStyle(ProfileStyles.badge, {})} />
|
|
|
+ )}
|
|
|
+ {tbt_rank && tbt_rank >= 1 ? (
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>TBT # {tbt_rank}</Text>
|
|
|
+ ) : (
|
|
|
+ <View style={{ height: 11 }} />
|
|
|
+ )}
|
|
|
+ </View>
|
|
|
+ </TouchableOpacity>
|
|
|
+ </Tooltip>
|
|
|
);
|
|
|
};
|
|
|
|
|
|
- const EmptyScore: FC<{ scoreName: string }> = ({ scoreName }) => {
|
|
|
+ const EmptyScore: FC<{ scoreName: string; index: number }> = ({ scoreName, index }) => {
|
|
|
return (
|
|
|
- <View style={adaptiveStyle(ScoreStyles.scoreWrapper, {})}>
|
|
|
- <Text style={adaptiveStyle([ScoreStyles.scoreHeaderText], {})}>-</Text>
|
|
|
- <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>{scoreName}</Text>
|
|
|
- </View>
|
|
|
+ <Tooltip
|
|
|
+ isVisible={toolTipVisible === index}
|
|
|
+ content={<Text style={{ color: Colors.DARK_BLUE }}>{handleGetTooltip(scoreName)}</Text>}
|
|
|
+ contentStyle={{ backgroundColor: Colors.WHITE }}
|
|
|
+ placement="top"
|
|
|
+ onClose={() => setToolTipVisible(null)}
|
|
|
+ backgroundColor="transparent"
|
|
|
+ allowChildInteraction={false}
|
|
|
+ parentWrapperStyle={adaptiveStyle(ScoreStyles.scoreWrapper, {})}
|
|
|
+ >
|
|
|
+ <TouchableOpacity onPress={() => setToolTipVisible(index)}>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreHeaderText], {})}>-</Text>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>{scoreName}</Text>
|
|
|
+ </TouchableOpacity>
|
|
|
+ </Tooltip>
|
|
|
);
|
|
|
};
|
|
|
|
|
|
+ const handleGetTooltip = (score: string) => {
|
|
|
+ switch (score) {
|
|
|
+ case 'NM':
|
|
|
+ return 'NM list of regions';
|
|
|
+ case 'DARE':
|
|
|
+ return 'DARE list of places';
|
|
|
+ case 'UN':
|
|
|
+ return 'UN countries';
|
|
|
+ case 'UN+':
|
|
|
+ return 'UN countries and territories';
|
|
|
+ case 'TCC':
|
|
|
+ return (
|
|
|
+ <Text>
|
|
|
+ <Text style={{ fontStyle: 'italic' }}>Travelers’ Century Club</Text> list
|
|
|
+ </Text>
|
|
|
+ );
|
|
|
+ case 'DEEP':
|
|
|
+ return (
|
|
|
+ <Text>
|
|
|
+ <Text style={{ fontWeight: '700' }}>D</Text>efinite{' '}
|
|
|
+ <Text style={{ fontWeight: '700' }}>E</Text>xhaustive{'\n'}
|
|
|
+ <Text style={{ fontWeight: '700' }}>E</Text>xploring{' '}
|
|
|
+ <Text style={{ fontWeight: '700' }}>P</Text>
|
|
|
+ roportion{'\n'}NM regions to UN countries ratio{'\n'}
|
|
|
+ <Text style={{ fontSize: 11 }}>
|
|
|
+ For travellers with minimum 30 UN countries visited.
|
|
|
+ </Text>
|
|
|
+ </Text>
|
|
|
+ );
|
|
|
+ case 'YES':
|
|
|
+ return 'Years Elapsed Since list';
|
|
|
+ case 'SLOW':
|
|
|
+ return 'SLOW travel list';
|
|
|
+ case 'WHS':
|
|
|
+ return 'World Heritage Sites';
|
|
|
+ case 'KYE':
|
|
|
+ return 'Know Your Earth geographic based list';
|
|
|
+ case 'TBT':
|
|
|
+ return 'The Biggest Travellers based on all rankings';
|
|
|
+ }
|
|
|
+ return score;
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<View style={ProfileStyles.wrapper}>
|
|
|
<View
|
|
@@ -206,17 +277,34 @@ export const Profile: FC<Props> = ({
|
|
|
<View style={adaptiveStyle(ScoreStyles.rankingScoresWrapper, {})}>
|
|
|
{score.map((number, index) => {
|
|
|
if (scoreNames[index] === 'SLOW' && number >= 4500)
|
|
|
- return <EmptyScore key={index} scoreName={scoreNames[index]} />;
|
|
|
+ return <EmptyScore key={index} scoreName={scoreNames[index]} index={index} />;
|
|
|
if (scoreNames[index] === 'YES' && number >= 10000)
|
|
|
- return <EmptyScore key={index} scoreName={scoreNames[index]} />;
|
|
|
- if (!number) return <EmptyScore key={index} scoreName={scoreNames[index]} />;
|
|
|
+ return <EmptyScore key={index} scoreName={scoreNames[index]} index={index} />;
|
|
|
+ if (!number)
|
|
|
+ return <EmptyScore key={index} scoreName={scoreNames[index]} index={index} />;
|
|
|
return (
|
|
|
- <View key={index} style={adaptiveStyle(ScoreStyles.scoreWrapper, {})}>
|
|
|
- <Text style={adaptiveStyle([ScoreStyles.scoreHeaderText], {})}>{number}</Text>
|
|
|
- <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>
|
|
|
- {scoreNames[index]}
|
|
|
- </Text>
|
|
|
- </View>
|
|
|
+ <Tooltip
|
|
|
+ isVisible={toolTipVisible === index}
|
|
|
+ content={
|
|
|
+ <Text style={{ color: Colors.DARK_BLUE }}>
|
|
|
+ {handleGetTooltip(scoreNames[index])}
|
|
|
+ </Text>
|
|
|
+ }
|
|
|
+ contentStyle={{ backgroundColor: Colors.WHITE }}
|
|
|
+ placement="top"
|
|
|
+ onClose={() => setToolTipVisible(null)}
|
|
|
+ backgroundColor="transparent"
|
|
|
+ allowChildInteraction={false}
|
|
|
+ key={index}
|
|
|
+ parentWrapperStyle={adaptiveStyle(ScoreStyles.scoreWrapper, {})}
|
|
|
+ >
|
|
|
+ <TouchableOpacity onPress={() => setToolTipVisible(index)}>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreHeaderText], {})}>{number}</Text>
|
|
|
+ <Text style={adaptiveStyle([ScoreStyles.scoreNameText], {})}>
|
|
|
+ {scoreNames[index]}
|
|
|
+ </Text>
|
|
|
+ </TouchableOpacity>
|
|
|
+ </Tooltip>
|
|
|
);
|
|
|
})}
|
|
|
</View>
|