瀏覽代碼

buttons fixes

Viktoriia 10 月之前
父節點
當前提交
1b69191f28

+ 30 - 29
src/screens/InAppScreens/MapScreen/CountryViewScreen/index.tsx

@@ -221,35 +221,7 @@ const CountryViewScreen: FC<Props> = ({ navigation, route }) => {
           <ChevronLeft fill={Colors.WHITE} />
         </View>
       </TouchableOpacity>
-      {route.params?.isTravelsScreen ? (
-        <TouchableOpacity
-          onPress={() => {
-            navigation.dispatch(
-              CommonActions.reset({
-                index: 1,
-                routes: [
-                  {
-                    name: NAVIGATION_PAGES.IN_APP_MAP_TAB,
-                    state: {
-                      routes: [
-                        {
-                          name: NAVIGATION_PAGES.MAP_TAB,
-                          params: { id: countryId, type: 'countries' }
-                        }
-                      ]
-                    }
-                  }
-                ]
-              })
-            );
-          }}
-          style={styles.goToMapBtn}
-        >
-          <View style={styles.chevronWrapper}>
-            <MapSvg fill={Colors.WHITE} />
-          </View>
-        </TouchableOpacity>
-      ) : null}
+
       <ScrollView
         contentContainerStyle={{ flexGrow: 1 }}
         nestedScrollEnabled={true}
@@ -271,6 +243,35 @@ const CountryViewScreen: FC<Props> = ({ navigation, route }) => {
             <Text style={styles.emptyImageText}>No image available at this location</Text>
           </View>
         )}
+        <TouchableOpacity
+          onPress={() => {
+            route.params?.isTravelsScreen
+              ? navigation.dispatch(
+                  CommonActions.reset({
+                    index: 1,
+                    routes: [
+                      {
+                        name: NAVIGATION_PAGES.IN_APP_MAP_TAB,
+                        state: {
+                          routes: [
+                            {
+                              name: NAVIGATION_PAGES.MAP_TAB,
+                              params: { id: countryId, type: 'countries' }
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  })
+                )
+              : navigation.goBack();
+          }}
+          style={styles.goToMapBtn}
+        >
+          <View style={styles.chevronWrapper}>
+            <MapSvg fill={Colors.WHITE} />
+          </View>
+        </TouchableOpacity>
 
         <View style={styles.wrapper}>
           {regionData?.visited && !disabled && (

+ 31 - 29
src/screens/InAppScreens/MapScreen/RegionViewScreen/index.tsx

@@ -340,35 +340,7 @@ const RegionViewScreen: FC<Props> = ({ navigation, route }) => {
           <ChevronLeft fill={Colors.WHITE} />
         </View>
       </TouchableOpacity>
-      {route.params?.isTravelsScreen ? (
-        <TouchableOpacity
-          onPress={() => {
-            navigation.dispatch(
-              CommonActions.reset({
-                index: 1,
-                routes: [
-                  {
-                    name: NAVIGATION_PAGES.IN_APP_MAP_TAB,
-                    state: {
-                      routes: [
-                        {
-                          name: NAVIGATION_PAGES.MAP_TAB,
-                          params: { id: regionId, type: type === 'nm' ? 'regions' : 'places' }
-                        }
-                      ]
-                    }
-                  }
-                ]
-              })
-            );
-          }}
-          style={styles.goToMapBtn}
-        >
-          <View style={styles.chevronWrapper}>
-            <MapSvg fill={Colors.WHITE} />
-          </View>
-        </TouchableOpacity>
-      ) : null}
+
       <ScrollView
         contentContainerStyle={{ flexGrow: 1 }}
         nestedScrollEnabled={true}
@@ -398,6 +370,36 @@ const RegionViewScreen: FC<Props> = ({ navigation, route }) => {
           </TouchableOpacity>
         ) : null}
 
+        <TouchableOpacity
+          onPress={() => {
+            route.params?.isTravelsScreen
+              ? navigation.dispatch(
+                  CommonActions.reset({
+                    index: 1,
+                    routes: [
+                      {
+                        name: NAVIGATION_PAGES.IN_APP_MAP_TAB,
+                        state: {
+                          routes: [
+                            {
+                              name: NAVIGATION_PAGES.MAP_TAB,
+                              params: { id: regionId, type: type === 'nm' ? 'regions' : 'places' }
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  })
+                )
+              : navigation.goBack();
+          }}
+          style={styles.goToMapBtn}
+        >
+          <View style={styles.chevronWrapper}>
+            <MapSvg fill={Colors.WHITE} />
+          </View>
+        </TouchableOpacity>
+
         <View style={styles.wrapper}>
           <View style={{ flexDirection: 'row', gap: 8, justifyContent: 'flex-end' }}>
             {regionData?.visited && regionData?.first_visit_year > 1 && !disabled && (

+ 23 - 15
src/screens/InAppScreens/MapScreen/index.tsx

@@ -601,14 +601,15 @@ const MapScreen: React.FC<MapScreenProps> = ({ navigation, route }) => {
       mapRef.current?.animateToRegion(region, 1000);
 
       if (type === 'regions') {
-        await mutateUserData(
-          { region_id: +id, token: String(token) },
-          {
-            onSuccess: (data) => {
-              setUserData({ type: 'nm', ...data });
+        token &&
+          (await mutateUserData(
+            { region_id: +id, token: String(token) },
+            {
+              onSuccess: (data) => {
+                setUserData({ type: 'nm', ...data });
+              }
             }
-          }
-        );
+          ));
         await mutateAsync(
           { regions: JSON.stringify([id]), token: String(token) },
           {
@@ -622,14 +623,15 @@ const MapScreen: React.FC<MapScreenProps> = ({ navigation, route }) => {
           }
         );
       } else {
-        await mutateUserDataDare(
-          { dare_id: +id, token: String(token) },
-          {
-            onSuccess: (data) => {
-              setUserData({ type: 'dare', ...data });
+        token &&
+          (await mutateUserDataDare(
+            { dare_id: +id, token: String(token) },
+            {
+              onSuccess: (data) => {
+                setUserData({ type: 'dare', ...data });
+              }
             }
-          }
-        );
+          ));
         setProcessedMarkers([]);
         setMarkers([]);
       }
@@ -877,7 +879,13 @@ const MapScreen: React.FC<MapScreenProps> = ({ navigation, route }) => {
               handleUpdateDare(id, visits);
             }}
             disabled={!token || !isConnected}
-            updateSlow={handleUpdateSlow}
+            updateSlow={(id, v, s11, s31, s101) => {
+              if (!token) {
+                setIsWarningModalVisible(true);
+                return;
+              }
+              handleUpdateSlow(id, v, s11, s31, s101);
+            }}
             openEditSlowModal={handleOpenEditSlowModal}
           />
         </>

+ 5 - 1
src/screens/InAppScreens/TravelsScreen/AddPhotoScreen/index.tsx

@@ -239,7 +239,11 @@ const AddPhotoScreen = ({ route }: { route: any }) => {
             title="Save"
             onPress={saveTempData}
             icon={<SaveSvg fill={Colors.DARK_BLUE} />}
-            disabled={!selectedRegion || imagesStatus.length === 0}
+            disabled={
+              !selectedRegion ||
+              imagesStatus.length === 0 ||
+              imagesStatus.some((img) => !img.loaded)
+            }
           />
           <CustomButton
             title="Add photo"