Viktoriia 2 недель назад
Родитель
Сommit
bd1c6c95a6

+ 21 - 1
src/screens/InAppScreens/TravelsScreen/AddNewTrip2025Screen/index.tsx

@@ -108,6 +108,26 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
     const perRegionMap: Record<string, any> = {};
 
     for (const r of list) {
+      const isTransit = r.quality === 1;
+
+      if (isTransit) {
+        const key = `${r.id}_transit`;
+
+        if (!perRegionMap[key]) {
+          perRegionMap[key] = {
+            id: r.id,
+            name: r.region_name,
+            days: 0,
+            transit: true,
+            flag1: r.flag1!,
+            flag2: r.flag2 ?? null
+          };
+        }
+
+        perRegionMap[key].days += 1;
+        continue;
+      }
+
       if (!isFullDate(r.visitStartDate) || !isFullDate(r.visitEndDate)) continue;
 
       const startISO = dateValueToISO(r.visitStartDate)!;
@@ -497,7 +517,7 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
       const regionsData = regions.map((region) => {
         return {
           id: region.id,
-          quality: 3,
+          quality: region.quality ?? 3,
           hidden: region.hidden,
           year_from: region.visitStartDate?.year || null,
           year_to: region.visitEndDate?.year || null,

+ 36 - 4
src/screens/InAppScreens/TravelsScreen/Components/RegionItemNew/index.tsx

@@ -8,6 +8,8 @@ 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;
@@ -39,6 +41,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}>
@@ -83,7 +86,7 @@ const RegionItem = ({
                 style={[
                   styles.dateText,
                   (!region?.visitStartDate?.year || !region?.visitEndDate?.year) &&
-                    styles.placeholderText
+                  styles.placeholderText
                 ]}
                 numberOfLines={2}
                 onTextLayout={(e) => {
@@ -95,13 +98,42 @@ const RegionItem = ({
                 }}
               >
                 {datesTooLong &&
-                region?.visitStartDate?.year &&
-                region?.visitEndDate?.year &&
-                startLabel !== endLabel
+                  region?.visitStartDate?.year &&
+                  region?.visitEndDate?.year &&
+                  startLabel !== endLabel
                   ? `${startLabel}\n${endLabel}`
                   : (datesLabel ?? 'Select visit dates')}
               </Text>
             </TouchableOpacity>
+            {region.quality === 1 ? (
+              <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>
 
           {errorMessage ? (

+ 16 - 3
src/screens/InAppScreens/TravelsScreen/Components/SummarySheet.tsx

@@ -4,6 +4,7 @@ import ActionSheet, { ActionSheetRef } from 'react-native-actions-sheet';
 import { API_HOST } from 'src/constants';
 import { Colors } from 'src/theme';
 import { getFontSize } from 'src/utils';
+import TransitSvg from 'assets/icons/transit.svg';
 
 type SummaryItem = {
   id: number;
@@ -11,6 +12,7 @@ type SummaryItem = {
   days: number;
   flag1: string;
   flag2: string | null;
+  transit?: boolean;
 };
 
 type Props = {
@@ -110,9 +112,20 @@ const SummarySheet = React.forwardRef<ActionSheetRef, Props>(
                 </View>
               </View>
 
-              <Text style={{ fontSize: 13, fontWeight: '600', color: Colors.DARK_BLUE }}>
-                {r.days} {r.days === 1 ? 'day' : 'days'}
-              </Text>
+              {r.transit ? (
+                <View style={{ flexDirection: 'row', alignItems: 'center', gap: 5 }}>
+                  {r.days > 1 ? (
+                    <Text style={{ fontSize: 13, fontWeight: '600', color: Colors.DARK_BLUE }}>
+                      {r.days}
+                    </Text>
+                  ) : null}
+                  <TransitSvg fill={Colors.DARK_BLUE} height={20} width={20} />
+                </View>
+              ) : (
+                <Text style={{ fontSize: 13, fontWeight: '600', color: Colors.DARK_BLUE }}>
+                  {r.days} {r.days === 1 ? 'day' : 'days'}
+                </Text>
+              )}
             </View>
           ))}
         </ScrollView>