Browse Source

Merge branch 'fix-series' of SashaGoncharov19/nomadmania-app into dev

Viktoriia 1 năm trước cách đây
mục cha
commit
27d285707e

+ 12 - 10
src/screens/InAppScreens/MapScreen/CustomCallout/index.tsx

@@ -1,4 +1,4 @@
-import { View, Image, Text } from 'react-native';
+import { View, Text } from 'react-native';
 import { Callout } from 'react-native-maps';
 
 import { styles } from '../MarkerItem/styles';
@@ -10,13 +10,13 @@ import CheckSvg from 'assets/icons/mark.svg';
 const CustomCallout = ({
   marker,
   toggleSeries,
-  iconUrl,
-  seriesName
+  seriesName,
+  token
 }: {
   marker: ItemSeries;
   toggleSeries: (item: any) => void;
-  iconUrl: string;
   seriesName: string;
+  token: string;
 }) => {
   return (
     <Callout style={styles.customCallout} onPress={() => toggleSeries(marker)}>
@@ -28,14 +28,16 @@ const CustomCallout = ({
         <View
           style={[
             styles.calloutButton,
-            marker.visited === 1 && {
-              backgroundColor: Colors.WHITE,
-              borderWidth: 1,
-              borderColor: Colors.BORDER_LIGHT
-            }
+            (marker.visited === 1 &&
+              token && {
+                backgroundColor: Colors.WHITE,
+                borderWidth: 1,
+                borderColor: Colors.BORDER_LIGHT
+              }) ||
+              {}
           ]}
         >
-          {marker.visited === 1 ? (
+          {marker.visited === 1 && token ? (
             <View style={styles.completedContainer}>
               <CheckSvg width={14} height={14} fill={Colors.DARK_BLUE} />
               <Text style={[styles.calloutButtonText, { color: Colors.DARK_BLUE }]}>Completed</Text>

+ 13 - 9
src/screens/InAppScreens/MapScreen/MarkerItem/index.tsx

@@ -14,13 +14,15 @@ const MarkerItem = ({
   iconUrl,
   coordinate,
   seriesName,
-  toggleSeries
+  toggleSeries,
+  token
 }: {
   marker: ItemSeries;
   iconUrl: string;
   coordinate?: any;
   seriesName: string;
   toggleSeries: (item: any) => void;
+  token: string;
 }) => {
   let markerRef = useRef<MapMarker>(null);
   useEffect(() => {
@@ -35,7 +37,7 @@ const MarkerItem = ({
         <View
           style={[
             styles.markerContainer,
-            marker.visited === 1 && { backgroundColor: Colors.ORANGE }
+            (marker.visited === 1 && token && { backgroundColor: Colors.ORANGE }) || {}
           ]}
         >
           <Image source={{ uri: iconUrl }} style={styles.icon} resizeMode="contain" />
@@ -53,15 +55,17 @@ const MarkerItem = ({
               <CalloutSubview
                 style={[
                   styles.calloutButton,
-                  marker.visited === 1 && {
-                    backgroundColor: Colors.WHITE,
-                    borderWidth: 1,
-                    borderColor: Colors.BORDER_LIGHT
-                  }
+                  (marker.visited === 1 &&
+                    token && {
+                      backgroundColor: Colors.WHITE,
+                      borderWidth: 1,
+                      borderColor: Colors.BORDER_LIGHT
+                    }) ||
+                    {}
                 ]}
                 onPress={() => toggleSeries(marker)}
               >
-                {marker?.visited === 1 ? (
+                {marker?.visited === 1 && token ? (
                   <View style={styles.completedContainer}>
                     <CheckSvg width={14} height={14} fill={Colors.DARK_BLUE} />
                     <Text style={[styles.calloutButtonText, { color: Colors.DARK_BLUE }]}>
@@ -78,8 +82,8 @@ const MarkerItem = ({
           <CustomCallout
             marker={marker}
             toggleSeries={toggleSeries}
-            iconUrl={iconUrl}
             seriesName={seriesName}
+            token={token}
           />
         )}
       </Marker>

+ 12 - 6
src/screens/InAppScreens/MapScreen/index.tsx

@@ -425,6 +425,11 @@ const MapScreen: React.FC<MapScreenProps> = ({ navigation }) => {
 
   const toggleSeries = useCallback(
     async (item: any) => {
+      if (!token) {
+        setIsWarningModalVisible(true);
+        return;
+      }
+
       setMarkers((currentMarkers) =>
         currentMarkers.map((marker) =>
           marker.id === item.id ? { ...marker, visited: Number(!marker.visited) as 0 | 1 } : marker
@@ -468,6 +473,7 @@ const MapScreen: React.FC<MapScreenProps> = ({ navigation }) => {
           coordinate={coordinate}
           seriesName={seriesName}
           toggleSeries={toggleSeries}
+          token={token}
         />
       );
     });
@@ -603,19 +609,19 @@ const MapScreen: React.FC<MapScreenProps> = ({ navigation }) => {
         </>
       ) : (
         <>
-          <TouchableOpacity style={[styles.cornerButton, styles.topLeftButton]}>
+          {/* <TouchableOpacity style={[styles.cornerButton, styles.topLeftButton]}>
             <MenuIcon />
-          </TouchableOpacity>
+          </TouchableOpacity> */}
 
-          <TouchableOpacity style={[styles.cornerButton, styles.topRightButton]}>
+          {/* <TouchableOpacity style={[styles.cornerButton, styles.topRightButton]}>
             <SearchIcon fill={'#0F3F4F'} />
-          </TouchableOpacity>
+          </TouchableOpacity> */}
 
-          <TouchableOpacity
+          {/* <TouchableOpacity
             style={[styles.cornerButton, styles.bottomButton, styles.bottomLeftButton]}
           >
             <RadarIcon />
-          </TouchableOpacity>
+          </TouchableOpacity> */}
 
           <TouchableOpacity
             onPress={handleGetLocation}

+ 1 - 1
src/screens/WelcomeScreen/index.tsx

@@ -41,7 +41,7 @@ const WelcomeScreen: FC<Props> = ({ navigation }) => {
                 onPress={() => navigation.navigate(NAVIGATION_PAGES.IN_APP)}
                 variant={ButtonVariants.OPACITY}
               >
-                Without registration
+                Use without registration
               </Button>
             </View>
           </View>