|
@@ -9,13 +9,13 @@ import { useGetPhotosForUserQuery, useGetTempQuery } from '@api/photos';
|
|
import { StoreType, storage } from 'src/storage';
|
|
import { StoreType, storage } from 'src/storage';
|
|
|
|
|
|
import { AllRegions, ByDateData, ByRegionData, PhotosData } from '../utils/types';
|
|
import { AllRegions, ByDateData, ByRegionData, PhotosData } from '../utils/types';
|
|
-import { groupByDate } from '../utils';
|
|
|
|
|
|
+import { compareDates, groupByDate } from '../utils';
|
|
import { NAVIGATION_PAGES } from 'src/types';
|
|
import { NAVIGATION_PAGES } from 'src/types';
|
|
import { Colors } from 'src/theme';
|
|
import { Colors } from 'src/theme';
|
|
import { styles } from './styles';
|
|
import { styles } from './styles';
|
|
|
|
|
|
import AddImgSvg from '../../../../../assets/icons/travels-screens/add-img.svg';
|
|
import AddImgSvg from '../../../../../assets/icons/travels-screens/add-img.svg';
|
|
-import ChevronIcon from '../../../../../assets/icons/chevron-left.svg';
|
|
|
|
|
|
+import ChevronIcon from '../../../../../assets/icons/travels-screens/chevron-bottom.svg';
|
|
|
|
|
|
const ByRegionContent = ({
|
|
const ByRegionContent = ({
|
|
data,
|
|
data,
|
|
@@ -54,7 +54,7 @@ const ByRegionContent = ({
|
|
<View style={{ flex: 1 }}>
|
|
<View style={{ flex: 1 }}>
|
|
<TouchableOpacity style={styles.regionSelector} onPress={() => setVisible(true)}>
|
|
<TouchableOpacity style={styles.regionSelector} onPress={() => setVisible(true)}>
|
|
<Text style={styles.regionText}>{selectedRegion?.country ?? 'All Regions'}</Text>
|
|
<Text style={styles.regionText}>{selectedRegion?.country ?? 'All Regions'}</Text>
|
|
- <ChevronIcon fill={'#C8C8C8'} style={{ transform: [{ rotate: '-90deg' }] }} />
|
|
|
|
|
|
+ <ChevronIcon />
|
|
</TouchableOpacity>
|
|
</TouchableOpacity>
|
|
<Modal
|
|
<Modal
|
|
onRequestClose={() => setVisible(false)}
|
|
onRequestClose={() => setVisible(false)}
|
|
@@ -99,11 +99,12 @@ const ByDateContent = ({ data, allRegions }: { data: ByDateData; allRegions: All
|
|
const keys: string[] = Object.keys(data);
|
|
const keys: string[] = Object.keys(data);
|
|
|
|
|
|
if (keys.length > 0) {
|
|
if (keys.length > 0) {
|
|
- const firstKey = keys[0];
|
|
|
|
|
|
+ let sortedKeys = keys?.sort(compareDates);
|
|
|
|
+ const firstKey = sortedKeys[0];
|
|
|
|
|
|
const groupedByDate = groupByDate(data[firstKey]);
|
|
const groupedByDate = groupByDate(data[firstKey]);
|
|
setPhotos(groupedByDate);
|
|
setPhotos(groupedByDate);
|
|
- setFilter(keys);
|
|
|
|
|
|
+ setFilter(sortedKeys);
|
|
}
|
|
}
|
|
setLoading(false);
|
|
setLoading(false);
|
|
}, [data])
|
|
}, [data])
|
|
@@ -115,7 +116,7 @@ const ByDateContent = ({ data, allRegions }: { data: ByDateData; allRegions: All
|
|
<View style={{ flex: 1 }}>
|
|
<View style={{ flex: 1 }}>
|
|
<TouchableOpacity style={styles.regionSelector} onPress={() => setVisible(true)}>
|
|
<TouchableOpacity style={styles.regionSelector} onPress={() => setVisible(true)}>
|
|
<Text style={styles.regionText}>{selectedDate ?? filter[0]}</Text>
|
|
<Text style={styles.regionText}>{selectedDate ?? filter[0]}</Text>
|
|
- <ChevronIcon fill={'#C8C8C8'} style={{ transform: [{ rotate: '-90deg' }] }} />
|
|
|
|
|
|
+ <ChevronIcon />
|
|
</TouchableOpacity>
|
|
</TouchableOpacity>
|
|
<Modal onRequestClose={() => setVisible(false)} headerTitle={'Select Date'} visible={visible}>
|
|
<Modal onRequestClose={() => setVisible(false)} headerTitle={'Select Date'} visible={visible}>
|
|
<List
|
|
<List
|