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

+ 29 - 1
src/components/Calendars/RangeCalendar/index.tsx

@@ -22,6 +22,7 @@ import { ButtonVariants } from 'src/types/components';
 import Navigation from './Navigation';
 import { CheckBox } from 'src/components';
 import TransitSvg from 'assets/icons/transit.svg';
+import Tooltip from 'react-native-walkthrough-tooltip';
 
 export default function RangeCalendar({
   isModalVisible,
@@ -60,6 +61,7 @@ export default function RangeCalendar({
   const [currentMonth, setCurrentMonth] = useState<number | undefined>(undefined);
   const [currentYear, setCurrentYear] = useState<number | undefined>(undefined);
   const [transit, setTransit] = useState<boolean | undefined>(undefined);
+  const [toolTipVisible, setToolTipVisible] = useState<boolean>(false);
 
   const computedMinDate = externalMinDate
     ? dayjs(externalMinDate)
@@ -301,7 +303,33 @@ export default function RangeCalendar({
               gap: 8
             }}
           >
-            <TransitSvg fill={Colors.DARK_BLUE} height={24} width={24} />
+            <Tooltip
+              isVisible={toolTipVisible}
+              content={
+                <Text
+                  style={{
+                    fontSize: 12,
+                    color: Colors.DARK_BLUE,
+                    fontStyle: 'italic',
+                    fontWeight: '600'
+                  }}
+                >
+                  Transit
+                </Text>
+              }
+              contentStyle={{ backgroundColor: Colors.WHITE }}
+              placement="top"
+              onClose={() => setToolTipVisible(false)}
+              backgroundColor="transparent"
+              allowChildInteraction={false}
+            >
+              <TouchableOpacity
+                onPress={() => setToolTipVisible(true)}
+                hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
+              >
+                <TransitSvg fill={Colors.DARK_BLUE} height={24} width={24} />
+              </TouchableOpacity>
+            </Tooltip>
             <CheckBox
               onChange={(value) => setTransit(!transit)}
               value={transit}

+ 1 - 0
src/modules/api/trips/trips-api.tsx

@@ -27,6 +27,7 @@ export interface PostGetTripsForYearReturn extends ResponseType {
       description: string;
       list: {
         id: number;
+        alt_id: number | null;
         country: string;
         days_spent: number;
         flag: string | null;

+ 11 - 11
src/screens/InAppScreens/TravelsScreen/AddNewTrip2025Screen/index.tsx

@@ -105,7 +105,7 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
 
   const computeTripSummary = (list: RegionWithDates[]) => {
     const daySet = new Set<string>();
-    const perRegionMap: Record<number, any> = {};
+    const perRegionMap: Record<string, any> = {};
 
     for (const r of list) {
       const isTransit = r.quality === 1;
@@ -480,11 +480,11 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
         };
       });
 
-      if (regionsData.length > 30) {
-        Alert.alert('One trip cannot have more than 30 regions.');
-        setIsLoading(null);
-        return;
-      }
+      // if (regionsData.length > 30) {
+      //   Alert.alert('One trip cannot have more than 30 regions.');
+      //   setIsLoading(null);
+      //   return;
+      // }
 
       const { date_from, date_to } = computePayloadDates(regions);
 
@@ -532,11 +532,11 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
         };
       });
 
-      if (regionsData.length > 30) {
-        Alert.alert('One trip cannot have more than 30 regions.');
-        setIsLoading(null);
-        return;
-      }
+      // if (regionsData.length > 30) {
+      //   Alert.alert('One trip cannot have more than 30 regions.');
+      //   setIsLoading(null);
+      //   return;
+      // }
 
       const { date_from, date_to } = computePayloadDates(regions);
 

+ 29 - 1
src/screens/InAppScreens/TravelsScreen/Components/RegionItemNew/index.tsx

@@ -10,6 +10,7 @@ import { styles } from './styles';
 import TrashSvg from 'assets/icons/travels-screens/trash-solid.svg';
 import CalendarSvg from 'assets/icons/calendar.svg';
 import TransitSvg from 'assets/icons/transit.svg';
+import Tooltip from 'react-native-walkthrough-tooltip';
 
 interface RegionItemProps {
   region: RegionAddData;
@@ -41,6 +42,7 @@ const RegionItem = ({
   const [name, ...rest] = region.region_name?.split(/ – | - /);
   const subname = rest?.join(' - ');
   const [datesTooLong, setDatesTooLong] = useState(false);
+  const [toolTipVisible, setToolTipVisible] = useState<boolean>(false);
 
   return (
     <View key={region.id} style={styles.regionItem}>
@@ -105,7 +107,33 @@ const RegionItem = ({
               </Text>
             </TouchableOpacity>
             {region.quality === 1 ? (
-              <TransitSvg fill={Colors.DARK_BLUE} width={24} height={24} />
+              <Tooltip
+                isVisible={toolTipVisible}
+                content={
+                  <Text
+                    style={{
+                      fontSize: 12,
+                      color: Colors.DARK_BLUE,
+                      fontStyle: 'italic',
+                      fontWeight: '600'
+                    }}
+                  >
+                    Transit
+                  </Text>
+                }
+                contentStyle={{ backgroundColor: Colors.WHITE }}
+                placement="top"
+                onClose={() => setToolTipVisible(false)}
+                backgroundColor="transparent"
+                allowChildInteraction={false}
+              >
+                <TouchableOpacity
+                  onPress={() => setToolTipVisible(true)}
+                  hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
+                >
+                  <TransitSvg fill={Colors.DARK_BLUE} width={24} height={24} />
+                </TouchableOpacity>
+              </Tooltip>
             ) : null}
           </View>
 

+ 21 - 1
src/screens/InAppScreens/TravelsScreen/RegionsVisitedScreen/AccordionListItem.tsx

@@ -19,6 +19,7 @@ import { NAVIGATION_PAGES } from 'src/types';
 
 interface CountryItem {
   id: number;
+  altId?: number | null;
   name: string;
   daysSpent: number;
   flag: string | null;
@@ -47,6 +48,7 @@ const getRegionSubname = (region?: string): string => {
 export const AccordionListItem = React.memo(
   ({
     id,
+    altId,
     name,
     daysSpent,
     flag,
@@ -73,7 +75,25 @@ export const AccordionListItem = React.memo(
           onPress={toggleExpand}
           style={[ItemStyles.wrapper, { paddingHorizontal: 8 }]}
         >
-          <Image style={ItemStyles.bigFlag} source={{ uri: API_HOST + flag }} />
+          <TouchableOpacity
+            onPress={() =>
+              altId
+                ? navigation.navigate(NAVIGATION_PAGES.REGION_PREVIEW, {
+                    regionId: altId,
+                    isTravelsScreen: true,
+                    type: 'nm',
+                    disabled: false
+                  })
+                : navigation.navigate(NAVIGATION_PAGES.COUNTRY_PREVIEW, {
+                    regionId: id,
+                    isTravelsScreen: true,
+                    type: 'country',
+                    disabled: false
+                  })
+            }
+          >
+            <Image style={ItemStyles.bigFlag} source={{ uri: API_HOST + flag }} />
+          </TouchableOpacity>
 
           <View style={[ItemStyles.contentWrapper, { gap: 4 }]}>
             <View style={{ flex: 1 }}>

+ 1 - 0
src/screens/InAppScreens/TravelsScreen/RegionsVisitedScreen/index.tsx

@@ -127,6 +127,7 @@ const RegionsVisitedScreen = ({ route }: { route: any }) => {
             ) : (
               <AccordionListItem
                 id={item.id}
+                altId={item.alt_id}
                 name={item.country}
                 daysSpent={item.days_spent}
                 flag={item.flag}

+ 1 - 0
src/screens/InAppScreens/TravelsScreen/Trips2025Screen/index.tsx

@@ -39,6 +39,7 @@ const TripsScreen = ({ route }: { route: any }) => {
       description: string;
       list: {
         id: number;
+        alt_id: number | null;
         country: string;
         days_spent: number;
         flag: string | null;