|
|
@@ -1398,24 +1398,13 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
|
|
|
const isServicesEnabled = await Location.hasServicesEnabledAsync();
|
|
|
|
|
|
if (status === 'granted' && isServicesEnabled) {
|
|
|
- getLocation();
|
|
|
+ await getLocation();
|
|
|
} else if (!canAskAgain || !isServicesEnabled) {
|
|
|
setOpenSettingsVisible(true);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const handleOpenEditModal = () => {
|
|
|
- // handleModalStateChange({
|
|
|
- // selectedFirstYear: userData?.first_visit_year,
|
|
|
- // selectedLastYear: userData?.last_visit_year,
|
|
|
- // selectedQuality:
|
|
|
- // qualityOptions.find((quality) => quality.id === userData?.best_visit_quality) ||
|
|
|
- // qualityOptions[2],
|
|
|
- // selectedNoOfVisits: userData?.no_of_visits || 1,
|
|
|
- // id: regionData?.id
|
|
|
- // });
|
|
|
- // setIsEditModalVisible(true);
|
|
|
- // navigation.navigate(NAVIGATION_PAGES.EDIT_NM_DATA, { regionId: regionData?.id });
|
|
|
navigation.navigate(NAVIGATION_PAGES.TRIPS_2025, {
|
|
|
region: { id: regionData.id, name: regionData.name }
|
|
|
});
|
|
|
@@ -1956,136 +1945,116 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
|
|
|
: null}
|
|
|
</MapLibreRN.VectorSource>
|
|
|
|
|
|
- {nomads && (showNomads || nomadsFilter.friends || nomadsFilter.countries?.length) ? (
|
|
|
- <MapLibreRN.ShapeSource
|
|
|
- ref={shapeSourceRef}
|
|
|
- tolerance={20}
|
|
|
- id="nomads"
|
|
|
- shape={nomads}
|
|
|
- onPress={async (event) => {
|
|
|
- const feature = event.features[0];
|
|
|
- const isCluster = feature.properties?.cluster;
|
|
|
-
|
|
|
- if (isCluster) {
|
|
|
- const clusterCoordinates = (feature.geometry as GeoJSON.Point).coordinates;
|
|
|
-
|
|
|
- const zoom = await shapeSourceRef.current?.getClusterExpansionZoom(
|
|
|
- feature as GeoJSON.Feature<GeoJSON.Geometry>
|
|
|
- );
|
|
|
- const newZoom = zoom ?? 2;
|
|
|
-
|
|
|
- cameraController.setCamera({
|
|
|
- centerCoordinate: clusterCoordinates,
|
|
|
- zoomLevel: newZoom,
|
|
|
- animationDuration: 500,
|
|
|
- animationMode: 'flyTo'
|
|
|
- });
|
|
|
- return;
|
|
|
- } else {
|
|
|
- handleUserPress(event);
|
|
|
- }
|
|
|
+ <MapLibreRN.ShapeSource
|
|
|
+ ref={shapeSourceRef}
|
|
|
+ tolerance={20}
|
|
|
+ id="nomads"
|
|
|
+ shape={
|
|
|
+ nomads && (showNomads || nomadsFilter.friends || nomadsFilter.countries?.length)
|
|
|
+ ? nomads
|
|
|
+ : { type: 'FeatureCollection', features: [] }
|
|
|
+ }
|
|
|
+ onPress={async (event) => {
|
|
|
+ const feature = event.features[0];
|
|
|
+ const isCluster = feature.properties?.cluster;
|
|
|
+
|
|
|
+ if (isCluster) {
|
|
|
+ const clusterCoordinates = (feature.geometry as GeoJSON.Point).coordinates;
|
|
|
+
|
|
|
+ const zoom = await shapeSourceRef.current?.getClusterExpansionZoom(
|
|
|
+ feature as GeoJSON.Feature<GeoJSON.Geometry>
|
|
|
+ );
|
|
|
+ const newZoom = zoom ?? 2;
|
|
|
+
|
|
|
+ cameraController.setCamera({
|
|
|
+ centerCoordinate: clusterCoordinates,
|
|
|
+ zoomLevel: newZoom,
|
|
|
+ animationDuration: 500,
|
|
|
+ animationMode: 'flyTo'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ handleUserPress(event);
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ cluster={true}
|
|
|
+ clusterRadius={50}
|
|
|
+ >
|
|
|
+ <MapLibreRN.SymbolLayer
|
|
|
+ id="nomads_circle"
|
|
|
+ filter={['has', 'point_count']}
|
|
|
+ aboveLayerID={Platform.OS === 'android' ? 'place-continent' : undefined}
|
|
|
+ style={{
|
|
|
+ iconImage: clusteredUsersIcon,
|
|
|
+ iconSize: [
|
|
|
+ 'interpolate',
|
|
|
+ ['linear'],
|
|
|
+ ['get', 'point_count'],
|
|
|
+ 0,
|
|
|
+ 0.33,
|
|
|
+ 10,
|
|
|
+ 0.35,
|
|
|
+ 20,
|
|
|
+ 0.37,
|
|
|
+ 50,
|
|
|
+ 0.39,
|
|
|
+ 75,
|
|
|
+ 0.41,
|
|
|
+ 100,
|
|
|
+ 0.43
|
|
|
+ ],
|
|
|
+ iconAllowOverlap: true
|
|
|
}}
|
|
|
- cluster={true}
|
|
|
- clusterRadius={50}
|
|
|
- >
|
|
|
- <MapLibreRN.SymbolLayer
|
|
|
- id="nomads_circle"
|
|
|
- filter={['has', 'point_count']}
|
|
|
- aboveLayerID={Platform.OS === 'android' ? 'place-continent' : undefined}
|
|
|
- style={{
|
|
|
- iconImage: clusteredUsersIcon,
|
|
|
- iconSize: [
|
|
|
- 'interpolate',
|
|
|
- ['linear'],
|
|
|
- ['get', 'point_count'],
|
|
|
- 0,
|
|
|
- 0.33,
|
|
|
- 10,
|
|
|
- 0.35,
|
|
|
- 20,
|
|
|
- 0.37,
|
|
|
- 50,
|
|
|
- 0.39,
|
|
|
- 75,
|
|
|
- 0.41,
|
|
|
- 100,
|
|
|
- 0.43
|
|
|
- ],
|
|
|
- iconAllowOverlap: true
|
|
|
- }}
|
|
|
- ></MapLibreRN.SymbolLayer>
|
|
|
- <MapLibreRN.SymbolLayer
|
|
|
- id="nomads_count"
|
|
|
- filter={['has', 'point_count']}
|
|
|
- aboveLayerID={Platform.OS === 'android' ? 'nomads_circle' : undefined}
|
|
|
- style={{
|
|
|
- textField: [
|
|
|
- 'case',
|
|
|
- ['<', ['get', 'point_count'], 1000],
|
|
|
- ['get', 'point_count'],
|
|
|
- ['concat', ['/', ['round', ['/', ['get', 'point_count'], 100]], 10], 'k']
|
|
|
- ],
|
|
|
- textFont: ['Noto Sans Bold'],
|
|
|
- textSize: [
|
|
|
- 'interpolate',
|
|
|
- ['linear'],
|
|
|
- ['get', 'point_count'],
|
|
|
- 0,
|
|
|
- 13.5,
|
|
|
- 20,
|
|
|
- 14,
|
|
|
- 75,
|
|
|
- 15
|
|
|
- ],
|
|
|
- textColor: '#FFFFFF',
|
|
|
- textAnchor: 'center',
|
|
|
- textOffset: [
|
|
|
- 'interpolate',
|
|
|
- ['linear'],
|
|
|
- ['get', 'point_count'],
|
|
|
- 0,
|
|
|
- ['literal', [0, 0.85]],
|
|
|
- 20,
|
|
|
- ['literal', [0, 0.92]],
|
|
|
- 75,
|
|
|
- ['literal', [0, 1]]
|
|
|
- ],
|
|
|
- textAllowOverlap: true
|
|
|
- }}
|
|
|
- />
|
|
|
- <MapLibreRN.SymbolLayer
|
|
|
- id="nomads_symbol"
|
|
|
- filter={['!', ['has', 'point_count']]}
|
|
|
- aboveLayerID={Platform.OS === 'android' ? 'place-continent' : undefined}
|
|
|
- style={{
|
|
|
- iconImage: [
|
|
|
- 'case',
|
|
|
- ['==', ['get', 'friend'], 1],
|
|
|
- '02',
|
|
|
- // ['==', ['get', 'trusted'], 1],
|
|
|
- // '01',
|
|
|
- '00'
|
|
|
- ],
|
|
|
- // iconSize: [
|
|
|
- // 'interpolate',
|
|
|
- // ['linear'],
|
|
|
- // ['zoom'],
|
|
|
- // 0,
|
|
|
- // 0.24,
|
|
|
- // 5,
|
|
|
- // 0.28,
|
|
|
- // 10,
|
|
|
- // 0.33,
|
|
|
- // 15,
|
|
|
- // 0.38,
|
|
|
- // 20,
|
|
|
- // 0.42
|
|
|
- // ],
|
|
|
- iconAllowOverlap: true
|
|
|
- }}
|
|
|
- ></MapLibreRN.SymbolLayer>
|
|
|
- </MapLibreRN.ShapeSource>
|
|
|
- ) : null}
|
|
|
+ ></MapLibreRN.SymbolLayer>
|
|
|
+ <MapLibreRN.SymbolLayer
|
|
|
+ id="nomads_count"
|
|
|
+ filter={['has', 'point_count']}
|
|
|
+ aboveLayerID={Platform.OS === 'android' ? 'nomads_circle' : undefined}
|
|
|
+ style={{
|
|
|
+ textField: [
|
|
|
+ 'case',
|
|
|
+ ['<', ['get', 'point_count'], 1000],
|
|
|
+ ['get', 'point_count'],
|
|
|
+ ['concat', ['/', ['round', ['/', ['get', 'point_count'], 100]], 10], 'k']
|
|
|
+ ],
|
|
|
+ textFont: ['Noto Sans Bold'],
|
|
|
+ textSize: [
|
|
|
+ 'interpolate',
|
|
|
+ ['linear'],
|
|
|
+ ['get', 'point_count'],
|
|
|
+ 0,
|
|
|
+ 13.5,
|
|
|
+ 20,
|
|
|
+ 14,
|
|
|
+ 75,
|
|
|
+ 15
|
|
|
+ ],
|
|
|
+ textColor: '#FFFFFF',
|
|
|
+ textAnchor: 'center',
|
|
|
+ textOffset: [
|
|
|
+ 'interpolate',
|
|
|
+ ['linear'],
|
|
|
+ ['get', 'point_count'],
|
|
|
+ 0,
|
|
|
+ ['literal', [0, 0.85]],
|
|
|
+ 20,
|
|
|
+ ['literal', [0, 0.92]],
|
|
|
+ 75,
|
|
|
+ ['literal', [0, 1]]
|
|
|
+ ],
|
|
|
+ textAllowOverlap: true
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <MapLibreRN.SymbolLayer
|
|
|
+ id="nomads_symbol"
|
|
|
+ filter={['!', ['has', 'point_count']]}
|
|
|
+ aboveLayerID={Platform.OS === 'android' ? 'place-continent' : undefined}
|
|
|
+ style={{
|
|
|
+ iconImage: ['case', ['==', ['get', 'friend'], 1], '02', '00'],
|
|
|
+ iconAllowOverlap: true
|
|
|
+ }}
|
|
|
+ ></MapLibreRN.SymbolLayer>
|
|
|
+ </MapLibreRN.ShapeSource>
|
|
|
|
|
|
{selectedUser && <UserItem marker={selectedUser} />}
|
|
|
|