Viktoriia 1 месяц назад
Родитель
Сommit
98f63468f7

+ 235 - 195
src/screens/InAppScreens/MapScreen/FilterModal/index.tsx

@@ -528,6 +528,22 @@ const FilterModal = ({
             }}
           />
         </View>
+
+        <Button
+          children="Reset"
+          onPress={() => {
+            setSeriesVisible(true);
+            setSelectedSeries(series.map((item) => item.value));
+            setSelectedSeriesFilter(-1);
+          }}
+          variant={ButtonVariants.OPACITY}
+          containerStyles={{
+            backgroundColor: Colors.WHITE,
+            borderWidth: 1,
+            borderColor: Colors.DARK_BLUE
+          }}
+          textStyles={{ color: Colors.DARK_BLUE }}
+        />
       </View>
     );
   };
@@ -615,6 +631,8 @@ const FilterModal = ({
         }
       }
     );
+    setShowNomads && setShowNomads(true);
+    storage.set('showNomads', true);
   };
 
   const handleAcceptPermission = async () => {
@@ -653,131 +671,132 @@ const FilterModal = ({
 
   const renderNomads = () => {
     return (
-      <View style={[styles.sceneContainer, { flex: 0 }]}>
-        <View style={styles.textContainer}>
-          <Text style={styles.text}>The location is shared with 1 km radius precision.</Text>
-          <Tooltip
-            isVisible={toolTipVisible}
-            content={
-              <View style={{ gap: 6 }}>
-                <Text style={[styles.text, styles.boldText]}>
-                  At NomadMania, we respect your privacy.
-                </Text>
-                <Text style={[styles.text]}>
-                  If you choose to share your location, it will be used to show your current
-                  location to other users who also share theirs.
-                </Text>
-                <Text style={[styles.text]}>
-                  You can choose how you want to share your location:
-                </Text>
-                <View style={[styles.bulletItem]}>
-                  <Text style={styles.bulletIcon}>{'\u2022'}</Text>
-                  <Text style={[styles.text, { flex: 1 }]}>
-                    <Text style={styles.boldText}>Only when the app is open</Text> – Your location
-                    updates only when you open the app. This uses less battery but may be less
-                    accurate.
+      <View style={[styles.sceneContainer]}>
+        <View style={{ marginBottom: 16 }}>
+          <View style={styles.textContainer}>
+            <Text style={styles.text}>The location is shared with 1 km radius precision.</Text>
+            <Tooltip
+              isVisible={toolTipVisible}
+              content={
+                <View style={{ gap: 6 }}>
+                  <Text style={[styles.text, styles.boldText]}>
+                    At NomadMania, we respect your privacy.
                   </Text>
-                </View>
-                <View style={styles.bulletItem}>
-                  <Text style={styles.bulletIcon}>{'\u2022'}</Text>
-                  <Text style={[styles.text, { flex: 1 }]}>
-                    <Text style={styles.boldText}>In the background</Text> – Your location stays up
-                    to date even when the app is closed. Other users see your latest location.
+                  <Text style={[styles.text]}>
+                    If you choose to share your location, it will be used to show your current
+                    location to other users who also share theirs.
+                  </Text>
+                  <Text style={[styles.text]}>
+                    You can choose how you want to share your location:
+                  </Text>
+                  <View style={[styles.bulletItem]}>
+                    <Text style={styles.bulletIcon}>{'\u2022'}</Text>
+                    <Text style={[styles.text, { flex: 1 }]}>
+                      <Text style={styles.boldText}>Only when the app is open</Text> – Your location
+                      updates only when you open the app. This uses less battery but may be less
+                      accurate.
+                    </Text>
+                  </View>
+                  <View style={styles.bulletItem}>
+                    <Text style={styles.bulletIcon}>{'\u2022'}</Text>
+                    <Text style={[styles.text, { flex: 1 }]}>
+                      <Text style={styles.boldText}>In the background</Text> – Your location stays
+                      up to date even when the app is closed. Other users see your latest location.
+                    </Text>
+                  </View>
+                  <Text style={[styles.text]}>
+                    You’re always in control, and you can change these settings anytime in the app{' '}
+                    <Text
+                      style={{ color: Colors.ORANGE }}
+                      onPress={() =>
+                        Platform.OS === 'ios'
+                          ? Linking.openURL('app-settings:')
+                          : Linking.openSettings()
+                      }
+                    >
+                      Settings
+                    </Text>{' '}
+                    section.
                   </Text>
                 </View>
-                <Text style={[styles.text]}>
-                  You’re always in control, and you can change these settings anytime in the app{' '}
-                  <Text
-                    style={{ color: Colors.ORANGE }}
-                    onPress={() =>
-                      Platform.OS === 'ios'
-                        ? Linking.openURL('app-settings:')
-                        : Linking.openSettings()
-                    }
-                  >
-                    Settings
-                  </Text>{' '}
-                  section.
-                </Text>
-              </View>
-            }
-            contentStyle={{ backgroundColor: Colors.WHITE }}
-            placement="top"
-            onClose={() => setToolTipVisible(false)}
-            backgroundColor="transparent"
-            allowChildInteraction={false}
-          >
-            <TouchableOpacity
-              style={{ paddingHorizontal: 5 }}
-              onPress={() => setToolTipVisible(true)}
-              hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
+              }
+              contentStyle={{ backgroundColor: Colors.WHITE }}
+              placement="top"
+              onClose={() => setToolTipVisible(false)}
+              backgroundColor="transparent"
+              allowChildInteraction={false}
             >
-              <InfoIcon fill={Colors.DARK_BLUE} width={20} height={20} />
-            </TouchableOpacity>
-          </Tooltip>
-        </View>
-
-        <TouchableOpacity
-          style={[
-            styles.alignStyle,
-            styles.buttonWrapper,
-            {
-              justifyContent: 'space-between'
-            }
-          ]}
-          onPress={toggleSettingsSwitch}
-        >
-          <View style={styles.alignStyle}>
-            <SharingIcon fill={Colors.DARK_BLUE} width={20} height={20} />
-            <Text style={styles.buttonLabel}>Share my location to see others</Text>
-          </View>
-          <View>
-            <Switch
-              trackColor={{ false: Colors.LIGHT_GRAY, true: Colors.DARK_BLUE }}
-              thumbColor={Colors.WHITE}
-              onValueChange={toggleSettingsSwitch}
-              value={isSharing}
-              style={{ transform: 'scale(0.8)' }}
-            />
+              <TouchableOpacity
+                style={{ paddingHorizontal: 5 }}
+                onPress={() => setToolTipVisible(true)}
+                hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
+              >
+                <InfoIcon fill={Colors.DARK_BLUE} width={20} height={20} />
+              </TouchableOpacity>
+            </Tooltip>
           </View>
-        </TouchableOpacity>
 
-        <TouchableOpacity
-          style={[
-            styles.alignStyle,
-            styles.buttonWrapper,
-            {
-              justifyContent: 'space-between'
-            }
-          ]}
-          onPress={toggleNomadsSwitch}
-          disabled={!isSharing}
-        >
-          <View style={styles.alignStyle}>
-            <UsersIcon
-              fill={isSharing ? Colors.DARK_BLUE : Colors.LIGHT_GRAY}
-              width={20}
-              height={20}
-            />
-            <Text style={[styles.buttonLabel, !isSharing ? { color: Colors.LIGHT_GRAY } : {}]}>
-              Show all Nomads - {usersOnMapCount ? formatNumber(usersOnMapCount) : null} online
-            </Text>
-          </View>
-          <View>
-            <Switch
-              trackColor={{ false: Colors.LIGHT_GRAY, true: Colors.DARK_BLUE }}
-              thumbColor={Colors.WHITE}
-              onValueChange={toggleNomadsSwitch}
-              value={showNomads}
-              style={{ transform: 'scale(0.8)' }}
-              disabled={!isSharing}
-            />
-          </View>
-        </TouchableOpacity>
+          <TouchableOpacity
+            style={[
+              styles.alignStyle,
+              styles.buttonWrapper,
+              {
+                justifyContent: 'space-between'
+              }
+            ]}
+            onPress={toggleSettingsSwitch}
+          >
+            <View style={styles.alignStyle}>
+              <SharingIcon fill={Colors.DARK_BLUE} width={20} height={20} />
+              <Text style={styles.buttonLabel}>Share my location to see others</Text>
+            </View>
+            <View>
+              <Switch
+                trackColor={{ false: Colors.LIGHT_GRAY, true: Colors.DARK_BLUE }}
+                thumbColor={Colors.WHITE}
+                onValueChange={toggleSettingsSwitch}
+                value={isSharing}
+                style={{ transform: 'scale(0.8)' }}
+              />
+            </View>
+          </TouchableOpacity>
 
-        <View style={styles.divider} />
+          <TouchableOpacity
+            style={[
+              styles.alignStyle,
+              styles.buttonWrapper,
+              {
+                justifyContent: 'space-between'
+              }
+            ]}
+            onPress={toggleNomadsSwitch}
+            disabled={!isSharing}
+          >
+            <View style={styles.alignStyle}>
+              <UsersIcon
+                fill={isSharing ? Colors.DARK_BLUE : Colors.LIGHT_GRAY}
+                width={20}
+                height={20}
+              />
+              <Text style={[styles.buttonLabel, !isSharing ? { color: Colors.LIGHT_GRAY } : {}]}>
+                Show all Nomads - {usersOnMapCount ? formatNumber(usersOnMapCount) : null} online
+              </Text>
+            </View>
+            <View>
+              <Switch
+                trackColor={{ false: Colors.LIGHT_GRAY, true: Colors.DARK_BLUE }}
+                thumbColor={Colors.WHITE}
+                onValueChange={toggleNomadsSwitch}
+                value={showNomads}
+                style={{ transform: 'scale(0.8)' }}
+                disabled={!isSharing}
+              />
+            </View>
+          </TouchableOpacity>
+
+          <View style={styles.divider} />
 
-        {/* <View style={{ flexDirection: 'row', alignItems: 'center', marginVertical: 12 }}>
+          {/* <View style={{ flexDirection: 'row', alignItems: 'center', marginVertical: 12 }}>
           <View style={styles.divider} />
           <Text
             style={{
@@ -792,7 +811,7 @@ const FilterModal = ({
           <View style={styles.divider} />
         </View> */}
 
-        {/* <TouchableOpacity
+          {/* <TouchableOpacity
           style={[
             styles.alignStyle,
             styles.buttonWrapper,
@@ -825,88 +844,109 @@ const FilterModal = ({
           </View>
         </TouchableOpacity> */}
 
-        <TouchableOpacity
-          style={[
-            styles.alignStyle,
-            styles.buttonWrapper,
-            {
-              justifyContent: 'space-between'
-            }
-          ]}
-          onPress={toggleFriendsSwitch}
-          disabled={!isSharing}
-        >
-          <View style={styles.alignStyle}>
-            {/* TO DO */}
-            <FriendsIcon
-              fill={isSharing ? Colors.DARK_BLUE : Colors.LIGHT_GRAY}
-              width={20}
-              height={18}
-            />
-            <Text style={[styles.buttonLabel, !isSharing ? { color: Colors.LIGHT_GRAY } : {}]}>
-              Show my friends - {friendsOnTheMapCount ? formatNumber(friendsOnTheMapCount) : null}{' '}
-              online
-            </Text>
-          </View>
-          <View>
-            <Switch
-              trackColor={{ false: Colors.LIGHT_GRAY, true: Colors.DARK_BLUE }}
-              thumbColor={Colors.WHITE}
-              onValueChange={toggleFriendsSwitch}
-              value={friendsVisible}
-              style={{ transform: 'scale(0.8)' }}
-              disabled={!isSharing}
-            />
-          </View>
-        </TouchableOpacity>
-
-        <TouchableOpacity
-          style={styles.megaSelector}
-          onPress={() => {
-            if (!isPremium) {
-              setPremiumModalVisible(true);
-              return;
-            }
-            setCountrySelectorVisible(true);
-          }}
-          disabled={!isSharing}
-        >
-          <Text style={styles.megaButtonText}>Show Nomads from (select a country)</Text>
-          <ChevronIcon width={18} height={18} />
-        </TouchableOpacity>
+          <TouchableOpacity
+            style={[
+              styles.alignStyle,
+              styles.buttonWrapper,
+              {
+                justifyContent: 'space-between'
+              }
+            ]}
+            onPress={toggleFriendsSwitch}
+            disabled={!isSharing}
+          >
+            <View style={styles.alignStyle}>
+              <FriendsIcon
+                fill={isSharing ? Colors.DARK_BLUE : Colors.LIGHT_GRAY}
+                width={20}
+                height={18}
+              />
+              <Text style={[styles.buttonLabel, !isSharing ? { color: Colors.LIGHT_GRAY } : {}]}>
+                Show my friends - {friendsOnTheMapCount ? formatNumber(friendsOnTheMapCount) : null}{' '}
+                online
+              </Text>
+            </View>
+            <View>
+              <Switch
+                trackColor={{ false: Colors.LIGHT_GRAY, true: Colors.DARK_BLUE }}
+                thumbColor={Colors.WHITE}
+                onValueChange={toggleFriendsSwitch}
+                value={friendsVisible}
+                style={{ transform: 'scale(0.8)' }}
+                disabled={!isSharing}
+              />
+            </View>
+          </TouchableOpacity>
 
-        {selectedCountries.length > 0 && (
-          <View
-            style={{
-              flexDirection: 'row',
-              alignItems: 'center',
-              flexWrap: 'wrap',
-              marginLeft: 12,
-              gap: 6,
-              marginVertical: 8
+          <TouchableOpacity
+            style={styles.megaSelector}
+            onPress={() => {
+              if (!isPremium) {
+                setPremiumModalVisible(true);
+                return;
+              }
+              setCountrySelectorVisible(true);
             }}
+            disabled={!isSharing}
           >
-            {selectedCountries.map((item) => (
-              <View
-                key={item.country}
-                style={{
-                  marginLeft: -12
-                }}
-              >
-                <Image
-                  source={{ uri: API_HOST + item.flag }}
+            <Text style={styles.megaButtonText}>Show Nomads from (select a country)</Text>
+            <ChevronIcon width={18} height={18} />
+          </TouchableOpacity>
+
+          {selectedCountries.length > 0 && (
+            <View
+              style={{
+                flexDirection: 'row',
+                alignItems: 'center',
+                flexWrap: 'wrap',
+                marginLeft: 12,
+                gap: 6,
+                marginVertical: 8
+              }}
+            >
+              {selectedCountries.map((item) => (
+                <View
+                  key={item.country}
                   style={{
-                    width: 28,
-                    height: 28,
-                    borderRadius: 14,
-                    borderWidth: 0.5,
-                    borderColor: Colors.BORDER_LIGHT
+                    marginLeft: -12
                   }}
-                />
-              </View>
-            ))}
-          </View>
-        )}
+                >
+                  <Image
+                    source={{ uri: API_HOST + item.flag }}
+                    style={{
+                      width: 28,
+                      height: 28,
+                      borderRadius: 14,
+                      borderWidth: 0.5,
+                      borderColor: Colors.BORDER_LIGHT
+                    }}
+                  />
+                </View>
+              ))}
+            </View>
+          )}
+        </View>
+
+        <Button
+          children="Reset"
+          onPress={() => {
+            if (isSharing) {
+              setFriendsVisible(false);
+              setShowNomads && setShowNomads(true);
+              storage.set('showNomads', true);
+              setSelectedCountries([]);
+            } else {
+              handleGetLocation();
+            }
+          }}
+          variant={ButtonVariants.OPACITY}
+          containerStyles={{
+            backgroundColor: Colors.WHITE,
+            borderWidth: 1,
+            borderColor: Colors.DARK_BLUE
+          }}
+          textStyles={{ color: Colors.DARK_BLUE }}
+        />
 
         <MultiSelectorCountries
           isVisible={countrySelectorVisible}

+ 1 - 1
src/screens/InAppScreens/MapScreen/FilterModal/styles.tsx

@@ -53,7 +53,7 @@ export const styles = StyleSheet.create({
   },
   closeBtn: { backgroundColor: Colors.WHITE, borderColor: '#B7C6CB' },
   sceneContainer: {
-    flex: 1,
+    flexGrow: 1,
     paddingVertical: 12,
     marginBottom: 24,
     justifyContent: 'space-between'