leon hace 1 año
padre
commit
f9f80abe18

+ 7 - 6
src/_health/components/fast_sleep_console.tsx

@@ -10,6 +10,7 @@ import showAlert from "@/components/basic/Alert";
 import { IconCellArrow, IconNotification, IconNotificationOff } from "@/components/basic/Icons";
 import { useSelector } from "react-redux";
 import { delRecord } from "@/services/health";
+import { TimeFormatter } from "@/utils/time_format";
 
 export default function FastSleepConsole(props: { step: number, data: any, del: any }) {
     const health = useSelector((state: any) => state.health);
@@ -155,7 +156,7 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
                         showBtn = false;
                         finish = true;
                     }
-                    time = dayjs(fast.target.start_timestamp).format('MM-DD HH:mm')
+                    time = TimeFormatter.dayjsFormat(fast.target.start_timestamp)//dayjs(fast.target.start_timestamp).format('MM-DD HH:mm')
                 }
                 break;
             case 1:
@@ -168,10 +169,10 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
                         finish = true;
                     }
                     if (status == 'OG3') {
-                        time = dayjs(sleep.real.start_timestamp).format('MM-DD HH:mm')
+                        time = TimeFormatter.dayjsFormat(sleep.real.start_timestamp)//dayjs(sleep.real.start_timestamp).format('MM-DD HH:mm')
                     }
                     else {
-                        time = dayjs(sleep.target.start_timestamp).format('MM-DD HH:mm')
+                        time = TimeFormatter.dayjsFormat(sleep.target.start_timestamp)//dayjs(sleep.target.start_timestamp).format('MM-DD HH:mm')
                     }
 
                 }
@@ -181,11 +182,11 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
                     if (status == 'OG3') {
                         showBtn = false
                         finish = true;
-                        time = dayjs(sleep.real.end_timestamp).format('MM-DD HH:mm')
+                        time = TimeFormatter.dayjsFormat(sleep.real.end_timestamp)//dayjs(sleep.real.end_timestamp).format('MM-DD HH:mm')
                     }
                     else {
                         showBtn = true
-                        time = dayjs(sleep.target.end_timestamp).format('MM-DD HH:mm')
+                        time = TimeFormatter.dayjsFormat(sleep.target.end_timestamp)//dayjs(sleep.target.end_timestamp).format('MM-DD HH:mm')
                     }
 
                 }
@@ -193,7 +194,7 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
             case 3:
                 {
                     showBtn = true
-                    time = dayjs(fast.target.end_timestamp).format('MM-DD HH:mm')
+                    time = TimeFormatter.dayjsFormat(fast.target.end_timestamp)//dayjs(fast.target.end_timestamp).format('MM-DD HH:mm')
                 }
                 break;
         }

+ 4 - 0
src/_health/components/schedule_item.tsx

@@ -18,6 +18,7 @@ export default function ScheduleItem(props: {
     highlight?: boolean,
     disable?: boolean,
     gray?:boolean,
+    days?:string,
     showLine: boolean,
     errors: any,
     selMode: any,
@@ -109,6 +110,9 @@ export default function ScheduleItem(props: {
 
                     </StatusIndicator>
                     <View style={{ flex: 1 }} />
+                    {
+                        props.days && <View className="h30" style={{color:MainColorType.g02}}>{props.days}</View>
+                    }
                     {
                         !props.obj.is_all_day && !props.obj.reminder && <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
                     }

+ 4 - 130
src/_health/pages/guide_active.tsx

@@ -17,17 +17,16 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import { IconAdd } from "@/components/basic/Icons";
 import AddLabel from "../components/add_label";
 import ScheduleItem from "../components/schedule_item";
+import { useTranslation } from "react-i18next";
 
 export default function GuideActive() {
     const health = useSelector((state: any) => state.health);
     const [list,setList] = useState<any>(health.schedules)
     const [errors, setErrors] = useState<any>([])
     const [highlight, setHighlight] = useState(true)
-
-    const [selItem, setSelItem] = useState<any>(null)
-    const [showTimePicker, setShowTimePicker] = useState(false)
     const [showModal, setShowModal] = useState(false)
     const [labels, setLabels] = useState<any>([])
+    const {t} = useTranslation()
 
     const dispatch = useDispatch()
     const selMode = 'ACTIVE'
@@ -41,57 +40,6 @@ export default function GuideActive() {
         }, 2000)
     }, [])
 
-    function itemStyle(obj) {
-        if (obj.is_conflict) {
-            return {
-                backgroundColor: '#FF00001A',
-                color: '#FF0000'
-            }
-        }
-        if (errors.length > 0) {
-            return {
-                backgroundColor: '#B2B2B21A',
-                color: '#000'
-            }
-        }
-        return {
-            backgroundColor: obj.window == selMode ? getThemeColor(selMode) + '1A' : '#B2B2B21A',
-            color: obj.window == selMode ? getThemeColor(selMode) : '#000'
-        }
-    }
-
-    function modalContent() {
-        const strTime = selItem.time
-
-        var title = selItem.title
-        var color = getThemeColor(selItem.window)
-
-        return <TimePicker time={strTime}
-            color={color}
-            title={title}
-            confirm={(e) => {
-                // selItem.time = e
-                setSelItem(selItem)
-                setShowTimePicker(false)
-                var array = JSON.parse(JSON.stringify(list))
-                array.map(item => {
-                    if (item.id == selItem.id) {
-                        item.time = e
-                        item.op_ms = new Date().getTime()
-                    }
-                })
-                setList(array)
-                check(array)
-                // var array = JSON.parse(JSON.stringify(list))
-                // array[selIndex].time = e
-                // setList(array)
-                // checkData(array)
-            }}
-            cancel={() => {
-                setShowTimePicker(false)
-            }} />
-    }
-
     function check(array, tapDone = false) {
         createSchedule({
             schedules: array,
@@ -168,41 +116,12 @@ export default function GuideActive() {
                             check(array)
                         }}
                     />
-                    // return <View className='schedule_item' key={i} style={{
-                    //     width: rpxToPx(700),
-                    //     boxSizing: 'border-box',
-                    //     backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
-
-                    // }}>
-                    //     <View className='item_left2'>
-                    //         <View className='item_index'>
-                    //             <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
-                    //         </View>
-                    //         <Text className='item_name'>{obj.title}</Text>
-                    //         <View style={{ flex: 1 }} />
-                    //         {
-                    //             obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && !obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && <View className='edit_item_time' onClick={() => {
-                    //                 setSelIndex(i)
-                    //                 setSelItem(obj)
-                    //                 setShowTimePicker(true)
-                    //             }} style={itemStyle(obj)}>{obj.time}</View>
-                    //         }
-
-                    //         <View className='border_footer_line' />
-                    //     </View>
-                    // </View>
                 })
             }
             <View className='item_add'
                 onClick={() => add()}>
                 <IconAdd color={MainColorType.eat} width={rpxToPx(34)} />
-                <View className='toolbar_btn' style={{ color: MainColorType.eat }} >添加</View>
+                <View className='toolbar_btn' style={{ color: MainColorType.active }} >{t('health.add_active')}</View>
                 <View style={{ flex: 1 }} />
             </View>
         </Card>
@@ -235,43 +154,12 @@ export default function GuideActive() {
                             check(array)
                         }}
                     />
-                    // return <View className='schedule_item' key={i} style={{
-                    //     width: rpxToPx(700),
-                    //     boxSizing: 'border-box',
-                    //     backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
-
-                    // }}>
-                    //     <View className='item_left2'>
-                    //         <View className='item_index'>
-                    //             <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
-                    //         </View>
-                    //         <Text className='item_name'>{obj.title}</Text>
-                    //         <View style={{ flex: 1 }} />
-                    //         {
-                    //             obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && !obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && <View className='edit_item_time' onClick={() => {
-                    //                 setSelIndex(i)
-                    //                 setSelItem(obj)
-                    //                 setShowTimePicker(true)
-                    //             }} style={itemStyle(obj)}>{obj.time}</View>
-                    //         }
-
-                    //         {
-                    //             i < items.length - 1 && <View className='border_footer_line' />
-                    //         }
-                    //     </View>
-                    // </View>
                 })
             }
         </Card>
     }
     return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
-        <NewHeader type={NewHeaderType.center_subtitle} title="保持活跃" subtitle="我的活动日程" />
+        <NewHeader type={NewHeaderType.center_subtitle} title={t('health.guide_3_title')} subtitle={t('health.guide_3_desc')} />
         {
             items()
         }
@@ -294,20 +182,6 @@ export default function GuideActive() {
                 }}
             />
         </View>
-        {
-            showTimePicker && <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowTimePicker(false)
-                }}
-                confirm={() => {
-
-                }}>
-                {
-                    modalContent()
-                }
-            </Modal>
-        }
 
         {
             showModal && <Modal testInfo={null}

+ 4 - 112
src/_health/pages/guide_eat.tsx

@@ -17,18 +17,16 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import { IconAdd } from "@/components/basic/Icons";
 import AddLabel from "../components/add_label";
 import ScheduleItem from "../components/schedule_item";
+import { useTranslation } from "react-i18next";
 
 export default function GuideEat() {
     const health = useSelector((state: any) => state.health);
     const [list,setList] = useState<any>(health.schedules)
     const [errors, setErrors] = useState<any>([])
     const [highlight, setHighlight] = useState(true)
-
-    const [selItem, setSelItem] = useState<any>(null)
-    const [selIndex, setSelIndex] = useState(-1)
-    const [showTimePicker, setShowTimePicker] = useState(false)
     const [showModal, setShowModal] = useState(false)
     const [labels, setLabels] = useState<any>([])
+    const {t} = useTranslation()
 
 
     const dispatch = useDispatch()
@@ -43,38 +41,6 @@ export default function GuideEat() {
 
     }, [])
 
-    function modalContent() {
-        const strTime = selItem.time
-
-        var title = selItem.title
-        var color = getThemeColor(selItem.window)
-
-        return <TimePicker time={strTime}
-            color={color}
-            title={title}
-            confirm={(e) => {
-                // selItem.time = e
-                setSelItem(selItem)
-                setShowTimePicker(false)
-                var array = JSON.parse(JSON.stringify(list))
-                array.map(item => {
-                    if (item.id == selItem.id) {
-                        item.time = e
-                        item.op_ms = new Date().getTime()
-                    }
-                })
-                setList(array)
-                check(array)
-                // var array = JSON.parse(JSON.stringify(list))
-                // array[selIndex].time = e
-                // setList(array)
-                // checkData(array)
-            }}
-            cancel={() => {
-                setShowTimePicker(false)
-            }} />
-    }
-
     function check(array, tapDone = false) {
         createSchedule({
             schedules: array,
@@ -151,41 +117,12 @@ export default function GuideEat() {
                             check(array)
                         }}
                     />
-                    // return <View className='schedule_item' key={i} style={{
-                    //     width: rpxToPx(700),
-                    //     boxSizing: 'border-box',
-                    //     backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
-
-                    // }}>
-                    //     <View className='item_left2'>
-                    //         <View className='item_index'>
-                    //             <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
-                    //         </View>
-                    //         <Text className='item_name'>{obj.title}</Text>
-                    //         <View style={{ flex: 1 }} />
-                    //         {
-                    //             obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && !obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && <View className='edit_item_time' onClick={() => {
-                    //                 setSelIndex(i)
-                    //                 setSelItem(obj)
-                    //                 setShowTimePicker(true)
-                    //             }} style={itemStyle(obj)}>{obj.time}</View>
-                    //         }
-
-                    //         <View className='border_footer_line' />
-                    //     </View>
-                    // </View>
                 })
             }
             <View className='item_add'
                 onClick={() => add()}>
                 <IconAdd color={MainColorType.eat} width={rpxToPx(34)} />
-                <View className='toolbar_btn' style={{ color: MainColorType.eat }} >添加</View>
+                <View className='toolbar_btn' style={{ color: MainColorType.eat }} >{t('health.add_meal')}</View>
                 <View style={{ flex: 1 }} />
             </View>
         </Card>
@@ -218,43 +155,12 @@ export default function GuideEat() {
                             check(array)
                         }}
                     />
-                    // return <View className='schedule_item' key={i} style={{
-                    //     width: rpxToPx(700),
-                    //     boxSizing: 'border-box',
-                    //     backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
-
-                    // }}>
-                    //     <View className='item_left2'>
-                    //         <View className='item_index'>
-                    //             <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
-                    //         </View>
-                    //         <Text className='item_name'>{obj.title}</Text>
-                    //         <View style={{ flex: 1 }} />
-                    //         {
-                    //             obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && !obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && <View className='edit_item_time' onClick={() => {
-                    //                 setSelIndex(i)
-                    //                 setSelItem(obj)
-                    //                 setShowTimePicker(true)
-                    //             }} style={itemStyle(obj)}>{obj.time}</View>
-                    //         }
-
-                    //         {
-                    //             i < items.length - 1 && <View className='border_footer_line' />
-                    //         }
-                    //     </View>
-                    // </View>
                 })
             }
         </Card>
     }
     return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
-        <NewHeader type={NewHeaderType.center_subtitle} title="断食结束后" subtitle="我的饮食日程" />
+        <NewHeader type={NewHeaderType.center_subtitle} title={t('health.guide_2_title')} subtitle={t('health.guide_2_desc')} />
         {
             items()
         }
@@ -276,20 +182,6 @@ export default function GuideEat() {
                 }}
             />
         </View>
-        {
-            showTimePicker && <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowTimePicker(false)
-                }}
-                confirm={() => {
-
-                }}>
-                {
-                    modalContent()
-                }
-            </Modal>
-        }
         {
             showModal && <Modal testInfo={null}
                 dismiss={() => {

+ 4 - 34
src/_health/pages/guide_fast.tsx

@@ -15,6 +15,7 @@ import NewButton, { NewButtonType } from "../base/new_button";
 import { MainColorType } from "@/context/themes/color";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import ScheduleItem from "../components/schedule_item";
+import { useTranslation } from "react-i18next";
 
 export default function GuideFast() {
     const [loaded, setLoaded] = useState(false)
@@ -23,9 +24,8 @@ export default function GuideFast() {
     const [highlight, setHighlight] = useState(true)
 
     const [selItem, setSelItem] = useState<any>(null)
-    const [selIndex, setSelIndex] = useState(-1)
     const [showTimePicker, setShowTimePicker] = useState(false)
-
+    const {t} = useTranslation()
     const dispatch = useDispatch()
     const selMode = 'FAST'
     useEffect(() => {
@@ -105,6 +105,7 @@ export default function GuideFast() {
                         showLine={i < items.length - 1}
                         errors={errors}
                         selMode={selMode}
+                        // days="+1 day"
                         onChange={(time) => {
                             var array = JSON.parse(JSON.stringify(health.schedules))
                             array.map(item => {
@@ -118,44 +119,13 @@ export default function GuideFast() {
                             check(array)
                         }}
                     />
-                    // <View className='schedule_item' key={i} style={{
-                    //     width: rpxToPx(700),
-                    //     boxSizing: 'border-box',
-                    //     backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
-
-                    // }}>
-                    //     <View className='item_left2'>
-                    //         <View className='item_index'>
-                    //             <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
-                    //         </View>
-                    //         <Text className='item_name'>{obj.title}</Text>
-                    //         <View style={{ flex: 1 }} />
-                    //         {
-                    //             obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && !obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && <View className='edit_item_time' onClick={() => {
-                    //                 setSelIndex(i)
-                    //                 setSelItem(obj)
-                    //                 setShowTimePicker(true)
-                    //             }} style={itemStyle(obj)}>{obj.time}</View>
-                    //         }
-
-                    //         {
-                    //             i < items.length - 1 && <View className='border_footer_line' />
-                    //         }
-                    //     </View>
-                    // </View>
                 })
             }
         </Card>
     }
     if (!loaded) return <View />
     return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
-        <NewHeader type={NewHeaderType.center_subtitle} title="我的断食日程" subtitle="每日间歇性断食" />
+        <NewHeader type={NewHeaderType.center_subtitle} title={t('health.guide_0_title')} subtitle={t('health.guide_0_desc')} />
         {
             items()
         }

+ 5 - 92
src/_health/pages/guide_full.tsx

@@ -15,77 +15,28 @@ import NewButton, { NewButtonType } from "../base/new_button";
 import { MainColorType } from "@/context/themes/color";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import ScheduleItem from "../components/schedule_item";
+import { useTranslation } from "react-i18next";
 
 export default function GuideFull() {
     const health = useSelector((state: any) => state.health);
     const [errors, setErrors] = useState<any>([])
 
     const [selItem, setSelItem] = useState<any>(null)
-    const [selIndex, setSelIndex] = useState(-1)
-    const [showTimePicker, setShowTimePicker] = useState(false)
+    const {t} = useTranslation()
 
     const dispatch = useDispatch()
     const selMode = 'SLEEP'
     useEffect(() => {
     }, [])
 
-    function itemStyle(obj) {
-        if (obj.is_conflict) {
-            return {
-                backgroundColor: '#FF00001A',
-                color: '#FF0000'
-            }
-        }
-        if (errors.length > 0) {
-            return {
-                backgroundColor: '#B2B2B21A',
-                color: '#000'
-            }
-        }
-        return {
-            backgroundColor: obj.window == selMode ? getThemeColor(selMode) + '1A' : '#B2B2B21A',
-            color: obj.window == selMode ? getThemeColor(selMode) : '#000'
-        }
-    }
-
-    function modalContent() {
-        const strTime = selItem.time
-
-        var title = selItem.title
-        var color = getThemeColor(selItem.window)
-
-        return <TimePicker time={strTime}
-            color={color}
-            title={title}
-            confirm={(e) => {
-                // selItem.time = e
-                setSelItem(selItem)
-                setShowTimePicker(false)
-                var array = JSON.parse(JSON.stringify(health.schedules))
-                array.map(item => {
-                    if (item.id == selItem.id) {
-                        item.time = e
-                    }
-                })
-                dispatch(setSchedules(array))
-                // var array = JSON.parse(JSON.stringify(list))
-                // array[selIndex].time = e
-                // setList(array)
-                // checkData(array)
-            }}
-            cancel={() => {
-                setShowTimePicker(false)
-            }} />
-    }
-
     function commit(){
         createSchedule({
             schedules: health.schedules
             // only_check: true
         }).then(res => {
             const data={
-                title:'一切就绪!',
-                description:'你的日程已启动',
+                title:t('health.guide_done_title'),
+                description:t('health.guide_done_desc'),
                 current_window:(res as any).current_window
             }
             jumpPage('./post_result?type=schedule&data='+JSON.stringify(data))
@@ -112,36 +63,12 @@ export default function GuideFull() {
                         errors={errors}
                         selMode={selMode}
                     />
-                    // return <View className='schedule_item' key={i} style={{
-                    //     width: rpxToPx(700),
-                    //     boxSizing: 'border-box',
-                    //     backgroundColor:  '#fff'
-
-                    // }}>
-                    //     <View className='item_left2'>
-                    //         <View className='item_index'>
-                    //             <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
-                    //         </View>
-                    //         <Text className='item_name'>{obj.title}</Text>
-                    //         <View style={{ flex: 1 }} />
-                    //         {
-                    //             obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && <View className='edit_item_time' style={{backgroundColor:'transparent'}}>{obj.time}</View>
-                    //         }
-
-                    //         {
-                    //             i < items.length - 1 && <View className='border_footer_line' />
-                    //         }
-                    //     </View>
-                    // </View>
                 })
             }
         </Card>
     }
     return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
-        <NewHeader type={NewHeaderType.center_subtitle} title="即将完成!" subtitle="查看我的日程" />
+        <NewHeader type={NewHeaderType.center_subtitle} title={t('health.guide_end_title')} subtitle={t('health.guide_end_desc')} />
         {
             items()
         }
@@ -156,19 +83,5 @@ export default function GuideFull() {
                 onClick={commit}
             />
         </View>
-        {
-            showTimePicker && <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowTimePicker(false)
-                }}
-                confirm={() => {
-
-                }}>
-                {
-                    modalContent()
-                }
-            </Modal>
-        }
     </View>
 }

+ 3 - 102
src/_health/pages/guide_sleep.tsx

@@ -15,16 +15,14 @@ import NewButton, { NewButtonType } from "../base/new_button";
 import { MainColorType } from "@/context/themes/color";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import ScheduleItem from "../components/schedule_item";
+import { useTranslation } from "react-i18next";
 
 export default function GuideSleep() {
     const health = useSelector((state: any) => state.health);
     const [errors, setErrors] = useState<any>([])
     const [highlight, setHighlight] = useState(true)
     const [list,setList] = useState<any>(health.schedules)
-
-    const [selItem, setSelItem] = useState<any>(null)
-    const [showTimePicker, setShowTimePicker] = useState(false)
-
+    const {t} = useTranslation()
     const dispatch = useDispatch()
     const selMode = 'SLEEP'
     useEffect(() => {
@@ -33,57 +31,6 @@ export default function GuideSleep() {
         }, 2000)
     }, [])
 
-    function itemStyle(obj) {
-        if (obj.is_conflict) {
-            return {
-                backgroundColor: '#FF00001A',
-                color: '#FF0000'
-            }
-        }
-        if (errors.length > 0) {
-            return {
-                backgroundColor: '#B2B2B21A',
-                color: '#000'
-            }
-        }
-        return {
-            backgroundColor: obj.window == selMode ? getThemeColor(selMode) + '1A' : '#B2B2B21A',
-            color: obj.window == selMode ? getThemeColor(selMode) : '#000'
-        }
-    }
-
-    function modalContent() {
-        const strTime = selItem.time
-
-        var title = selItem.title
-        var color = getThemeColor(selItem.window)
-
-        return <TimePicker time={strTime}
-            color={color}
-            title={title}
-            confirm={(e) => {
-                // selItem.time = e
-                setSelItem(selItem)
-                setShowTimePicker(false)
-                var array = JSON.parse(JSON.stringify(list))
-                array.map(item => {
-                    if (item.id == selItem.id) {
-                        item.time = e
-                        item.op_ms = new Date().getTime()
-                    }
-                })
-                setList(array)
-                check(array)
-                // var array = JSON.parse(JSON.stringify(list))
-                // array[selIndex].time = e
-                // setList(array)
-                // checkData(array)
-            }}
-            cancel={() => {
-                setShowTimePicker(false)
-            }} />
-    }
-
     function check(array, tapDone = false) {
         createSchedule({
             schedules: array,
@@ -145,44 +92,12 @@ export default function GuideSleep() {
                             check(array)
                         }}
                     />
-                    // return 
-                    // <View className='schedule_item' key={i} style={{
-                    //     width: rpxToPx(700),
-                    //     boxSizing: 'border-box',
-                    //     backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
-
-                    // }}>
-                    //     <View className='item_left2'>
-                    //         <View className='item_index'>
-                    //             <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
-                    //         </View>
-                    //         <Text className='item_name'>{obj.title}</Text>
-                    //         <View style={{ flex: 1 }} />
-                    //         {
-                    //             obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && !obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
-                    //         }
-                    //         {
-                    //             !obj.is_all_day && <View className='edit_item_time' onClick={() => {
-                    //                 setSelIndex(i)
-                    //                 setSelItem(obj)
-                    //                 setShowTimePicker(true)
-                    //             }} style={itemStyle(obj)}>{obj.time}</View>
-                    //         }
-
-                    //         {
-                    //             i < items.length - 1 && <View className='border_footer_line' />
-                    //         }
-                    //     </View>
-                    // </View>
                 })
             }
         </Card>
     }
     return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
-        <NewHeader type={NewHeaderType.center_subtitle} title="断食期间" subtitle="我的睡眠日程" />
+        <NewHeader type={NewHeaderType.center_subtitle} title={t('health.guide_1_title')} subtitle={t('health.guide_1_desc')} />
         {
             items()
         }
@@ -201,19 +116,5 @@ export default function GuideSleep() {
                 }}
             />
         </View>
-        {
-            showTimePicker && <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowTimePicker(false)
-                }}
-                confirm={() => {
-
-                }}>
-                {
-                    modalContent()
-                }
-            </Modal>
-        }
     </View>
 }

+ 6 - 4
src/_health/pages/post_result.tsx

@@ -14,6 +14,7 @@ import NewModal from "../base/new_modal";
 import Card from "../components/card";
 import { updateReminder } from "@/services/health";
 import StatusIndicator, { StatusType } from "../base/status_indicator";
+import { useTranslation } from "react-i18next";
 
 let useRoute;
 let useNavigation;
@@ -38,6 +39,7 @@ export default function PostResult() {
     const [data, setData] = useState(JSON.parse(router.params.data))
     const [showSetting, setShowSetting] = useState(false)
     const dispatch = useDispatch()
+    const {t} = useTranslation() 
 
     function getMainColor() {
         if (data.scenario == 'MOVE' && data.extra.move_status == 'SEDENTARY') {
@@ -146,13 +148,13 @@ export default function PostResult() {
     function statusText() {
         switch (data.current_window) {
             case 'FAST':
-                return '当前正处于断食日程内'
+                return t('health.guide_current_scenario',{scenario:t('health.fast')})
             case 'EAT':
-                return '当前正处于进食日程内'
+                return t('health.guide_current_scenario',{scenario:t('health.eat')})
             case 'SLEEP':
-                return '当前正处于睡眠日程内'
+                return t('health.guide_current_scenario',{scenario:t('health.sleep')})
             case 'ACTIVE':
-                return '当前正处于活动日程内'
+                return t('health.guide_current_scenario',{scenario:t('health.active')})
         }
         return ''
     }

+ 3 - 2
src/_health/pages/schedules.tsx

@@ -54,7 +54,7 @@ export default function Schedules() {
     const [highlight, setHighlight] = useState(true)
     const [tempArray, setTempArray] = useState<any>([])
     const [btnEnable, setBtnEnable] = useState(true)
-    const selMode = router.params.mode;
+    const [selMode,setSleMode] = useState(router.params.mode);
 
     useEffect(() => {
         if (selMode == '' && router.params.schedules) {
@@ -209,8 +209,9 @@ export default function Schedules() {
                         title: '日程冲突',
                         content: '我们在您的当前日程和另一个日程之间发现了个或多个时间冲突。',
                         showCancel: false,
-                        confirmTitle: '日程冲突',
+                        confirmText: '查看冲突',
                         confirm: () => {
+                            setSleMode('')
                             // jumpPage(`./schedules?mode=&schedules=${JSON.stringify((res as any).schedules)}&errors=${JSON.stringify((res as any).error_messages)}`)
                         }
                     })

+ 47 - 11
src/context/locales/en.js

@@ -836,17 +836,53 @@ export default {
             winter_started: 'Winter time started',
             summer_starts: 'Summer time starts',
             winter_starts: 'Winter time starts',
-            my_places:'My Places',
-            clear_all:'Clear All',
-            choose_location:'Choose Location',
-            done:'Done',
-            clear_title:'Confirmation',
-            clear_content:'Are you sure you want to clear all my places?',
-            clear_cancel:'Cancel',
-            clear_confirm:'Clear All',
-            updating:'Updating',
-            version:'v1.0.0',
-            privacy:'Privacy Policy',
+            my_places: 'My Places',
+            clear_all: 'Clear All',
+            choose_location: 'Choose Location',
+            done: 'Done',
+            clear_title: 'Confirmation',
+            clear_content: 'Are you sure you want to clear all my places?',
+            clear_cancel: 'Cancel',
+            clear_confirm: 'Clear All',
+            updating: 'Updating',
+            version: 'v1.0.0',
+            privacy: 'Privacy Policy',
         }
+    },
+    health: {
+        guide_0_title: 'My Fasting Schedule',
+        guide_0_desc: 'Overnight Intermittent Fasting',
+        guide_0_footer_title: 'Fast Goal: {{hour}} hours',
+        guide_0_footer_desc: 'Current Schedule: {{target}} Intermittent Fasting',
+        guide_1_title: 'While Fasting',
+        guide_1_desc: 'My Sleep Schedule',
+        guide_1_footer_title: 'Sleep Goal: {{hour}} hours',
+        guide_1_footer_desc: 'Consisting of about {{count}} full sleep cycles',
+        guide_2_title: 'After Fasting',
+        guide_2_desc: 'My Eating Schedule',
+        guide_2_footer_title: '{{count}} Meals a Day',
+        guide_2_footer_desc: 'Planned within an {{count}} window from {{duration}}',
+        guide_3_title: 'Stay Active',
+        guide_3_desc: 'My Activity Schedule',
+        guide_3_footer_title: 'Daily Activities or Habits',
+        guide_3_footer_desc: 'Planned within a {{count}} window from {{time}}',
+        guide_end_title: 'Almost Done!',
+        guide_end_desc: 'Review My Daily Schedule',
+        guide_end_footer_title: 'My daily schedule for Eating, Fasting, and Sleep',
+        guide_end_footer_title2: 'My daily schedule for Eating, Fasting, Sleep, and Active',
+        guide_done_title:'You\'re all set!',
+        guide_done_desc:'Your daily schedule has gone live',
+        guide_current_scenario:'Live Now: {{scenario}} Schedule',
+
+        add_meal:'Add Meal',
+        add_active:'Add Activity',
+        i_know:'Got it',
+
+        fast:'Fast',
+        eat:'Eat',
+        sleep:'Sleep',
+        active:'Active',
+
+
     }
 }

+ 40 - 4
src/context/locales/zh.js

@@ -145,7 +145,7 @@ export default {
             location_title: '无法使用位置信息',
             device_location_desc: '前往"定位服务"并开启位置信息服务。',
             location_desc: '请在「位置」中, 允许【hola】在“使用 App期间”访问位置信息。\n如无法操作, 请在「设置-隐私-定位服务」中, 打开“定位服务”。',
-            location_android_service_desc:'前往应用程序信息, 点击"权限 > 位置信息"并选择"仅在使用该应用时允许"。',
+            location_android_service_desc: '前往应用程序信息, 点击"权限 > 位置信息"并选择"仅在使用该应用时允许"。',
             location_cancel: '关闭',
             location_confirm: '开启位置信息',
             device_confirm: '开启位置信息',
@@ -845,9 +845,45 @@ export default {
             clear_content: '确定要清空我常用的全部地点吗?',
             clear_cancel: '取消',
             clear_confirm: '清空',
-            updating:'更新中',
-            version:'1.0.0版',
-            privacy:'隐私政策',
+            updating: '更新中',
+            version: '1.0.0版',
+            privacy: '隐私政策',
         }
+    },
+    health: {
+        guide_0_title: '我的断食日程',
+        guide_0_desc: '每日间歇性断食',
+        guide_0_footer_title: '断食目标:{{hour}} 小时',
+        guide_0_footer_desc: '当前日程:{{target}} 间歇性断食',
+        guide_1_title: '断食期间',
+        guide_1_desc: '我的睡眠日程',
+        guide_1_footer_title: '睡眠目标: {{hour}} 小时',
+        guide_1_footer_desc: '包含{{count}}个完整睡眠周期',
+        guide_2_title: '断食结束后',
+        guide_2_desc: '我的饮食日程',
+        guide_2_footer_title: '一日 {{count}} 餐',
+        guide_2_footer_desc: '计划在 {{duration}} 间的{{count}}小时内进餐',
+        guide_3_title: '保持活跃',
+        guide_3_desc: '我的活动日程',
+        guide_3_footer_title: '日常活动或习惯',
+        guide_3_footer_desc: '计划在 {{time}} 间的{{count}}内进行',
+        guide_end_title: '即将完成!',
+        guide_end_desc: '查看我的日程',
+        guide_end_footer_title: '我的饮食、断食和睡眠日程时间表',
+        guide_end_footer_title2: '我的饮食、断食、睡眠和活动日程时间表',
+        guide_done_title:'一切就绪!',
+        guide_done_desc:'你的日程已启动',
+        guide_current_scenario:'当前正处于{{scenario}}日程内',
+
+        add_meal:'添加餐次',
+        add_active:'添加活动',
+        i_know:'我知道了',
+
+        fast:'断食',
+        eat:'进食',
+        sleep:'睡眠',
+        active:'活动',
+
+
     }
 }

+ 4 - 2
src/features/health/MainConsole.tsx

@@ -172,12 +172,14 @@ export default function MainConsole(props: { type: WindowType }) {
         //     return item.title
         // }
         if (item.real) {
-            return dayjs(item.real.timestamp).format('HH:mm')
+            return TimeFormatter.dayjsFormat(item.real.timestamp)
+            // return dayjs(item.real.timestamp).format('MM-DD HH:mm')
         }
         if (!item.target || !item.target.timestamp) {
             return item.time_label
         }
-        return dayjs(item.target.timestamp).format('HH:mm')
+        return TimeFormatter.dayjsFormat(item.target.timestamp)
+        // return dayjs(item.target.timestamp).format('MM-DD HH:mm')
     }
 
     function itemValue(item: any) {

+ 20 - 1
src/utils/time_format.ts

@@ -761,6 +761,24 @@ export class TimeFormatter {
     }
   }
 
+  static dayjsFormat = (timestamp: number, showToday = false) => {
+    const today = dayjs();
+    const dt = dayjs(timestamp);
+    var strTime = dt.format('HH:mm ')
+    const yesterday = today.subtract(1, 'day');
+    const tomorrow = today.subtract(-1, 'day');
+
+    if (dt.isSame(today, 'day')) {
+      return showToday ? strTime + 'Today' : strTime;
+    } else if (dt.isSame(yesterday, 'day')) {
+      return strTime + 'Yesterday';
+    } else if (dt.isSame(tomorrow, 'day')) {
+      return strTime + 'Tomorrow';
+    } else {
+      return strTime + dt.format('MM-DD');
+    }
+  }
+
   static tzNameToGMT = (timeZone: string) => {
     var minutes = 0
     if (!timeZone || timeZone.length == 0) {
@@ -804,4 +822,5 @@ export class TimeFormatter {
     }
   }
 
-}
+}
+