Leon 1 gadu atpakaļ
vecāks
revīzija
f411b1388c

+ 1 - 1
src/features/trackTimeDuration/components/AllDayRings.tsx

@@ -492,7 +492,7 @@ export default function AllDayRings(props: { schedule: any }) {
     }
 
     return <Box onClick={tapShow}>
-        <View style={{ color: '#fff' }}>显示同步生物钟</View>
+        <View style={{ color: '#fff' }}>同步显示生物钟</View>
         {
             showRing && modalContent()
         }

+ 1 - 1
src/features/trackTimeDuration/components/AllRings.tsx

@@ -399,7 +399,7 @@ export default function AllRings(props: { data?: any, time?: any }) {
         }
     }
     return <Box onClick={tapShow}>
-        <View style={{ color: '#fff' }}>显示同步生物钟</View>
+        <View style={{ color: '#fff' }}>同步显示生物钟</View>
         {
             showRing && modalContent()
         }

+ 20 - 0
src/features/trackTimeDuration/components/CircadianDetailPopup.scss

@@ -195,4 +195,24 @@
     padding-left: 16px;
     padding-right: 16px;
     margin-left: 6px;
+}
+
+.day_night_pop_location{
+    color: #fff;
+    font-size: 24px;
+    line-height: 24px;
+    opacity: 0.6;
+}
+
+.day_night_pop_desc{
+    color: #fff;
+    opacity: 0.4;
+    font-size: 20px;
+    line-height: 28px;
+}
+
+.day_night_pop_choose{
+    color: #fff;
+    font-size: 20px;
+    line-height: 32px;
 }

+ 24 - 13
src/features/trackTimeDuration/components/DayNightDetailPopup.tsx

@@ -269,6 +269,17 @@ export default function DayNightDetailPopup(props: {
         // return `Tomorrow ${sunriseTime} - ${sunsetTime}`
     }
 
+    function diffTimeZone(){
+        if (props.authInfo && props.authInfo.timezone){
+            var split = new Date().toString().split(' ');
+            var timeZoneFormatted = split[split.length - 2];
+            if (timeZoneFormatted!=props.authInfo.timezone){
+                return true
+            }
+        }
+        return false
+    }
+
     function events() {
         let timelineItems: any = []
 
@@ -280,7 +291,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'done',
                         title: '日落',//list[0],
-                        content: TimeFormatter.dateTimeFormate(newT, true),
+                        content: diffTimeZone()?TimeFormatter.dateTimeFormate2(newT):TimeFormatter.dateTimeFormate(newT, true),
                         date: '',
                         color: ColorType.night
                     }
@@ -290,7 +301,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'done',
                         title: '日出',//list[1],
-                        content: TimeFormatter.dateTimeFormate(newT2, true),
+                        content: diffTimeZone()?TimeFormatter.dateTimeFormate2(newT2):TimeFormatter.dateTimeFormate(newT2, true),
                         date: '',
                         color: ColorType.night
                     }
@@ -303,7 +314,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: showExtraData() ? 'done' : 'padding',
                         title: '日落',//list[0],
-                        content: list[0] + ' ' + props.sunsetTime,
+                        content: list[0] + ' ' + props.sunsetTime.substring(0,5),
                         date: '',
                         color: ColorType.night
                     }
@@ -313,7 +324,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'padding',
                         title: '日出',//list[1],
-                        content: list[1] + ' ' + props.sunriseTmrTime,
+                        content: list[1] + ' ' + props.sunriseTmrTime.substring(0,5),
                         date: '',
                         color: ColorType.night
                     }
@@ -329,7 +340,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'done',
                         title: '日落',//list[0],
-                        content: TimeFormatter.dateTimeFormate(newT, true),
+                        content: diffTimeZone()?TimeFormatter.dateTimeFormate2(newT):TimeFormatter.dateTimeFormate(newT, true),
                         date: '',
                         color: ColorType.day
                     }
@@ -339,7 +350,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'done',
                         title: '日出',//list[1],
-                        content: TimeFormatter.dateTimeFormate(newT2, true),
+                        content: diffTimeZone()?TimeFormatter.dateTimeFormate2(newT):TimeFormatter.dateTimeFormate(newT2, true),
                         date: '',
                         color: ColorType.day
                     }
@@ -350,7 +361,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: showExtraData() ? 'done' : 'padding',
                         title: '日出',//dayDurationDesc(),
-                        content: dayDurationDesc() + ' ' + props.sunriseTime,
+                        content: dayDurationDesc() + ' ' + props.sunriseTime.substring(0,5),
                         date: '',
                         color: ColorType.day
                     }
@@ -360,7 +371,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'padding',
                         title: '日落',//dayDurationDesc(),
-                        content: dayDurationDesc() + ' ' + props.sunsetTime,
+                        content: dayDurationDesc() + ' ' + props.sunsetTime.substring(0,5),
                         date: '',
                         color: ColorType.day
                     }
@@ -428,11 +439,11 @@ export default function DayNightDetailPopup(props: {
         {
             (props.authInfo && props.authInfo.lat) ?
                 <View style={{ display: 'flex', flexDirection: 'column' }}>
-                    <Text>{getLocation()}</Text>
-                    <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
-                        <Text>{t('feature.track_time_duration.third_ring.base_location_desc')}</Text>
+                    <Text className='day_night_pop_location'>{getLocation()}</Text>
+                    <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between',alignItems:'center' }}>
+                        <Text className='day_night_pop_desc'>{t('feature.track_time_duration.third_ring.base_location_desc')}</Text>
                         <View onClick={chooseLocation}>
-                            <Text>{t('feature.track_time_duration.third_ring.update_my_location')}</Text>
+                            <Text className='day_night_pop_choose' style={{color:props.isNight?ColorType.night:ColorType.day}}>{t('feature.track_time_duration.third_ring.update_my_location')}</Text>
                         </View>
                     </View>
                 </View> :
@@ -441,7 +452,7 @@ export default function DayNightDetailPopup(props: {
                         e.stopPropagation()
                     }
                     props.updateLocation();
-                }}>上报位置</View></View>
+                }}>{props.isNight ? t('feature.day_night.get_local_time') : t('feature.day_night.get_local_time_sunrise')}</View></View>
         }
 
 

+ 35 - 23
src/utils/time_format.ts

@@ -77,7 +77,7 @@ export class TimeFormatter {
     )} ${TimeFormatter.formatTime(inputDate)}`;
   }
 
-  static dateTimeFormate(timestamp: number,ignoreWeek?:boolean) {
+  static dateTimeFormate(timestamp: number, ignoreWeek?: boolean) {
     const currentDate = new Date();
     const inputDate = new Date(timestamp);
 
@@ -112,7 +112,7 @@ export class TimeFormatter {
     //   return `${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())} ${TimeFormatter.getDateAndWeek(timestamp)}`
     // }
 
-    if (ignoreWeek){
+    if (ignoreWeek) {
       return TimeFormatter.getDate(timestamp) + ' ' + `${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())}`
 
     }
@@ -120,6 +120,18 @@ export class TimeFormatter {
 
   }
 
+  static dateTimeFormate2(timestamp: number) {
+    const inputDate = new Date(timestamp);
+    var dt
+    if (global.language == 'en') {
+      dt = `${TimeFormatter.getMonth(inputDate.getMonth() + 1)} ${inputDate.getDate()}`
+    }
+    dt = `${TimeFormatter.getMonth(inputDate.getMonth() + 1)}${inputDate.getDate()}日`
+
+    return dt + ' ' + `${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())}`
+
+  }
+
   //显示完整日期
   static timelineFullFormatTime(timestamp: number): string {
     var date = new Date(timestamp)
@@ -491,29 +503,29 @@ export class TimeFormatter {
     }
   }
 
-    //获取今天的日期和星期几
-    static getDate = (timestamp: number) => {
-      const now = new Date();
-      var dt = new Date(timestamp)
-      dt.setSeconds(0)
-      dt.setMilliseconds(0)
-      dt.setMinutes(0)
-      dt.setHours(0)
-  
-      const diff = now.getTime() - dt.getTime();
-      const day = 1000 * 60 * 60 * 24;
-  
-      if (diff < day) {
-        return TimeFormatter.getTodayUnit();
-      } else if (diff < 2 * day) {
-        return TimeFormatter.getYesterdayUnit();
-      } else {
-        if (global.language == 'en') {
-          return `${TimeFormatter.getDayOfWeek(dt.getDay())} ${TimeFormatter.getMonth(dt.getMonth() + 1)} ${dt.getDate()}`
-        }
-        return `${TimeFormatter.getMonth(dt.getMonth() + 1)}${dt.getDate()}日`
+  //获取今天的日期和星期几
+  static getDate = (timestamp: number) => {
+    const now = new Date();
+    var dt = new Date(timestamp)
+    dt.setSeconds(0)
+    dt.setMilliseconds(0)
+    dt.setMinutes(0)
+    dt.setHours(0)
+
+    const diff = now.getTime() - dt.getTime();
+    const day = 1000 * 60 * 60 * 24;
+
+    if (diff < day) {
+      return TimeFormatter.getTodayUnit();
+    } else if (diff < 2 * day) {
+      return TimeFormatter.getYesterdayUnit();
+    } else {
+      if (global.language == 'en') {
+        return `${TimeFormatter.getDayOfWeek(dt.getDay())} ${TimeFormatter.getMonth(dt.getMonth() + 1)} ${dt.getDate()}`
       }
+      return `${TimeFormatter.getMonth(dt.getMonth() + 1)}${dt.getDate()}日`
     }
+  }
 
 
   //获取今天的日期和星期几