|
|
@@ -16,6 +16,7 @@ import AddIcon from '../../../../../assets/icons/travels-screens/circle-plus.svg
|
|
|
import TripSvg from '../../../../../assets/icons/travels-screens/trip.svg';
|
|
|
import InfoIcon from 'assets/icons/info-solid.svg';
|
|
|
import { Colors } from 'src/theme';
|
|
|
+import ChevronLeftIcon from 'assets/icons/chevron-left.svg';
|
|
|
|
|
|
const TripsScreen = ({ route }: { route: any }) => {
|
|
|
const token = storage.get('token', StoreType.STRING) as string;
|
|
|
@@ -64,6 +65,7 @@ const TripsScreen = ({ route }: { route: any }) => {
|
|
|
>([]);
|
|
|
|
|
|
const [isWarningModalVisible, setIsWarningModalVisible] = useState(false);
|
|
|
+ const [isExpanded, setIsExpanded] = useState(false);
|
|
|
|
|
|
useFocusEffect(
|
|
|
useCallback(() => {
|
|
|
@@ -151,80 +153,102 @@ const TripsScreen = ({ route }: { route: any }) => {
|
|
|
ListHeaderComponent={
|
|
|
<View
|
|
|
style={{
|
|
|
- paddingHorizontal: 16,
|
|
|
- paddingVertical: 16,
|
|
|
- marginVertical: 8,
|
|
|
+ marginTop: 12,
|
|
|
+ marginBottom: 8,
|
|
|
backgroundColor: Colors.FILL_LIGHT,
|
|
|
borderRadius: 8,
|
|
|
- gap: 4
|
|
|
+ paddingHorizontal: 8
|
|
|
}}
|
|
|
>
|
|
|
- <Text
|
|
|
+ <TouchableOpacity
|
|
|
+ onPress={() => setIsExpanded(!isExpanded)}
|
|
|
style={{
|
|
|
- fontSize: 14,
|
|
|
- fontFamily: 'montserrat-700',
|
|
|
- color: Colors.DARK_BLUE,
|
|
|
- paddingBottom: 4
|
|
|
+ flexDirection: 'row',
|
|
|
+ alignItems: 'center',
|
|
|
+ paddingVertical: 12,
|
|
|
+ paddingHorizontal: 4,
|
|
|
+ justifyContent: 'space-between',
|
|
|
+ flex: 1
|
|
|
}}
|
|
|
>
|
|
|
- Annual statistics:
|
|
|
- </Text>
|
|
|
-
|
|
|
- <Text style={{ fontSize: 14, fontWeight: '600', color: Colors.DARK_BLUE }}>
|
|
|
- {statistics?.general}
|
|
|
- </Text>
|
|
|
+ <View style={{ flexDirection: 'row', alignItems: 'center', flex: 1 }}>
|
|
|
+ <Text
|
|
|
+ style={{
|
|
|
+ fontSize: 14,
|
|
|
+ fontWeight: 'bold',
|
|
|
+ color: Colors.DARK_BLUE,
|
|
|
+ flexShrink: 1
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ Your travel statistics for {selectedYear}
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
|
|
|
- <Text style={{ fontSize: 14, fontWeight: '600', color: Colors.DARK_BLUE }}>
|
|
|
- {statistics?.countries?.description}
|
|
|
- </Text>
|
|
|
+ <View style={{ width: 18, height: 18, alignItems: 'center' }}>
|
|
|
+ <ChevronLeftIcon
|
|
|
+ fill={Colors.DARK_BLUE}
|
|
|
+ style={[
|
|
|
+ { transform: [{ rotate: '-90deg' }] },
|
|
|
+ isExpanded ? { transform: [{ rotate: '90deg' }] } : null
|
|
|
+ ]}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ </TouchableOpacity>
|
|
|
|
|
|
- <Text style={{ fontSize: 14, fontWeight: '600', color: Colors.DARK_BLUE }}>
|
|
|
- {statistics?.regions?.description}
|
|
|
- </Text>
|
|
|
+ {isExpanded ? (
|
|
|
+ <View
|
|
|
+ style={{
|
|
|
+ paddingHorizontal: 16,
|
|
|
+ paddingBottom: 16,
|
|
|
+ borderRadius: 8,
|
|
|
+ gap: 4
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Text style={{ fontSize: 14, fontWeight: '600', color: Colors.DARK_BLUE }}>
|
|
|
+ {statistics?.general}
|
|
|
+ </Text>
|
|
|
|
|
|
- <Text
|
|
|
- style={{
|
|
|
- fontSize: 14,
|
|
|
- fontFamily: 'montserrat-700',
|
|
|
- color: Colors.DARK_BLUE,
|
|
|
- paddingBottom: 2,
|
|
|
- paddingTop: 6
|
|
|
- }}
|
|
|
- >
|
|
|
- Countries by time spent:
|
|
|
- </Text>
|
|
|
- <View style={{ paddingHorizontal: 6, gap: 4 }}>
|
|
|
- {countriesByTime.map((c, index) => (
|
|
|
- <Text
|
|
|
- key={`${c.country}-${index}`}
|
|
|
- style={{ fontSize: 14, fontWeight: '600', color: Colors.DARK_BLUE }}
|
|
|
+ <TouchableOpacity
|
|
|
+ onPress={() =>
|
|
|
+ navigation.navigate(
|
|
|
+ ...([
|
|
|
+ NAVIGATION_PAGES.REGIONS_VISITED,
|
|
|
+ {
|
|
|
+ title: statistics?.countries?.description,
|
|
|
+ isRegion: false,
|
|
|
+ data: statistics?.countries?.list
|
|
|
+ }
|
|
|
+ ] as never)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
|
>
|
|
|
- • {c.days_spent} days spent in {c.country}
|
|
|
- </Text>
|
|
|
- ))}
|
|
|
- </View>
|
|
|
+ <Text style={{ fontSize: 14, fontWeight: '600', color: Colors.ORANGE }}>
|
|
|
+ {statistics?.countries?.description}
|
|
|
+ </Text>
|
|
|
+ </TouchableOpacity>
|
|
|
|
|
|
- <Text
|
|
|
- style={{
|
|
|
- fontSize: 14,
|
|
|
- fontFamily: 'montserrat-700',
|
|
|
- color: Colors.DARK_BLUE,
|
|
|
- paddingBottom: 2,
|
|
|
- paddingTop: 6
|
|
|
- }}
|
|
|
- >
|
|
|
- Regions by time spent:
|
|
|
- </Text>
|
|
|
- <View style={{ paddingHorizontal: 6, gap: 4 }}>
|
|
|
- {regionsByTime.map((r, index) => (
|
|
|
- <Text
|
|
|
- key={`${r.region}-${index}`}
|
|
|
- style={{ fontSize: 14, fontWeight: '600', color: Colors.DARK_BLUE }}
|
|
|
+ <TouchableOpacity
|
|
|
+ onPress={() =>
|
|
|
+ navigation.navigate(
|
|
|
+ ...([
|
|
|
+ NAVIGATION_PAGES.REGIONS_VISITED,
|
|
|
+ {
|
|
|
+ title: statistics?.regions?.description,
|
|
|
+ isRegion: true,
|
|
|
+ data: statistics?.regions?.list
|
|
|
+ }
|
|
|
+ ] as never)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
|
>
|
|
|
- • {r.days_spent} days spent in {r.region}
|
|
|
- </Text>
|
|
|
- ))}
|
|
|
- </View>
|
|
|
+ <Text style={{ fontSize: 14, fontWeight: '600', color: Colors.ORANGE }}>
|
|
|
+ {statistics?.regions?.description}
|
|
|
+ </Text>
|
|
|
+ </TouchableOpacity>
|
|
|
+ </View>
|
|
|
+ ) : null}
|
|
|
</View>
|
|
|
}
|
|
|
/>
|