leon 1 年之前
父节点
当前提交
f7486f5381
共有 33 个文件被更改,包括 733 次插入1504 次删除
  1. 28 65
      src/_health/components/add_label.tsx
  2. 46 3
      src/_health/components/fast_sleep_console.tsx
  3. 3 3
      src/_health/components/onboard.tsx
  4. 1 1
      src/_health/components/schedule_item.tsx
  5. 111 9
      src/_health/pages/guide_active.tsx
  6. 86 6
      src/_health/pages/guide_eat.tsx
  7. 21 2
      src/_health/pages/guide_fast.tsx
  8. 11 1
      src/_health/pages/guide_full.tsx
  9. 22 5
      src/_health/pages/guide_sleep.tsx
  10. 21 16
      src/_health/pages/long_fast.tsx
  11. 17 1
      src/_health/pages/move.tsx
  12. 17 6
      src/_health/pages/schedules.tsx
  13. 0 0
      src/_health/pages/schedules_conflict.config.ts
  14. 0 113
      src/_health/pages/schedules_conflict.scss
  15. 0 136
      src/_health/pages/schedules_conflict.tsx
  16. 0 83
      src/_health/pages/schedules_del.tsx
  17. 0 9
      src/_health/pages/schedules_list.config.ts
  18. 0 136
      src/_health/pages/schedules_list.scss
  19. 0 311
      src/_health/pages/schedules_list.tsx
  20. 0 75
      src/_health/pages/schedules_reminder.tsx
  21. 0 114
      src/_health/pages/schedules_time.tsx
  22. 0 5
      src/app.config.ts
  23. 18 6
      src/app.scss
  24. 60 13
      src/context/locales/en.js
  25. 61 13
      src/context/locales/zh.js
  26. 149 349
      src/features/health/MainConsole.tsx
  27. 3 1
      src/features/health/MainDayNightCard.tsx
  28. 5 3
      src/features/health/MainFastEatCard.tsx
  29. 3 1
      src/features/health/MainSleepActiveCard.tsx
  30. 4 1
      src/features/health/MainSwiper.tsx
  31. 31 7
      src/features/health/calendar.tsx
  32. 4 4
      src/pages/clock/Clock.tsx
  33. 11 6
      src/store/health.tsx

+ 28 - 65
src/_health/components/add_label.tsx

@@ -13,7 +13,14 @@ import NewTimePicker from "../base/new_timepicker";
 import showAlert from "@/components/basic/Alert";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 
-export default function AddLabel(props: { labels: any, defaultValue?: string, disMiss?: any,justLabel?:boolean,confirm?:any }) {
+export default function AddLabel(props: {
+    labels: any,
+    defaultValue?: string,
+    color?: string,
+    disMiss?: any,
+    window?: string,
+    justLabel?: boolean, confirm?: any
+}) {
     const [showTimePicker, setShowTimePicker] = useState(false)
     const health = useSelector((state: any) => state.health);
     const [value, setValue] = useState(props.defaultValue ?? '')
@@ -21,19 +28,6 @@ export default function AddLabel(props: { labels: any, defaultValue?: string, di
     const [timeLabels, setTimeLabels] = useState<any>([])
     const [strTime, setStrTime] = useState(dayjs().format('HH:mm'))
 
-    // function timeContent() {
-    //     return <Modal
-    //         testInfo={null}
-    //         dismiss={() => {
-    //             setShowTimePicker(false)
-    //         }}
-    //         confirm={() => { }}>
-    //         {
-    //             pickerContent()
-    //         }
-    //     </Modal>
-    // }
-
     useEffect(() => {
         getData()
     }, [])
@@ -45,56 +39,25 @@ export default function AddLabel(props: { labels: any, defaultValue?: string, di
         })
     }
 
-    function pickerContent() {
-        const strTime = dayjs().format('HH:mm')
-        return <TimePicker time={strTime}
-            color={getThemeColor(health.mode)}
-            title='开始时间'
-            confirm={(e) => {
-                confirmPickerTime(e)
-            }}
-            cancel={() => {
-                setShowTimePicker(false)
-            }} />
-    }
-
-    function confirmPickerTime(e) {
-        console.log(e)
-        createSchedule({
-
-            schedules: [{
-                event: health.mode == 'EAT' ? 'EAT_CUSTOM' : 'ACTIVE_CUSTOM',
-                title: value,
-                time: e, is_all_day: false,
-
-            }]
-        }).then(res => {
-            global.refreshWindow()
-            if (global.refreshSchedules) {
-                global.refreshSchedules()
-            }
-            if (global.refreshSchedules2) {
-                global.refreshSchedules2()
-            }
-
-            // if (process.env.TARO_ENV == 'weapp') {
-            //     Taro.navigateBack()
-            // }
-        })
-    }
-
     function done() {
+        var event = ''
+        if (props.window) {
+            event = props.window == 'EAT' ? 'EAT_CUSTOM' : 'ACTIVE_CUSTOM'
+        }
+        else {
+            event = health.mode == 'EAT' ? 'EAT_CUSTOM' : 'ACTIVE_CUSTOM'
+        }
         createSchedule({
 
             schedules: [{
-                event: health.mode == 'EAT' ? 'EAT_CUSTOM' : 'ACTIVE_CUSTOM',
+                event: event,
                 title: value,
                 time: strTime,
                 is_all_day: isFullday,
                 time_label: isFullday ? strTime : null
             }]
         }).then(res => {
-            if ((res as any).result){
+            if ((res as any).result) {
                 if (global.refreshWindow) {
                     global.refreshWindow()
                 }
@@ -104,6 +67,9 @@ export default function AddLabel(props: { labels: any, defaultValue?: string, di
                 if (global.refreshSchedules2) {
                     global.refreshSchedules2()
                 }
+                if (props.confirm){
+                    props.confirm((res as any).schedules[0])
+                }
             }
             else {
                 showAlert({
@@ -115,7 +81,7 @@ export default function AddLabel(props: { labels: any, defaultValue?: string, di
                     }
                 })
             }
-            
+
 
 
             setShowTimePicker(false)
@@ -128,8 +94,8 @@ export default function AddLabel(props: { labels: any, defaultValue?: string, di
         })
     }
 
-    function tapDone(){
-        if (props.justLabel){
+    function tapDone() {
+        if (props.justLabel) {
             props.confirm(value)
         }
         else {
@@ -143,7 +109,7 @@ export default function AddLabel(props: { labels: any, defaultValue?: string, di
             <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
                 <Text>全天时间</Text>
                 <Switch
-                    color={getThemeColor(health.mode)}
+                    color={props.color ? props.color : getThemeColor(health.mode)}
                     onChange={(e) => {
                         setIsFullday(e.detail.value)
                         // item.reminder = e.detail.value
@@ -166,13 +132,13 @@ export default function AddLabel(props: { labels: any, defaultValue?: string, di
                     <View style={{ flexDirection: 'column', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                         {/* <Text onClick={}>{dayjs().format('HH:mm')}</Text>
                         <Text>Picker placeholder</Text> */}
-                        <NewTimePicker onChange={e=>{
+                        <NewTimePicker onChange={e => {
                             console.log(e)
                             setStrTime(e)
-                        }}/>
+                        }} />
                     </View>
             }
-            <View className="pop_footer" style={{ backgroundColor: getThemeColor(health.mode) }} onClick={() => done()}>完成</View>
+            <View className="pop_footer" style={{ backgroundColor: props.color ? props.color : getThemeColor(health.mode) }} onClick={() => done()}>完成</View>
         </View>
     }
 
@@ -190,10 +156,7 @@ export default function AddLabel(props: { labels: any, defaultValue?: string, di
                 }
             </View>
         </View>
-        <View className="pop_footer" style={{ backgroundColor: getThemeColor(health.mode) }} onClick={tapDone}>{props.justLabel?'完成':'下一步'}</View>
-        {/* {
-            showTimePicker && timeContent()
-        } */}
+        <View className="pop_footer" style={{ backgroundColor: props.color ? props.color : getThemeColor(health.mode) }} onClick={tapDone}>{props.justLabel ? '完成' : '下一步'}</View>
         {
             showTimePicker && <Modal testInfo={null}
                 dismiss={() => {

+ 46 - 3
src/_health/components/fast_sleep_console.tsx

@@ -11,10 +11,13 @@ import { IconCellArrow, IconNotification, IconNotificationOff } from "@/componen
 import { useSelector } from "react-redux";
 import { delRecord } from "@/services/health";
 import { TimeFormatter } from "@/utils/time_format";
+import showActionSheet from "@/components/basic/ActionSheet";
+import { useTranslation } from "react-i18next";
 
 export default function FastSleepConsole(props: { step: number, data: any, del: any }) {
     const health = useSelector((state: any) => state.health);
-
+    let navigation, showActionSheetWithOptions;
+    const { t } = useTranslation()
     function tapLogBtn(index: number) {
         const { fast, sleep, status } = props.data
         var single = 0;
@@ -138,6 +141,46 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
         return <IconNotificationOff color="#fff" width={rpxToPx(20)} />
     }
 
+    function actionList() {
+        var list: any = []
+        if (!health.finish_setup) {
+            list.push(t('health.finish_setup'))
+        }
+        if (props.data.status != 'WFS') {
+            list.push(t('health.delete_current_record'))
+        }
+        if (health.finish_setup) {
+            list.push(t('health.edit_schedule'))
+        }
+        return list
+    }
+
+    function showAction() {
+        showActionSheet({
+            showActionSheetWithOptions: showActionSheetWithOptions,
+            title: t('health.more_actions'),
+            itemList: actionList(),
+            success: (res) => {
+                tapActionSheet(res)
+            }
+        });
+    }
+
+    function tapActionSheet(index) {
+        var title = actionList()[index]
+        switch (title) {
+            case t('health.finish_setup'):
+                jumpPage('/_health/pages/guide_fast')
+                break;
+            case t('health.delete_current_record'):
+                delConfirm()
+                break;
+            case t('health.edit_schedule'):
+                jumpPage('/_health/pages/schedules?mode=FAST,EAT')
+                break
+        }
+    }
+
 
     function timelineItem(item: any, index: number, count: number) {
         const { fast, sleep, status } = props.data
@@ -339,7 +382,7 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
             }, 3, 4)
         }
         {
-            props.data.status != 'WFS' && <View className="main_console_footer">
+            <View className="main_console_footer">
                 <NewButton
                     btnStyle={{
                         position: 'absolute',
@@ -347,7 +390,7 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
                         right: rpxToPx(40)
                     }}
                     type={NewButtonType.more}
-                    onClick={delConfirm}
+                    onClick={showAction}
                 />
 
             </View>

+ 3 - 3
src/_health/components/onboard.tsx

@@ -4,7 +4,7 @@ import { View, Text } from "@tarojs/components";
 import { useSelector } from "react-redux";
 import './onboard.scss'
 
-export default function OnBoard(props: { title: string, desc: string, btnTitle: string, onClick: any }) {
+export default function OnBoard(props: { title: string, desc: string, btnTitle: string, onClick: any, color?: string }) {
     const health = useSelector((state: any) => state.health);
     return <View style={{
         display: 'flex',
@@ -21,11 +21,11 @@ export default function OnBoard(props: { title: string, desc: string, btnTitle:
             alignItems: 'center',
             justifyContent: 'center',
             color: '#fff',
-            backgroundColor: getThemeColor(health.mode),
+            backgroundColor: props.color ? props.color : getThemeColor(health.mode),
             width: rpxToPx(374),
             height: rpxToPx(72),
             borderRadius: 9,
-            marginBottom:rpxToPx(72)
+            marginBottom: rpxToPx(72)
         }}>{props.btnTitle}</View>
         <View className="border_footer_line" />
     </View>

+ 1 - 1
src/_health/components/schedule_item.tsx

@@ -111,7 +111,7 @@ export default function ScheduleItem(props: {
                     </StatusIndicator>
                     <View style={{ flex: 1 }} />
                     {
-                        props.days && <View className="h30" style={{color:MainColorType.g02}}>{props.days}</View>
+                        props.days && <View className="h30" style={{color:MainColorType.g02}}>+{props.days} day</View>
                     }
                     {
                         !props.obj.is_all_day && !props.obj.reminder && <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />

+ 111 - 9
src/_health/pages/guide_active.tsx

@@ -8,7 +8,7 @@ import { setSchedules } from "@/store/health";
 import { useDispatch, useSelector } from "react-redux";
 import Card from "../components/card";
 import { rpxToPx } from "@/utils/tools";
-import { getThemeColor } from "@/features/health/hooks/health_hooks";
+import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
 import Modal from "@/components/layout/Modal.weapp";
 import TimePicker from "@/features/common/TimePicker";
 import NewButton, { NewButtonType } from "../base/new_button";
@@ -18,15 +18,31 @@ import { IconAdd } from "@/components/basic/Icons";
 import AddLabel from "../components/add_label";
 import ScheduleItem from "../components/schedule_item";
 import { useTranslation } from "react-i18next";
+import OnBoard from "../components/onboard";
+import showAlert from "@/components/basic/Alert";
 
+let useRoute;
+let useNavigation;
+let scenario = '';
+if (process.env.TARO_ENV == 'rn') {
+    useRoute = require("@react-navigation/native").useRoute
+    useNavigation = require("@react-navigation/native").useNavigation
+}
 export default function GuideActive() {
     const health = useSelector((state: any) => state.health);
-    const [list,setList] = useState<any>(health.schedules)
+    const [list, setList] = useState<any>(health.schedules)
     const [errors, setErrors] = useState<any>([])
     const [highlight, setHighlight] = useState(true)
     const [showModal, setShowModal] = useState(false)
     const [labels, setLabels] = useState<any>([])
-    const {t} = useTranslation()
+    const { t } = useTranslation()
+
+    let navigation, showActionSheetWithOptions;
+
+    let router
+    if (useNavigation) {
+        navigation = useNavigation()
+    }
 
     const dispatch = useDispatch()
     const selMode = 'ACTIVE'
@@ -44,10 +60,10 @@ export default function GuideActive() {
         createSchedule({
             schedules: array,
             only_check: true,
-            return_all:true,
-            op_page: 'SCHEDULE_WALKTHROUGH_4',sort_by:'EVENT'
+            return_all: true,
+            op_page: 'SCHEDULE_WALKTHROUGH_4', sort_by: 'EVENT'
         }).then(res => {
-            
+
             if ((res as any).result) {
                 dispatch(setSchedules((res as any).schedules))
                 if (tapDone) {
@@ -63,6 +79,19 @@ export default function GuideActive() {
     }
 
     function add() {
+        const scenario = getScenario(health.windows, 'ACTIVE')
+        var items = list.filter(item => item.window == 'ACTIVE')
+        if (scenario.access.max <= items.length) {
+            showAlert({
+                title: '会员',
+                content: '会员desc',
+                showCancel: true,
+                confirm: () => {
+                    jumpPage('/pages/store/product_list', 'ProductList', navigation)
+                }
+            })
+            return;
+        }
         setShowModal(true)
     }
 
@@ -73,8 +102,34 @@ export default function GuideActive() {
         return false
     }
 
+    function footerTitle() {
+        if (health.footer) {
+            return health.footer.active.title
+        }
+        return ''
+    }
+
+    function footerDesc() {
+        if (health.footer) {
+            return health.footer.active.description
+        }
+        return ''
+    }
+
     function items() {
         var items = list.filter(item => item.window == 'ACTIVE')
+        if (items.length == 0) {
+            return <Card>
+                <OnBoard title="title"
+                    desc="desc"
+                    color={MainColorType.active}
+                    btnTitle={t('health.create_my_active')}
+                    onClick={() => {
+                        add()
+                    }}
+                />
+            </Card>
+        }
         return <Card>
             {
                 errors.map((item1, index) => {
@@ -92,15 +147,28 @@ export default function GuideActive() {
                         selMode={selMode}
                         disable={isDisable(obj)}
                         gray={isDisable(obj)}
+                        days={obj.plus_days != 0 ? obj.plus_days : null}
                         onDelete={() => {
+                            const scenario = getScenario(health.windows, 'ACTIVE')
+                            if (scenario.access.min >= items.length) {
+                                showAlert({
+                                    title: '删除',
+                                    content: '最少保留' + items.length + '个',
+                                    showCancel: true,
+                                    confirm: () => {
+                                    }
+                                })
+                                return
+                            }
                             delSchedule(obj.id).then(res => {
-                                var array = JSON.parse(health.schedules)
+                                var array = JSON.parse(JSON.stringify(list))
                                 for (var j = 0; j < array.length; j++) {
                                     if (array[j].id == obj.id) {
                                         array.splice(j, 1)
                                     }
                                 }
                                 setList(array)
+                                global.refreshWindow()
                             })
                         }}
                         onChange={(time) => {
@@ -141,6 +209,29 @@ export default function GuideActive() {
                         selMode={selMode}
                         disable={isDisable(obj)}
                         gray={isDisable(obj)}
+                        days={obj.plus_days != 0 ? obj.plus_days : null}
+                        onDelete={() => {
+                            const scenario = getScenario(health.windows, 'ACTIVE')
+                            if (scenario.access.min >= items.length) {
+                                showAlert({
+                                    title: '删除',
+                                    content: '最少保留' + items.length + '个',
+                                    showCancel: true,
+                                    confirm: () => {
+                                    }
+                                })
+                                return
+                            }
+                            var array = JSON.parse(JSON.stringify(list))
+                            for (var j = 0; j < array.length; j++) {
+                                if (array[j].id == obj.id) {
+                                    array.splice(j, 1)
+                                }
+                            }
+                            setList(array)
+                            check(array)
+                            global.refreshWindow()
+                        }}
                         onChange={(time) => {
                             var array = JSON.parse(JSON.stringify(list))
                             array.map(item => {
@@ -163,10 +254,13 @@ export default function GuideActive() {
         {
             items()
         }
-        <View style={{ height: 20 }} />
+        <View className="cell_footer_title bold h24" style={{ color: MainColorType.g02 }}>{footerTitle()}</View>
+        <View className="cell_footer_desc h24" style={{ color: MainColorType.g02 }}>{footerDesc()}</View>
+        <View style={{ height: 20, flexShrink: 0 }} />
         {
             fastSleepItems()
         }
+        <View style={{ height: 300, flexShrink: 0 }} />
         <View style={{ flex: 1 }} />
         <View className="main_footer">
             <NewButton
@@ -189,7 +283,15 @@ export default function GuideActive() {
                     setShowModal(false)
                 }}
                 confirm={() => { }}>
-                <AddLabel labels={labels} disMiss={() => setShowModal(false)} />
+                <AddLabel labels={labels}
+                    window='ACTIVE'
+                    disMiss={() => setShowModal(false)}
+                    confirm={(e) => {
+                        var array = JSON.parse(JSON.stringify(list))
+                        array.push(e)
+                        setList(array)
+                    }}
+                    color={MainColorType.active} />
             </Modal>
         }
     </View>

+ 86 - 6
src/_health/pages/guide_eat.tsx

@@ -8,7 +8,7 @@ import { setSchedules } from "@/store/health";
 import { useDispatch, useSelector } from "react-redux";
 import Card from "../components/card";
 import { rpxToPx } from "@/utils/tools";
-import { getThemeColor } from "@/features/health/hooks/health_hooks";
+import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
 import Modal from "@/components/layout/Modal.weapp";
 import TimePicker from "@/features/common/TimePicker";
 import NewButton, { NewButtonType } from "../base/new_button";
@@ -18,15 +18,31 @@ import { IconAdd } from "@/components/basic/Icons";
 import AddLabel from "../components/add_label";
 import ScheduleItem from "../components/schedule_item";
 import { useTranslation } from "react-i18next";
+import showAlert from "@/components/basic/Alert";
+
+let useRoute;
+let useNavigation;
+let scenario = '';
+if (process.env.TARO_ENV == 'rn') {
+    useRoute = require("@react-navigation/native").useRoute
+    useNavigation = require("@react-navigation/native").useNavigation
+}
 
 export default function GuideEat() {
     const health = useSelector((state: any) => state.health);
-    const [list,setList] = useState<any>(health.schedules)
+    const [list, setList] = useState<any>(health.schedules)
     const [errors, setErrors] = useState<any>([])
     const [highlight, setHighlight] = useState(true)
     const [showModal, setShowModal] = useState(false)
     const [labels, setLabels] = useState<any>([])
-    const {t} = useTranslation()
+    const { t } = useTranslation()
+
+    let navigation, showActionSheetWithOptions;
+
+    let router
+    if (useNavigation) {
+        navigation = useNavigation()
+    }
 
 
     const dispatch = useDispatch()
@@ -48,7 +64,7 @@ export default function GuideEat() {
             return_all: true,
             op_page: 'SCHEDULE_WALKTHROUGH_3', sort_by: 'EVENT'
         }).then(res => {
-            
+
             if ((res as any).result) {
                 dispatch(setSchedules((res as any).schedules))
                 setErrors([])
@@ -64,6 +80,20 @@ export default function GuideEat() {
     }
 
     function add() {
+        const scenario = getScenario(health.windows, 'EAT')
+        var items = list.filter(item => item.window == 'EAT')
+        if (scenario.access.max <= items.length) {
+            showAlert({
+                title: '会员',
+                content: '会员desc',
+                showCancel: true,
+                confirm: () => {
+                    jumpPage('/pages/store/product_list', 'ProductList', navigation)
+                }
+            })
+            return;
+        }
+
         setShowModal(true)
     }
 
@@ -74,6 +104,20 @@ export default function GuideEat() {
         return false
     }
 
+    function footerTitle() {
+        if (health.footer) {
+            return health.footer.eat.title
+        }
+        return ''
+    }
+
+    function footerDesc() {
+        if (health.footer) {
+            return health.footer.eat.description
+        }
+        return ''
+    }
+
     function items() {
         var items = list.filter(item => item.window == 'EAT')
         return <Card>
@@ -93,15 +137,28 @@ export default function GuideEat() {
                         selMode={selMode}
                         disable={isDisable(obj)}
                         gray={isDisable(obj)}
+                        days={obj.plus_days!=0?obj.plus_days:null}
                         onDelete={() => {
+                            const scenario = getScenario(health.windows, 'EAT')
+                            if (scenario.access.min>=items.length){
+                                showAlert({
+                                    title: '删除',
+                                    content: '最少保留'+items.length+'个',
+                                    showCancel: true,
+                                    confirm: () => {
+                                    }
+                                })
+                                return
+                            }
                             delSchedule(obj.id).then(res => {
-                                var array = JSON.parse(list)
+                                var array = JSON.parse(JSON.stringify(list))
                                 for (var j = 0; j < array.length; j++) {
                                     if (array[j].id == obj.id) {
                                         array.splice(j, 1)
                                     }
                                 }
                                 setList(array)
+                                global.refreshWindow()
                             })
                         }}
                         onChange={(time) => {
@@ -142,6 +199,18 @@ export default function GuideEat() {
                         selMode={selMode}
                         disable={isDisable(obj)}
                         gray={isDisable(obj)}
+                        days={obj.plus_days!=0?obj.plus_days:null}
+                        onDelete={() => {
+                            var array = JSON.parse(JSON.stringify(list))
+                            for (var j = 0; j < array.length; j++) {
+                                if (array[j].id == obj.id) {
+                                    array.splice(j, 1)
+                                }
+                            }
+                            setList(array)
+                            check(array)
+                            global.refreshWindow()
+                        }}
                         onChange={(time) => {
                             var array = JSON.parse(JSON.stringify(list))
                             array.map(item => {
@@ -164,10 +233,13 @@ export default function GuideEat() {
         {
             items()
         }
+        <View className="cell_footer_title bold h24" style={{ color: MainColorType.g02 }}>{footerTitle()}</View>
+        <View className="cell_footer_desc h24" style={{ color: MainColorType.g02 }}>{footerDesc()}</View>
         <View style={{ height: 20, flexShrink: 0 }} />
         {
             fastSleepItems()
         }
+        <View style={{ height: 300, flexShrink: 0 }} />
         <View style={{ flex: 1 }} />
         <View className="main_footer">
             <NewButton
@@ -188,7 +260,15 @@ export default function GuideEat() {
                     setShowModal(false)
                 }}
                 confirm={() => { }}>
-                <AddLabel labels={labels} disMiss={() => setShowModal(false)} />
+                <AddLabel labels={labels}
+                    window='EAT'
+                    disMiss={() => setShowModal(false)}
+                    confirm={(e) => {
+                        var array = JSON.parse(JSON.stringify(list))
+                        array.push(e)
+                        setList(array)
+                    }}
+                    color={MainColorType.eat} />
             </Modal>
         }
     </View>

+ 21 - 2
src/_health/pages/guide_fast.tsx

@@ -4,7 +4,7 @@ import '@/_health/pages/schedules.scss'
 import NewHeader, { NewHeaderType } from "../components/new_header";
 import { useEffect, useState } from "react";
 import { createSchedule, getSchedules } from "@/services/health";
-import { setSchedules } from "@/store/health";
+import { setFooter, setSchedules } from "@/store/health";
 import { useDispatch, useSelector } from "react-redux";
 import Card from "../components/card";
 import { rpxToPx } from "@/utils/tools";
@@ -25,12 +25,13 @@ export default function GuideFast() {
 
     const [selItem, setSelItem] = useState<any>(null)
     const [showTimePicker, setShowTimePicker] = useState(false)
-    const {t} = useTranslation()
+    const { t } = useTranslation()
     const dispatch = useDispatch()
     const selMode = 'FAST'
     useEffect(() => {
         getSchedules({ window: '', sort_by: 'EVENT' }).then(res => {
             dispatch(setSchedules((res as any).data))
+            dispatch(setFooter((res as any).footer))
             setLoaded(true)
             setTimeout(() => {
                 setHighlight(false)
@@ -79,6 +80,7 @@ export default function GuideFast() {
             op_page: 'SCHEDULE_WALKTHROUGH_1', sort_by: 'EVENT'
         }).then(res => {
             dispatch(setSchedules((res as any).schedules))
+            dispatch(setFooter((res as any).footer))
             if ((res as any).result) {
                 setErrors([])
             }
@@ -88,6 +90,20 @@ export default function GuideFast() {
         })
     }
 
+    function footerTitle() {
+        if (health.footer) {
+            return health.footer.fast.title
+        }
+        return ''
+    }
+
+    function footerDesc() {
+        if (health.footer) {
+            return health.footer.fast.description
+        }
+        return ''
+    }
+
     function items() {
         var items = health.schedules.filter(item => item.window == 'FAST')
         return <Card>
@@ -105,6 +121,7 @@ export default function GuideFast() {
                         showLine={i < items.length - 1}
                         errors={errors}
                         selMode={selMode}
+                        days={obj.plus_days != 0 ? obj.plus_days : null}
                         // days="+1 day"
                         onChange={(time) => {
                             var array = JSON.parse(JSON.stringify(health.schedules))
@@ -129,6 +146,8 @@ export default function GuideFast() {
         {
             items()
         }
+        <View className="cell_footer_title bold h24" style={{ color: MainColorType.g02 }}>{footerTitle()}</View>
+        <View className="cell_footer_desc h24" style={{ color: MainColorType.g02 }}>{footerDesc()}</View>
         <View style={{ flex: 1 }} />
         <View className="main_footer">
             <NewButton

+ 11 - 1
src/_health/pages/guide_full.tsx

@@ -40,11 +40,19 @@ export default function GuideFull() {
                 current_window:(res as any).current_window
             }
             jumpPage('./post_result?type=schedule&data='+JSON.stringify(data))
+            global.refreshWindow()
         })
         
         
     }
 
+    function footerDesc() {
+        if (health.footer) {
+            return health.footer.summary.description
+        }
+        return ''
+    }
+
     function items() {
         
 
@@ -72,7 +80,9 @@ export default function GuideFull() {
         {
             items()
         }
-        <View style={{ flex: 1 }} />
+        <View className="cell_footer_desc h24" style={{ color: MainColorType.g02 }}>{footerDesc()}</View>
+        <View style={{height:300,flexShrink:0}}/>
+        <View style={{flex:1}}/>
         <View className="main_footer">
             <NewButton
                 type={NewButtonType.fill}

+ 22 - 5
src/_health/pages/guide_sleep.tsx

@@ -21,8 +21,8 @@ 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 {t} = useTranslation()
+    const [list, setList] = useState<any>(health.schedules)
+    const { t } = useTranslation()
     const dispatch = useDispatch()
     const selMode = 'SLEEP'
     useEffect(() => {
@@ -38,7 +38,7 @@ export default function GuideSleep() {
             return_all: true,
             op_page: 'SCHEDULE_WALKTHROUGH_2', sort_by: 'EVENT'
         }).then(res => {
-            
+
             if ((res as any).result) {
                 dispatch(setSchedules((res as any).schedules))
                 setErrors([])
@@ -53,13 +53,27 @@ export default function GuideSleep() {
         })
     }
 
-    function isDisable(obj){
-        if (obj.window=='FAST' && !obj.is_conflict){
+    function isDisable(obj) {
+        if (obj.window == 'FAST' && !obj.is_conflict) {
             return true
         }
         return false
     }
 
+    function footerTitle() {
+        if (health.footer) {
+            return health.footer.sleep.title
+        }
+        return ''
+    }
+
+    function footerDesc() {
+        if (health.footer) {
+            return health.footer.sleep.description
+        }
+        return ''
+    }
+
     function items() {
         var items = list.filter(item => item.window == 'FAST' || item.window == 'SLEEP')
         return <Card>
@@ -79,6 +93,7 @@ export default function GuideSleep() {
                         selMode={selMode}
                         disable={isDisable(obj)}
                         gray={isDisable(obj)}
+                        days={obj.plus_days != 0 ? obj.plus_days : null}
                         onChange={(time) => {
                             var array = JSON.parse(JSON.stringify(list))
                             array.map(item => {
@@ -101,6 +116,8 @@ export default function GuideSleep() {
         {
             items()
         }
+        <View className="cell_footer_title bold h24" style={{ color: MainColorType.g02 }}>{footerTitle()}</View>
+        <View className="cell_footer_desc h24" style={{ color: MainColorType.g02 }}>{footerDesc()}</View>
         <View style={{ flex: 1 }} />
         <View className="main_footer">
             <NewButton

+ 21 - 16
src/_health/pages/long_fast.tsx

@@ -19,6 +19,7 @@ import showActionSheet from "@/components/basic/ActionSheet";
 import NewModal from "../base/new_modal";
 import NewDurationPicker, { DurationPickerType } from "../base/new_durationpicker";
 import Taro from "@tarojs/taro";
+import { useTranslation } from "react-i18next";
 
 let useActionSheet;
 if (process.env.TARO_ENV == 'rn') {
@@ -31,6 +32,7 @@ export default function LongFast() {
     const [count, setCount] = useState(1)
     const [editDuration, setEditDuration] = useState(false)
     const [duration, setDuration] = useState(0)
+    const { t } = useTranslation()
     let showActionSheetWithOptions;
     if (process.env.TARO_ENV == 'rn') {
         showActionSheetWithOptions = useActionSheet()
@@ -109,12 +111,12 @@ export default function LongFast() {
     }
 
     function tapMore() {
-        var listItems = ['编辑目标', '删除记录']
+        var listItems = ['编辑目标', t('health.delete_current_record')]
         if (long_fast.status == 'OG') {
-            listItems.push('结束断食')
+            listItems.push(t('health.edit_fast_goal'))
         }
         showActionSheet({
-            title: '选择操作',
+            title: t('health.more_actions'),
             showActionSheetWithOptions: showActionSheetWithOptions,
             itemList: listItems,
             success: (res) => {
@@ -148,8 +150,8 @@ export default function LongFast() {
         })
     }
 
-    function save(warn_code=null) {
-        var params:any = {
+    function save(warn_code = null) {
+        var params: any = {
             check_items: [{
                 schedule_id: long_fast.timeline[1].schedule_id,
                 date: dayjs().format('YYYYMMDD'),
@@ -160,7 +162,7 @@ export default function LongFast() {
                 }
             }]
         }
-        if (warn_code){
+        if (warn_code) {
             params.save_confirm = warn_code
         }
 
@@ -282,7 +284,7 @@ export default function LongFast() {
             long_fast.status == 'OG' && <Text onClick={tapMore}>More</Text>
         } */}
 
-        <View className="long_fast_footer" style={{backgroundColor:'transparent',marginBottom:-rpxToPx(35)}}>
+        <View className="long_fast_footer" style={{ backgroundColor: 'transparent', marginBottom: -rpxToPx(35) }}>
             <View style={{ width: rpxToPx(316), height: rpxToPx(128), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                 <NewButton
                     type={NewButtonType.link}
@@ -291,15 +293,18 @@ export default function LongFast() {
                 >
                 </NewButton>
             </View>
-            <NewButton
-                btnStyle={{
-                    position: 'absolute',
-                    top: rpxToPx(42),
-                    right: rpxToPx(26)
-                }}
-                type={NewButtonType.more}
-                onClick={tapMore}
-            />
+            {
+                long_fast.status == 'OG' && <NewButton
+                    btnStyle={{
+                        position: 'absolute',
+                        top: rpxToPx(42),
+                        right: rpxToPx(26)
+                    }}
+                    type={NewButtonType.more}
+                    onClick={tapMore}
+                />
+            }
+
 
         </View>
 

+ 17 - 1
src/_health/pages/move.tsx

@@ -18,6 +18,7 @@ import NewHeader, { NewHeaderType } from "../components/new_header";
 import NewButton, { NewButtonType } from "../base/new_button";
 import { MainColorType } from "@/context/themes/color";
 import StatusIndicator, { StatusType } from "../base/status_indicator";
+import showActionSheet from "@/components/basic/ActionSheet";
 
 let timer
 export default function Move() {
@@ -34,6 +35,7 @@ export default function Move() {
     const [moreActive, setMoreActive] = useState(false)
     const [hours, setHours] = useState<any>([])
     const [startDate, setStarteDate] = useState('')
+    let navigation, showActionSheetWithOptions;
     const { t } = useTranslation()
     const dispatch = useDispatch()
 
@@ -587,6 +589,20 @@ export default function Move() {
         return `Upcoming (${data.hours.length - hours.length > 0 ? data.hours.length - hours.length : ''})`
     }
 
+    function showMore(){
+        showActionSheet({
+            showActionSheetWithOptions: showActionSheetWithOptions,
+            title: t('health.more_actions'),
+            itemList: [t('health.change_step_goal')],
+            success: (res) => {
+                if (res==0){
+                    jumpPage('./move_setting_time')
+                }
+            }
+        });
+        
+    }
+
     function tools() {
         return <View className="tools">
             <View style={{ width: rpxToPx(74) }} />
@@ -599,7 +615,7 @@ export default function Move() {
                 <Image className="calendar" src={require('@assets/_health/calendar.png')} />
             </NewButton>
             <NewButton type={NewButtonType.more} onClick={() => {
-                jumpPage('./move_setting_time')
+                showMore()
             }} />
         </View>
     }

+ 17 - 6
src/_health/pages/schedules.tsx

@@ -19,6 +19,8 @@ import StatusIndicator, { StatusType } from "../base/status_indicator";
 import { MainColorType } from "@/context/themes/color";
 import { AtSwipeAction } from "taro-ui"
 import ScheduleItem from "../components/schedule_item";
+import { useTranslation } from "react-i18next";
+import NewHeader, { NewHeaderType } from "../components/new_header";
 
 let useRoute;
 let useNavigation;
@@ -54,7 +56,8 @@ export default function Schedules() {
     const [highlight, setHighlight] = useState(true)
     const [tempArray, setTempArray] = useState<any>([])
     const [btnEnable, setBtnEnable] = useState(true)
-    const [selMode,setSleMode] = useState(router.params.mode);
+    const [selMode, setSleMode] = useState(router.params.mode);
+    const {t} = useTranslation()
 
     useEffect(() => {
         if (selMode == '' && router.params.schedules) {
@@ -206,10 +209,10 @@ export default function Schedules() {
                 }
                 if (selMode != '' && showMore) {
                     showAlert({
-                        title: '日程冲突',
-                        content: '我们在您的当前日程和另一个日程之间发现了个或多个时间冲突。',
+                        title: t('health.schedule_conflict'),
+                        content: t('health.conflict_desc'),
                         showCancel: false,
-                        confirmText: '查看冲突',
+                        confirmText: t('health.check_conflict'),
                         confirm: () => {
                             setSleMode('')
                             // jumpPage(`./schedules?mode=&schedules=${JSON.stringify((res as any).schedules)}&errors=${JSON.stringify((res as any).error_messages)}`)
@@ -325,7 +328,7 @@ export default function Schedules() {
 
     return <View>
         <View style={{ display: 'flex', flexDirection: 'column' }}>
-            <View className='schedule_header_title'>{getTitle()}</View>
+            <NewHeader type={NewHeaderType.left} title={getTitle()}/>
 
             <Card>
                 {
@@ -474,7 +477,15 @@ export default function Schedules() {
                 </View></Card>
             }
 
-            <View className="main_footer" style={{ backgroundColor: 'transparent' }}>
+            <View style={{
+                backgroundColor: 'transparent',
+                position: 'relative',
+                display:'flex',
+                alignItems:'center',
+                justifyContent:'center',
+                height: rpxToPx(128),
+                width: rpxToPx(750)
+            }}>
                 {
                     selMode != '' && <View style={{ width: rpxToPx(316), height: rpxToPx(128), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                         <NewButton

+ 0 - 0
src/_health/pages/schedules_conflict.config.ts


+ 0 - 113
src/_health/pages/schedules_conflict.scss

@@ -1,113 +0,0 @@
-.title {
-    color: #000;
-    margin-top: 24px;
-    margin-left: 52px;
-    font-size: 50px;
-    line-height: 60px;
-    font-weight: bold;
-}
-
-.sub_title {
-    margin-top: 16px;
-    color: #999999;
-    margin-left: 52px;
-    font-size: 30px;
-    line-height: 48px;
-    font-weight: bold;
-    margin-bottom: 24px;
-}
-
-.conflict_item {
-    height: 128px;
-    background-color: #fff;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    padding-left: 40px;
-    padding-right: 40px;
-    box-sizing: border-box;
-    position: relative;
-}
-
-.conflict_index {
-    width: 48px;
-    height: 42px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    color: #B2B2B2;
-    font-size: 26px;
-    margin-right: 12px;
-}
-
-.conflict_title {
-    color: #000;
-    font-size: 32px;
-    flex: 1;
-}
-
-.conflict_tip {
-    color: #FF0000;
-    font-size: 20px;
-    margin-right: 12px;
-}
-
-.conflict_time {
-    width: 160px;
-    height: 84px;
-    color: #FF0000;
-    background-color: #FF00001A;
-    align-items: center;
-    justify-content: center;
-    display: flex;
-    font-size: 34px;
-    border-radius: 20px;
-}
-
-.normal_time {
-    width: 160px;
-    height: 84px;
-    color: #000;
-    background-color: #B2B2B21A;
-    align-items: center;
-    justify-content: center;
-    display: flex;
-    font-size: 34px;
-    border-radius: 20px;
-}
-
-.edit_footer_btn2 {
-    margin-top: 76px;
-    width: 670px;
-    height: 96px;
-    border-radius: 24px;
-    margin-bottom: 76px;
-    margin-left: 40px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}
-
-.error_tip {
-    height: 72px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    background-color: #FF00001A;
-    padding-left: 42px;
-    box-sizing: border-box;
-    color: #000;
-    font-size: 24px;
-}
-
-.success_tip {
-    height: 72px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    background-color: #00B2181A;
-    padding-left: 42px;
-    box-sizing: border-box;
-    color: #000;
-    font-size: 24px;
-}

+ 0 - 136
src/_health/pages/schedules_conflict.tsx

@@ -1,136 +0,0 @@
-import { View, Text } from "@tarojs/components";
-import './schedules_conflict.scss'
-import { useState } from "react";
-import Taro, { useRouter } from "@tarojs/taro";
-import { rpxToPx } from "@/utils/tools";
-import Modal from "@/components/layout/Modal.weapp";
-import { getThemeColor } from "@/features/health/hooks/health_hooks";
-import TimePicker from "@/features/common/TimePicker";
-import { createSchedule } from "@/services/health";
-import { useSelector } from "react-redux";
-import showAlert from "@/components/basic/Alert";
-
-let useRoute;
-let useNavigation;
-let scenario = '';
-if (process.env.TARO_ENV == 'rn') {
-    useRoute = require("@react-navigation/native").useRoute
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-export default function SchedulesConflict() {
-    let router
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    if (process.env.TARO_ENV == 'rn') {
-        router = useRoute()
-    }
-    else {
-        router = useRouter()
-    }
-
-    const health = useSelector((state: any) => state.health);
-    const [schedules, setSchedules] = useState(JSON.parse(router.params.schedules))
-    const [errors, setErrors] = useState(JSON.parse(router.params.errors))
-    const count = JSON.parse(router.params.schedules).filter(obj => obj.is_all_day == true).length
-    const [showTimePicker, setShowTimePicker] = useState(false)
-    const [selItem, setSelItem] = useState<any>(null)
-    const [selIndex, setSelIndex] = useState(-1)
-
-    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(schedules))
-                array[selIndex].time = e
-                setSchedules(array)
-                checkData(array)
-                // confirmPickerTime(e)
-            }}
-            cancel={() => {
-                setShowTimePicker(false)
-            }} />
-    }
-
-    function checkData(array) {
-        createSchedule({
-            schedules: array,
-            // only_check: true
-        }).then(res => {
-            setSchedules((res as any).schedules)
-            setErrors((res as any).error_messages?(res as any).error_messages:[])
-            if ((res as any).result) {
-                global.refreshWindow()
-                if (global.refreshSchedules) {
-                    global.refreshSchedules()
-                }
-                if (global.refreshSchedules2) {
-                    global.refreshSchedules2()
-                }
-            }
-            else {
-            }
-        })
-    }
-
-
-
-    return <View style={{ display: 'flex', flex: 1, flexDirection: 'column' }}>
-        <Text className="title">Scheduling Conflict</Text>
-        <Text className="sub_title">Adjust your schedule to resolve</Text>
-        {
-            errors.map((item, index) => {
-                return <View key={index} className='error_tip'>{item}</View>
-            })
-        }
-        {
-            errors.length == 0 && <View className='success_tip'>时间冲突已解决,并保存</View>
-        }
-
-        {
-            schedules.map((item, index) => {
-                if (item.is_all_day) return <View key={index} />
-                return <View className="conflict_item" key={index}>
-                    <Text className="conflict_index">{index + 1 - count}</Text>
-                    <Text className="conflict_title">{item.title}</Text>
-                    {
-                        item.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
-                    }
-                    <View className={item.is_conflict ? 'conflict_time' : 'normal_time'} onClick={() => {
-                        setSelIndex(index)
-                        setSelItem(item)
-                        setShowTimePicker(true)
-                    }}>{item.time}</View>
-                    {
-                        index < schedules.length - 1 && <View className="border_footer_line" style={{ marginLeft: rpxToPx(40) }} />
-                    }
-                </View>
-            })
-        }
-        {/* <View className="edit_footer_btn2" style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={done}>Resolved</View> */}
-        {
-            showTimePicker && <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowTimePicker(false)
-                }}
-                confirm={() => { }}>
-                {
-                    modalContent()
-                }
-            </Modal>
-        }
-    </View>
-}

+ 0 - 83
src/_health/pages/schedules_del.tsx

@@ -1,83 +0,0 @@
-import showAlert from "@/components/basic/Alert";
-import { IconRemove } from "@/components/basic/Icons";
-import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
-import { createSchedule, delSchedules, getSchedules } from "@/services/health";
-import { View, Text } from "@tarojs/components";
-import Taro from "@tarojs/taro";
-import { useEffect, useState } from "react";
-import { useSelector } from "react-redux";
-import './edit.scss'
-
-export default function SchedulesDel() {
-    const health = useSelector((state: any) => state.health);
-    const [scenario, setScenario] = useState(getScenario(health.windows, health.mode))
-    const [showTimePicker, setShowTimePicker] = useState(false)
-    const [list, setList] = useState<any>([])
-    const [selItem, setSelItem] = useState<any>(null)
-    const [ids,setIds] = useState<any>([])
-
-    useEffect(() => {
-        schedules()
-    }, [])
-
-    function schedules() {
-        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
-            if ((res as any).data && (res as any).data.length > 0) {
-                setList((res as any).data)
-            }
-        }).catch(e => {
-
-        })
-    }
-
-    function save() {
-
-
-        delSchedules(ids).then(res => {
-            global.refreshWindow()
-            global.refreshSchedules()
-            if (process.env.TARO_ENV == 'weapp') {
-                Taro.navigateBack()
-            }
-        })
-    }
-
-    function del(index){
-        showAlert({
-            title:'删除',
-            content:'确认删除吗?',
-            showCancel:true,
-            confirm:()=>{
-                var tempList = JSON.parse(JSON.stringify(ids))
-                tempList.push(list[index].id)
-                setIds(tempList)
-
-                var array = JSON.parse(JSON.stringify(list))
-                array.splice(index,1)
-                setList(array)
-            }
-        })
-    }
-
-    if (list.length == 0) return <View />
-
-    return <View>
-        {
-            list.map((item, index) => {
-                return <View className="edit_item_cell" key={index} >
-                    <Text className="cell_index">{index + 1}</Text>
-                    <Text>{item.title}</Text>
-                    <View style={{flex:1}}/>
-                    <View onClick={()=>del(index)}>
-                        <IconRemove width={24} color={getThemeColor(health.mode)} />
-                    </View>
-                    {
-                        index<=list.length-1 && <View className='edit_item_cell_line' />
-                    }
-                    
-                </View>
-            })
-        }
-        <View className="edit_footer_btn" style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={save}>完成</View>
-    </View>
-}

+ 0 - 9
src/_health/pages/schedules_list.config.ts

@@ -1,9 +0,0 @@
-export default definePageConfig({
-    usingComponents:{
-      // 'ec-canvas': '../../lib/ec-canvas/ec-canvas',
-      // 'demo':'../../components/demo'
-    },
-    "navigationBarTitleText":"",
-    "navigationBarBackgroundColor":"#f5f5f5",
-    "disableScroll":true
-  })

+ 0 - 136
src/_health/pages/schedules_list.scss

@@ -1,136 +0,0 @@
-@import "~taro-ui/dist/style/components/swipe-action.scss";
-
-.schedule_list_bg {
-    height: 100vh;
-    display: flex;
-    flex-direction: column;
-}
-
-.container {
-    display: flex;
-    flex-direction: column;
-    flex: 1;
-}
-
-.schedule_item {
-    padding-left: 40px;
-    padding-right: 52px;
-    height: 128px;
-    align-items: center;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    position: relative;
-    background-color: #fff;
-}
-
-.item_hover {
-    background-color: #E5E5E5;
-}
-
-.item_left {
-    display: flex;
-    flex-direction: row;
-    flex: 1;
-    align-items: center;
-}
-
-.item_index {
-    color: #B2B2B2;
-    font-size: 26px;
-    width: 36px;
-    height: 42px;
-    margin-right: 24px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-
-}
-
-.item_name {
-    color: #000;
-    font-size: 34px;
-}
-
-.item_time {
-    color: #000;
-    font-size: 34px;
-}
-
-.toolbar {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    margin-top: 20px;
-    margin-bottom: 20px;
-    padding-left: 46px;
-    padding-right: 46px;
-}
-
-.item_add {
-    height: 128px;
-    display: flex;
-    flex-direction: row;
-    background-color: #fff;
-    align-items: center;
-    padding-left: 40px;
-}
-
-.toolbar_btn {
-    color: #FF751A;
-    font-size: 34px;
-    margin-left: 26px;
-}
-
-.notification_icon {
-    width: 34px;
-    height: 34px;
-    margin-right: 12px;
-}
-
-.schedule_header_title {
-    margin-left: 40px;
-    font-weight: bold;
-    font-size: 50px;
-    color: #000;
-    margin-bottom: 40px;
-    margin-top: 22px;
-}
-
-.cell_hover {
-    background-color: #E5E5E5;
-}
-
-.section_title {
-    margin-left: 40px;
-    margin-bottom: 22px;
-    color: #B2B2B2;
-    font-size: 24px;
-    font-weight: bold;
-}
-
-.schedule_set_tabbar {
-    height: 100px;
-    display: flex;
-    flex-direction: row;
-    background-color: #fff;
-}
-
-.schedule_tab_nor {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    flex: 1;
-    font-size: 28px;
-    color: #00000099;
-}
-
-.schedule_tab_sel {
-    color: #000;
-    flex: 1;
-    font-size: 30px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    border-bottom: solid 2px #000;
-}

+ 0 - 311
src/_health/pages/schedules_list.tsx

@@ -1,311 +0,0 @@
-import { View, Text, Image, ScrollView } from '@tarojs/components'
-import './schedules_list.scss'
-import './edit.scss'
-import { useEffect, useState } from 'react'
-import Modal from '@/components/layout/Modal.weapp'
-import AddLabel from '../components/add_label'
-import { delSchedule, getLabelsEvent, getSchedules } from '@/services/health'
-import { AtSwipeAction } from "taro-ui"
-import { useSelector } from 'react-redux'
-import { getThemeColor } from '@/features/health/hooks/health_hooks'
-import showActionSheet from '@/components/basic/ActionSheet'
-import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
-import { IconAdd } from '@/components/basic/Icons'
-import { rpxToPx } from '@/utils/tools'
-import { useRouter } from '@tarojs/taro'
-import Taro from '@tarojs/taro'
-import showAlert from '@/components/basic/Alert'
-
-let useRoute;
-let useNavigation;
-let scenario = '';
-if (process.env.TARO_ENV == 'rn') {
-    useRoute = require("@react-navigation/native").useRoute
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-export default function SchedulesList() {
-    let navigation, showActionSheetWithOptions;
-
-    let router
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    if (process.env.TARO_ENV == 'rn') {
-        router = useRoute()
-    }
-    else {
-        router = useRouter()
-    }
-
-    const selMode = router.params.mode;
-    const [showModal, setShowModal] = useState(false)
-    const [list, setList] = useState<any>([])
-    const [labels, setLabels] = useState<any>([])
-    const [showDel, setShowDel] = useState(false)
-    const [selTab, setSelTab] = useState(0)
-    const health = useSelector((state: any) => state.health);
-
-
-
-
-    useEffect(() => {
-        console.log(selMode)
-        if (!selMode || selMode == '') {
-            console.log('oppppp')
-            Taro.setNavigationBarColor({
-                frontColor: '#000000',
-                backgroundColor: '#ffffff'
-            })
-        }
-        schedules()
-    }, [])
-
-    global.refreshSchedules2 = () => {
-        schedules()
-    }
-
-    function schedules() {
-        let windows = ''
-        switch (selMode) {
-            case 'FAST':
-                windows = 'FAST,EAT';
-                break
-            case 'EAT':
-                windows = 'EAT,FAST';
-                break
-            case 'SLEEP':
-                windows = 'SLEEP,ACTIVE';
-                break
-            case 'ACTIVE':
-                windows = 'ACTIVE,SLEEP';
-                break
-            case 'DAY':
-                windows = 'DAY,NIGHT';
-                break
-            case 'NIGHT':
-                windows = 'NIGHT,DAY';
-                break
-        }
-        getSchedules({ window: windows }).then(res => {
-            if ((res as any).data && (res as any).data.length > 0) {
-                // setList((res as any).data)
-
-                let grouped: any = {};
-                (res as any).data.forEach(item => {
-                    const window = item.window;
-
-                    if (!grouped[window]) {
-                        grouped[window] = { window: window, list: [] };
-                    }
-                    grouped[window].list.push(item);
-                });
-                var array = Object.values(grouped)
-                array.map((dt: any) => {
-                    if (dt.window == 'EAT' || dt.window == 'ACTIVE') {
-                        dt.list.push({
-                            add: true
-                        })
-                    }
-                })
-                setList(array)
-            }
-        }).catch(e => {
-
-        })
-
-        getLabelsEvent({ window: health.mode }).then(res => {
-            setLabels((res as any).labels)
-        })
-    }
-
-    function add(item) {
-        if (item.list.length==5){
-            // Taro.showToast({
-            //     title:'最多添加4个',
-            //     icon:'none'
-            // })
-
-            showAlert({
-                title:'会员',
-                content:'会员desc',
-                showCancel:true,
-                confirm:()=>{
-                    jumpPage('/pages/store/product_list', 'ProductList', navigation)
-                }
-            })
-
-            
-            return;
-        }
-        setShowModal(true)
-    }
-
-    function delItem(index) {
-        delSchedule(list[index].id).then(res => {
-            schedules()
-            global.refreshWindow()
-            global.refreshHistory()
-        })
-    }
-
-    function tapEdit() {
-        jumpPage('./schedules_edit?mode='+selMode)
-        return;
-        let array: any = []
-        switch (health.mode) {
-            case 'DAY':
-            case 'NIGHT':
-                array = ['设置提醒']
-                break
-            case 'FAST':
-            case 'SLEEP':
-                array = ['调整时间', '设置提醒']
-                break;
-            case 'EAT':
-            case 'ACTIVE':
-                array = ['调整时间', '设置提醒', '编辑标记', '删除']
-                break;
-
-        }
-        showActionSheet({
-            showActionSheetWithOptions: showActionSheetWithOptions,
-            title: 'Oprate Title',
-            itemList: array,
-            success: (res) => {
-                tapActionSheet(res)
-            }
-        })
-    }
-
-    function tapActionSheet(index) {
-        const mode = health.mode;
-        switch (index) {
-            case 0:
-                switch (mode) {
-                    case 'DAY':
-                    case 'NIGHT':
-                        jumpPage('/_health/pages/schedules_reminder')
-                        break;
-                    default:
-                        jumpPage('/_health/pages/schedules_time')
-                        break;
-                }
-                break;
-            case 1:
-                jumpPage('/_health/pages/schedules_reminder')
-                break;
-            case 2:
-                // jumpPage('/_health/pages/schedules_mark')
-                break;
-            case 3:
-                jumpPage('/_health/pages/schedules_del')
-                break;
-        }
-    }
-
-    function getTitle() {
-        switch (selMode) {
-            case 'FAST':
-                return '断食和进食';
-            case 'EAT':
-                return '进食和断食';
-            case 'SLEEP':
-                return '睡眠和活动';
-            case 'ACTIVE':
-                return '活动和睡眠';
-            case 'DAY':
-                return '白天和夜晚';
-            case 'NIGHT':
-                return '夜晚和白天';
-        }
-        return '全部'
-    }
-
-    function sectionTitle(item) {
-        switch (item.window) {
-            case 'FAST':
-                return '断食'
-            case 'EAT':
-                return '进食'
-            case 'SLEEP':
-                return '睡眠'
-            case 'ACTIVE':
-                return '活动'
-            case 'DAY':
-                return '日间'
-            case 'NIGHT':
-                return '夜间'
-        }
-    }
-
-    return <View className='schedule_list_bg'>
-        {
-            selMode == '' && <View className='schedule_set_tabbar'>
-                <View onClick={()=>setSelTab(0)} className={selTab==0?'schedule_tab_sel':'schedule_tab_nor'}>按场景</View>
-                <View onClick={()=>setSelTab(1)} className={selTab==1?'schedule_tab_sel':'schedule_tab_nor'}>按时间</View>
-            </View>
-        }
-        <ScrollView enableFlex style={{ height: Taro.getSystemInfoSync().screenHeight - 220 - (selMode == '' ? rpxToPx(100) : 0) }} scrollY>
-            <View style={{ display: 'flex', flexDirection: 'column' }}>
-                <View className='schedule_header_title'>{getTitle()}</View>
-                {
-                    list.map((item, index) => {
-                        return <View key={index} style={{ display: 'flex', flexDirection: 'column', marginBottom: rpxToPx(36) }}>
-                            <Text className='section_title'>{sectionTitle(item)}</Text>
-                            {
-                                item.list.map((obj, i) => {
-                                    if (obj.add) {
-                                        return <View key={i * 100} className='item_add'
-                                            // hoverClass='cell_hover'
-                                            // hoverStayTime={50}
-                                            onClick={()=>add(item)}>
-                                            <IconAdd color={item.list.length==5?'gray':getThemeColor(item.window)} width={rpxToPx(34)} />
-                                            <View className='toolbar_btn' style={{ color: item.list.length==5?'gray':getThemeColor(item.window) }} >添加</View>
-                                            <View style={{ flex: 1 }} />
-                                            {/* <View className='toolbar_btn' style={{ color: getThemeColor(health.mode) }} onClick={() => setShowDel(!showDel)}>移除</View> */}
-                                        </View>
-                                    }
-
-                                    return <View className='schedule_item' key={i * 100} hoverClass='cell_hover' hoverStayTime={50} onClick={() => {
-
-                                    }}>
-
-                                        <View className='item_left'>
-                                            <Text className='item_index'>{i + 1}</Text>
-
-
-                                            <Text className='item_name'>{obj.title}</Text>
-                                        </View>
-                                        <View style={{ flex: 1 }} />
-                                        {
-                                            !obj.is_all_day&&!obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
-                                        }
-
-                                        <Text className='item_time'>{obj.time_label?obj.time_label:obj.time}</Text>
-                                        {
-                                            i < item.list.length - 1 && <View className='border_footer_line' />
-                                        }
-
-                                    </View>
-                                })
-                            }
-                        </View>
-                    })
-                }
-            </View>
-        </ScrollView>
-
-        <View className="edit_footer_btn" style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={tapEdit}>批量编辑</View>
-
-        {
-            showModal && <Modal testInfo={null}
-                dismiss={() => {
-                    setShowModal(false)
-                }}
-                confirm={() => { }}>
-                <AddLabel labels={labels} disMiss={()=>setShowModal(false)}/>
-            </Modal>
-        }
-    </View>
-}

+ 0 - 75
src/_health/pages/schedules_reminder.tsx

@@ -1,75 +0,0 @@
-import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
-import { createSchedule, getSchedules } from "@/services/health";
-import { View, Text, Switch } from "@tarojs/components";
-import Taro from "@tarojs/taro";
-import { useEffect, useState } from "react";
-import { useSelector } from "react-redux";
-import './edit.scss'
-
-export default function SchedulesReminder() {
-    const health = useSelector((state: any) => state.health);
-    const [scenario, setScenario] = useState(getScenario(health.windows, health.mode))
-    const [showTimePicker, setShowTimePicker] = useState(false)
-    const [list, setList] = useState<any>([])
-    const [selItem, setSelItem] = useState<any>(null)
-
-    useEffect(() => {
-        schedules()
-    }, [])
-
-    function schedules() {
-        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
-            if ((res as any).data && (res as any).data.length > 0) {
-                setList((res as any).data)
-            }
-        }).catch(e => {
-
-        })
-    }
-
-    function save() {
-        var array:any = []
-        list.map((item)=>{
-            array.push({
-                id:item.id,
-                time:item.time,
-                event:item.event,
-                title:item.title,
-                reminder:item.reminder
-            })
-        })
-
-        createSchedule({
-
-            schedules: array
-        }).then(res => {
-            global.refreshWindow()
-            global.refreshSchedules()
-            if (process.env.TARO_ENV == 'weapp') {
-                Taro.navigateBack()
-            }
-        })
-    }
-
-    if (list.length == 0) return <View />
-
-    return <View>
-        {
-            list.map((item, index) => {
-                return <View className="edit_item_cell" key={index} >
-                    <Text className="cell_index">{index + 1}</Text>
-                    <Text>{item.title}</Text>
-                    <View style={{flex:1}}/>
-                    <Switch checked={item.reminder} onChange={(e)=>{
-                        item.reminder = e.detail.value
-                        setList([...list])
-                    }}/>
-                    {
-                        index<=list.length-1 && <View className='edit_item_cell_line' />
-                    }
-                </View>
-            })
-        }
-        <View className="edit_footer_btn" style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={save}>完成</View>
-    </View>
-}

+ 0 - 114
src/_health/pages/schedules_time.tsx

@@ -1,114 +0,0 @@
-import Modal from "@/components/layout/Modal.weapp";
-import TimePicker from "@/features/common/TimePicker";
-import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
-import { createSchedule, getSchedules } from "@/services/health";
-import { View, Text } from "@tarojs/components";
-import Taro from "@tarojs/taro";
-import { useEffect, useState } from "react";
-import { useSelector } from "react-redux";
-import './edit.scss'
-
-export default function SchedulesTime() {
-    const health = useSelector((state: any) => state.health);
-    const [scenario, setScenario] = useState(getScenario(health.windows, health.mode))
-    const [showTimePicker, setShowTimePicker] = useState(false)
-    const [list, setList] = useState<any>([])
-    const [selItem, setSelItem] = useState<any>(null)
-
-    useEffect(() => {
-        schedules()
-    }, [])
-
-    function schedules() {
-        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
-            if ((res as any).data && (res as any).data.length > 0) {
-                setList((res as any).data)
-            }
-        }).catch(e => {
-
-        })
-    }
-
-    function changeTime(item) {
-        setSelItem(item)
-        setShowTimePicker(true)
-    }
-
-    function modalContent() {
-        const strTime = selItem.time
-
-        var title = selItem.title
-        var color = getThemeColor(health.mode)
-
-        return <TimePicker time={strTime}
-            color={color}
-            title={title}
-            confirm={(e) => {
-                confirmPickerTime(e)
-            }}
-            cancel={() => {
-                setShowTimePicker(false)
-            }} />
-    }
-
-    function confirmPickerTime(e) {
-        console.log(e)
-        setShowTimePicker(false)
-        selItem.time = e;
-        setList([...list])
-    }
-
-    function save() {
-        var array: any = []
-        list.map((item) => {
-            array.push({
-                id: item.id,
-                time: item.time,
-                event: item.event,
-                title: item.title
-            })
-        })
-
-        createSchedule({
-
-            schedules: array
-        }).then(res => {
-            global.refreshWindow()
-            global.refreshSchedules()
-            if (process.env.TARO_ENV == 'weapp') {
-                Taro.navigateBack()
-            }
-        })
-    }
-
-    if (list.length == 0) return <View />
-
-    return <View>
-        {
-            list.map((item, index) => {
-                return <View className="edit_item_cell" key={index} onClick={() => changeTime(item)}>
-                    <Text className="cell_index">{index + 1}</Text>
-                    <Text>{item.title}</Text>
-                    <View style={{flex:1}}/>
-                    <Text>{item.time}</Text>
-                    {
-                        index <= list.length - 1 && <View className='edit_item_cell_line' />
-                    }
-                </View>
-            })
-        }
-        <View className="edit_footer_btn" style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={save}>完成</View>
-        {
-            showTimePicker && <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowTimePicker(false)
-                }}
-                confirm={() => { }}>
-                {
-                    modalContent()
-                }
-            </Modal>
-        }
-    </View>
-}

+ 0 - 5
src/app.config.ts

@@ -51,11 +51,6 @@ const appConfig = defineAppConfig({
       pages: [
         'pages/schedules',
         'pages/add_moment',
-        'pages/schedules_list',
-        'pages/schedules_del',
-        'pages/schedules_order',
-        'pages/schedules_reminder',
-        'pages/schedules_conflict',
         'pages/schedules_time',
         'pages/schedules_edit',
         'pages/setting_reminder',

+ 18 - 6
src/app.scss

@@ -507,13 +507,14 @@ page {
     width: 750px;
     align-items: center;
     justify-content: center;
-    margin-bottom: 128px;
-    margin-top: 40px;
+    padding-bottom: 128px;
+    padding-top: 40px;
     position: fixed;
     left: 0;
     right: 0;
     bottom: 0;
-    
+    z-index: 10;
+    background-color: #f5f5f5;
 }
 
 /* #endif */
@@ -524,9 +525,20 @@ page {
     width: 750px;
     align-items: center;
     justify-content: center;
-    margin-bottom: 128px;
-    margin-top: 40px;
+    padding-bottom: 128px;
+    padding-top: 40px;
+    z-index: 10;
+    background-color: #f5f5f5;
+}
+
+/* #endif */
+
+.cell_footer_title {
+    margin-top: 24px;
+    margin-left: 52px;
 
 }
 
-/* #endif */
+.cell_footer_desc {
+    margin-left: 52px;
+}

+ 60 - 13
src/context/locales/en.js

@@ -870,19 +870,66 @@ export default {
         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',
-
+        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',
+        mark_done:'Mark Done',
+        i_know: 'Got it',
+
+        fast: 'Fast',
+        eat: 'Eat',
+        sleep: 'Sleep',
+        active: 'Active',
+        window_day: 'Day',
+        night: 'Night',
+        switch_to:'Switch to {{scenario}}',
+
+        faststreak: 'Faststreak',
+        eatstreak: 'Eatstreak',
+        sleepstreak: 'Sleepstreak',
+        activestreak: 'Activestreak',
+
+        log_fast_streak: 'Log your fast daily to build a streak',
+        log_eat_streak: 'Log your eat daily to build a streak',
+        log_sleep_streak: 'Log your sleep daily to build a streak',
+        log_active_streak: 'Log your active daily to build a streak',
+
+        since_date: 'Since {{date}}',
+        until_date_time: 'Active until {{date}} {{time}}',
+        expire_date_time: 'Expiring {{date}} {{time}}',
+
+        day: 'Day',
+        days: 'Days',
+
+        schedule_conflict: 'Schedule Conflict',
+        conflict_desc: 'We\'ve detected one or more time conflicts between your current schedule and another schedule.',
+        check_conflict: 'View Conflicts',
+
+        today: 'Today',
+
+        finish_setup: 'Finish Schedule Setup',
+        reset_schedule: 'Reset Schedule',
+        edit_schedule:'Edit Schedule',
+        enable_location:'Enable Location',
+        choose_location:'Choose Location',
+        change_location:'Change Location',
+        clear_location:'Clear Location',
+        delete_current_record:'Delete Current Record',
+        edit_fast_goal:'Edit Fast Goal',
+        change_step_goal:'Change Step Goal',
+
+        create_my_active:'Create My Activities',
+
+        sunset_to_sunrise:'Sunset to Sunrise',
+        sunrise_to_sunset:'Sunrise to Sunset',
+        choose_location:'Choose Location',
+        set_to_rise_desc:'To calculate nighttime from Sunset to Sunrise, we need to use your location information.',
+        rise_to_set_desc:'To calculate daytime from Sunrise to Sunset, we need to use your location information.',
+
+        more_actions:'More Actions'
 
     }
 }

+ 61 - 13
src/context/locales/zh.js

@@ -871,19 +871,67 @@ export default {
         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:'活动',
-
+        guide_done_title: '一切就绪!',
+        guide_done_desc: '你的日程已启动',
+        guide_current_scenario: '当前正处于{{scenario}}日程内',
+
+        add_meal: '添加餐次',
+        add_active: '添加活动',
+        mark_done: '标记完成',
+        i_know: '我知道了',
+
+        fast: '断食',
+        eat: '进食',
+        sleep: '睡眠',
+        active: '活跃',
+        window_day: '白天',
+        night: '夜晚',
+        switch_to: '切换到{{scenario}}',
+
+        faststreak: '连续断食记录',
+        eatstreak: '连续进食记录',
+        sleepstreak: '连续睡眠记录',
+        activestreak: '连续活跃记录',
+
+        log_fast_streak: '每天记录断食,解锁连续天数',
+        log_eat_streak: '每天记录进食,解锁连续天数',
+        log_sleep_streak: '每天记录睡眠,解锁连续天数',
+        log_active_streak: '每天记录活跃,解锁连续天数',
+
+        since_date: '{{date}}起生效',
+        until_date_time: '{{date}} {{time}} 失效',
+        expire_date_time: '{{date}} {{time}} 失效',
+
+
+        day: '天',
+        days: '天',
+
+        schedule_conflict: '日程冲突',
+        conflict_desc: '我们在您的当前日程和另一个日程之间发现了一个或多个时间冲突。',
+        check_conflict: '查看冲突',
+
+        today: '今天',
+
+        finish_setup: '完成日程设置',
+        reset_schedule: '重置日程',
+        edit_schedule: '编辑日程',
+        enable_location: 'Enable Location',
+        choose_location: '选择位置',
+        change_location: '更改位置',
+        clear_location: '清除位置',
+        delete_current_record: '删除当前记录',
+        edit_fast_goal:'编辑断食目标',
+        change_step_goal:'更改步数目标',
+
+        create_my_active: '创建我的活动',
+
+        sunset_to_sunrise: '日落到日出',
+        sunrise_to_sunset: '日出到日落',
+        choose_location: '选择位置',
+        set_to_rise_desc: '为计算夜晚时间(日落到日出)需要用到您的位置信息。',
+        rise_to_set_desc: '为计算白天时间(日出到日落)需要用到您的位置信息。',
+
+        more_actions: '更多操作'
 
     }
 }

+ 149 - 349
src/features/health/MainConsole.tsx

@@ -23,6 +23,7 @@ import { clearLocation } from "@/services/user";
 import OnBoard from "@/_health/components/onboard";
 import NewButton, { NewButtonType } from "@/_health/base/new_button";
 import showAlert from "@/components/basic/Alert";
+import { useTranslation } from "react-i18next";
 
 let useNavigation;
 let min = 0
@@ -37,13 +38,10 @@ export default function MainConsole(props: { type: WindowType }) {
     const health = useSelector((state: any) => state.health);
     const user = useSelector((state: any) => state.user);
     const [showPicker, setShowPicker] = useState(false)
-    const [showTimePicker, setShowTimePicker] = useState(false)
     const [durationPicker, setDurationPicker] = useState(false)
-    const [operateType, setOperateType] = useState('')
     const [btnDisable, setBtnDisable] = useState(false)
     const [selItem, setSelItem] = useState<any>(null)
-
-    const limitPickerRef = useRef(null)
+    const { t } = useTranslation()
     const dispatch = useDispatch()
 
     let navigation, showActionSheetWithOptions;
@@ -100,25 +98,13 @@ export default function MainConsole(props: { type: WindowType }) {
         switch (item.action) {
             case 'START':
                 {
-                    // defaultTimestamp = new Date().getTime()
-                    // min = defaultTimestamp - 1 * 24 * 3600 * 1000
-                    // max = defaultTimestamp
 
-                    // setOperateType('startFast')
-                    // setShowTimePicker(true)
 
                     jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}`)
                 }
                 return;
             case 'END':
                 {
-                    // defaultTimestamp = new Date().getTime()
-                    // // defaultTimestamp = e ? new Date().getTime() : logEventTimestamp
-                    // min = defaultTimestamp - 1 * 24 * 3600 * 1000
-                    // max = defaultTimestamp
-                    // setOperateType('endFast')
-                    // setShowTimePicker(true)
-                    console.log(item)
 
                     var sceniaro = getScenario(health.windows, health.mode)
 
@@ -135,12 +121,6 @@ export default function MainConsole(props: { type: WindowType }) {
                             timestamp: new Date().getTime()
                         }]
                     }).then(res => {
-                        // dispatch(setShowActionTip({
-                        //     isShow: true,
-                        //     isCompleted: (selItem.event == 'FAST_END' || selItem.event == 'SLEEP_WAKE_UP')
-                        // }))
-                        // setBtnDisable(false)
-                        // setShowTimePicker(false)
                         Taro.showToast({
                             title: '操作成功',
                             icon: 'success'
@@ -194,7 +174,7 @@ export default function MainConsole(props: { type: WindowType }) {
         if (item.action && item.action != 'NA') {
             if (health.mode == 'FAST' || health.mode == 'SLEEP') {
                 if (item.action == 'POST_MOMENT') {
-                    return <IconArrow width={rpxToPx(34)} color={MainColorType.g03}/>
+                    return <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
                 }
 
             }
@@ -265,7 +245,7 @@ export default function MainConsole(props: { type: WindowType }) {
         if (timeline.real) {
             return <Image style={{ width: rpxToPx(20), height: rpxToPx(20) }} src={require('@assets/_health/checked.png')} />
         }
-        return timeline.reminder?<IconNotification color="#fff" width={rpxToPx(20)}/>:<IconNotificationOff color="#fff" width={rpxToPx(20)}/>
+        return timeline.reminder ? <IconNotification color="#fff" width={rpxToPx(20)} /> : <IconNotificationOff color="#fff" width={rpxToPx(20)} />
     }
 
     function timelineItem(item: any, index: number, count: number) {
@@ -416,210 +396,77 @@ export default function MainConsole(props: { type: WindowType }) {
         })
     }
 
-    function modalContent() {
-        global.set_time = new Date().getTime()
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowTimePicker(false)
-            }}
-            confirm={() => { }}>
-            {
-                timePickerContent()
-            }
-        </Modal>
-    }
-
-    function timePickerContent() {
-        var title, color;
-        switch (selItem.scenario) {
-            case 'FAST':
-                title = selItem.event == 'FAST_END' ? '结束断食' : '开始断食'
-                color = MainColorType.fast
-                break;
-            case 'SLEEP':
-                title = selItem.event == 'SLEEP_WAKE_UP' ? '结束睡眠' : '开始睡眠'
-                color = MainColorType.sleep
-                break
-        }
-
-        var endTimestamp = 0
-        if (selItem.envent == 'FAST_END') {
-            endTimestamp = new Date().getTime()//fastData.target.end_time
-        }
-
-        var duration = 24 * 3600 * 1000//fastData.target.duration
-
-        global.set_time = new Date().getTime()
-
-        return <View className="modal_content">
-            <ConsolePicker ref={limitPickerRef}
-                themeColor={color}
-                title={title}
-                onCancel={() => {
-                    setShowTimePicker(false)
-                }}
-                min={min}
-                max={max}
-                current={defaultTimestamp}
-                duration={duration}
-                endTimestamp={endTimestamp}
-                isFast={true}
-                isEnd={operateType == 'endFast'}
-                isTimeout={false}
-                isLoading={btnDisable}
-                onChange={(e) => {
-                    pickerConfirm(e, null)
-                    global.pauseIndexTimer = false
-                }}
-            />
-        </View>
-    }
-
-    function pickerConfirm(t1: number, event: any) {
-        if (btnDisable) {
-            return
-        }
-        global.scenario = 'FAST'
-        setBtnDisable(true)
-
-        if (selItem.event == 'FAST_END') {
-            const fast = getScenario(health.windows, 'FAST')
-            if (fast.status == 'OG') {
-                if (t1 - fast.real.start_timestamp > 24 * 3600 * 1000) {
-                    showAlert({
-                        title: 'Saving as Long Fast',
-                        content: 'Fasting that lasts more than 24 hours will be saved as Long Fast. ',
-                        showCancel: true,
-                        cancelText: '取消',
-                        confirmText: '保存',
-                        cancel: () => {
-                            setBtnDisable(false)
-                        },
-                        confirm: () => {
-                            save(t1)
-                        }
-                    })
-                }
-                else {
-                    save(t1)
-                    // showAlert({
-                    //     title: 'Saving as Intermittent Fasting',
-                    //     content: 'Fasting that lasts fewer than 24 hours will be saved as Intermittent Fasting.',
-                    //     showCancel: true,
-                    //     cancelText: '取消',
-                    //     confirmText: '保存',
-                    //     cancel: () => {
-                    //         setBtnDisable(false)
-                    //     },
-                    //     confirm: () => {
-                    //         save(t1)
-                    //     }
-                    // })
-                }
-            }
-            return
-        }
-
-        save(t1)
-
-    }
-
     function changeToIF() {
         updateFast({ fast_type: 'IF' }).then(res => {
             global.refreshWindow()
         })
     }
 
-    function save(t1: number) {
-
-
-        var params: any = {
-            schedule_id: selItem.schedule_id,
-            date: dayjs(t1).format('YYYYMMDD'),
-            timestamp: t1,
-            extra: {
-                set_time: global.set_time ? global.set_time : new Date().getTime(),
-                confirm_time: new Date().getTime()
-            }
-        }
-        clockTimes({
-            check_items: [params]
-        }).then(res => {
-            dispatch(setShowActionTip({
-                isShow: true,
-                isCompleted: (selItem.event == 'FAST_END' || selItem.event == 'SLEEP_WAKE_UP')
-            }))
-            setBtnDisable(false)
-            setShowTimePicker(false)
-            global.refreshWindow()
-            global.refreshHistory()
-            jumpPage('/_health/pages/post_result?data=' + JSON.stringify(res))
-        }).catch(e => {
-            setBtnDisable(false)
-        })
-    }
-
-    function more() {
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
+    function actionList() {
         var list: any = []
         switch (health.mode) {
-            case 'DAY':
-            case 'NIGHT':
-                list = ['设置提醒', '设置位置']
-                break;
-            case 'FAST':
-            case 'SLEEP':
+            case 'ACTIVE':
                 {
-                    const obj = getScenario(health.windows, health.mode)
-                    if (obj.window_id) {
-                        // list.push('编辑本次时长')
-                        // if (obj.timeline && obj.timeline[0].moment) {
-                        //     list.push('删除本次记录')
-                        // }
-
-                        list.push('删除本次记录')
+                    if (!health.finish_setup) {
+                        list.push(t('health.finish_setup'))
                     }
-                    list.push('编辑日程列表')
+                    list.push(t('health.add_active'))
+                    list.push(t('health.mark_done'))
 
+                    if (health.finish_setup) {
+                        list.push(t('health.edit_schedule'))
+                    }
                 }
                 break;
             case 'EAT':
                 {
-                    list = [
-                        'Add Snack',
-                        '编辑日程列表',
-                    ]
-
-                    if (getScenario(health.windows, health.mode).window_id) {
-                        list.push('Make done')
+                    if (!health.finish_setup) {
+                        list.push(t('health.finish_setup'))
+                    }
+                    list.push(t('health.add_meal'))
+                    list.push(t('health.mark_done'))
+                    if (health.finish_setup) {
+                        list.push(t('health.edit_schedule'))
                     }
                 }
                 break;
-            case 'ACTIVE':
+            case 'FAST':
+            case 'SLEEP':
                 {
-                    list = [
-                        '记录一次活动',
-                        '编辑日程列表',
-                    ]
-
-                    if (getScenario(health.windows, health.mode).window_id) {
-                        list.push('Make done')
+                    if (!health.finish_setup) {
+                        list.push(t('health.finish_setup'))
+                    }
+                    const obj = getScenario(health.windows, health.mode)
+                    if (obj.window_id) {
+                        list.push(t('health.delete_current_record'))
+                    }
+                    if (health.finish_setup) {
+                        list.push(t('health.edit_schedule'))
                     }
                 }
                 break;
+            case 'DAY':
+            case 'NIGHT':
+                {
+                    list = [t('health.change_location'), t('health.clear_location')]
+                }
+                break;
+        }
+        return list;
+    }
 
+    function more() {
+        if (!user.isLogin) {
+            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            return
         }
 
 
 
         showActionSheet({
             showActionSheetWithOptions: showActionSheetWithOptions,
-            title: 'Oprate Title',
-            itemList: list,
+            title: t('health.more_actions'),
+            itemList: actionList(),
             success: (res) => {
                 tapActionSheet(res)
             }
@@ -627,91 +474,64 @@ export default function MainConsole(props: { type: WindowType }) {
     }
 
     function tapActionSheet(index) {
-        switch (index) {
-            case 0:
-                {
-                    switch (health.mode) {
-                        case 'DAY':
-                        case 'NIGHT':
-                            //var url = `./schedules_edit?type=${res == 0 ? 'reminder' : 'name'}&mode=${selMode}`
-                            jumpPage(`/_health/pages/schedules_edit?type=reminder&mode=${health.mode}`)
-                            // jumpPage('/_health/pages/schedules?mode=' + health.mode)
-                            break;
-                        case 'FAST':
-                        case 'SLEEP':
-                            {
-                                const obj = getScenario(health.windows, health.mode)
-                                if (obj.window_id) {
-                                    //编辑本次时长
-                                    // setDurationPicker(true)
-                                    showAlert({
-                                        title: 'del',
-                                        content: '确认删除此记录?',
-                                        showCancel: true,
-                                        confirm: () => {
-                                            delRecord(obj.window_id).then(res => {
-                                                global.refreshWindow()
-                                            })
-                                        }
-                                    })
-                                }
-                                else {
-                                    jumpPage('/_health/pages/schedules?mode=' + health.mode)
-                                }
-                            }
-                            break;
-                        case 'EAT':
-                            //add snack
-                            jumpPage(`/_health/pages/add_moment?title=加餐&is_temp=${true}`)
-                            break;
-                        case 'ACTIVE':
-                            //记录一次活动
-                            jumpPage(`/_health/pages/add_moment?title=&is_temp=${true}`)
-                            break;
-                    }
-                }
+        var title = actionList()[index]
+        switch (title) {
+            case t('health.finish_setup'):
+                tapGuide();
                 break;
-            case 1:
-                {
-                    switch (health.mode) {
-                        case 'EAT':
-                            jumpPage('/_health/pages/schedules?mode=' + health.mode)
-                            break;
-                        case 'FAST':
-                        case 'SLEEP':
-                            const obj = getScenario(health.windows, health.mode)
-                            if (obj.window_id) {
-                                //del record
-                                jumpPage('/_health/pages/schedules?mode=' + health.mode)
-                                console.log('zzzzzzzzz')
-                            }
-                            else {
-
-                            }
-                            break;
-                        case 'ACTIVE':
-                            jumpPage('/_health/pages/schedules?mode=' + health.mode)
-                            break;
-                        case 'DAY':
-                        case 'NIGHT':
-                            chooseLocation()
-                            break;
-                    }
-                }
+            case t('health.add_active'):
+                jumpPage(`/_health/pages/add_moment?title=&is_temp=${true}`)
+                break;
+            case t('health.add_meal'):
+                jumpPage(`/_health/pages/add_moment?title=加餐&is_temp=${true}`)
                 break;
-            case 2:
+            case t('health.mark_done'):
+                tapMakeDone()
+                break
+            case t('health.edit_schedule'):
+                jumpPage('/_health/pages/schedules?mode=' + health.mode)
+                break
+            case t('health.delete_current_record'):
                 {
-                    switch (health.mode) {
-                        case 'EAT':
-                        case 'ACTIVE':
-                            tapMakeDone()
-                            break;
-                    }
+                    const obj = getScenario(health.windows, health.mode)
+                    showAlert({
+                        title: 'del',
+                        content: '确认删除此记录?',
+                        showCancel: true,
+                        confirm: () => {
+                            delRecord(obj.window_id).then(res => {
+                                global.refreshWindow()
+                            })
+                        }
+                    })
                 }
                 break;
+            case t('health.change_location'):
+                chooseLocation()
+                break
+            case t('health.clear_location'):
+                tapClearLocation()
+                break
         }
     }
 
+    function tapGuide() {
+        jumpPage('/_health/pages/guide_fast')
+        // showAlert({
+        //     title:'设置引导弹窗',
+        //     content:'设置引导描述',
+        //     showCancel:true,
+        //     cancelText:'稍后',
+        //     confirmText:'设置',
+        //     cancel:()=>{
+
+        //     },
+        //     confirm:()=>{
+        //         jumpPage('/_health/pages/guide_fast')
+        //     }
+        // })
+    }
+
     function tapMakeDone() {
         makeDone(getScenario(health.windows, health.mode).window_id).then(res => {
             global.refreshWindow()
@@ -727,20 +547,20 @@ export default function MainConsole(props: { type: WindowType }) {
         switch (health.mode) {
             case 'DAY':
                 list = day.timeline
-                if (day.onboard == false) {
-                    return <OnBoard title='你还没有开启位置授权'
-                        desc="获取准确的日出日落信息需要您开启微信运动授权,点击下方按钮进行授权"
-                        btnTitle="去开启"
+                if (day.extra.choose_location == false) {
+                    return <OnBoard title={t('health.sunrise_to_sunset')}
+                        desc={t('health.rise_to_set_desc')}
+                        btnTitle={t('health.choose_location')}
                         onClick={chooseLocation}
                     />
                 }
                 break;
             case 'NIGHT':
                 list = night.timeline
-                if (night.onboard == false) {
-                    return <OnBoard title='你还没有开启位置授权'
-                        desc='获取准确的日出日落信息需要您开启微信运动授权,点击下方按钮进行授权'
-                        btnTitle="去开启"
+                if (night.extra.choose_location == false) {
+                    return <OnBoard title={t('health.sunset_to_sunrise')}
+                        desc={t('health.set_to_rise_desc')}
+                        btnTitle={t('health.choose_location')}
                         onClick={chooseLocation}
                     />
                 }
@@ -784,17 +604,17 @@ export default function MainConsole(props: { type: WindowType }) {
     function switchText() {
         switch (health.mode) {
             case 'FAST':
-                return 'Switch to Eat'
+                return t('health.switch_to', { scenario: t('health.eat') })
             case 'EAT':
-                return 'Switch to Fast'
+                return t('health.switch_to', { scenario: t('health.fast') })
             case 'DAY':
-                return 'Switch to Night'
+                return t('health.switch_to', { scenario: t('health.night') })
             case 'NIGHT':
-                return 'Switch to Daylight'
+                return t('health.switch_to', { scenario: global.language == 'en' ? 'Daylight' : '白天' })//'Switch to Daylight'
             case 'SLEEP':
-                return 'Switch to Activity'
+                return t('health.switch_to', { scenario: t('health.active') })
             case 'ACTIVE':
-                return 'Switch to Sleep'
+                return t('health.switch_to', { scenario: t('health.sleep') })
 
         }
         return ''
@@ -828,19 +648,6 @@ export default function MainConsole(props: { type: WindowType }) {
         }
     }
 
-    function windowStatus() {
-        var statusType = getWindowStatus(health.windows, health.mode)
-        switch (statusType) {
-            case WindowStatusType.open:
-                return 'New open'
-            case WindowStatusType.process:
-                return 'In process'
-            case WindowStatusType.upcoming:
-                return 'Upcoming'
-        }
-        return ''
-    }
-
     function tapClearLocation() {
         Taro.showModal({
             title: '提示',
@@ -945,29 +752,39 @@ export default function MainConsole(props: { type: WindowType }) {
         return <View className="h26" style={{ color: MainColorType.g01 }}>{status == 'OG' ? 'In progress' : ''}</View>
     }
 
+    function showMoreBtn() {
+        if (health.mode == 'DAY' || health.mode == 'NIGHT') {
+            if (!getScenario(health.windows, health.mode).extra.choose_location) {
+                return false
+            }
+        }
+        return true;
+    }
+
     return <View className="main-console-bg">
         <Image className="main_arrow" src={require('@assets/images/center_arrow.png')} />
         <View className="main_summary">
             {/* <View className="main_summary_status" style={{ color: getThemeColor(health.mode) }}>{windowStatus()}</View> */}
-            <View className="main_summary_time bold" style={{ 
-                marginTop:rpxToPx(14),
-                color: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : '#000' }} >{getCountownTime(health.windows, health.mode)}
+            <View className="main_summary_time bold" style={{
+                marginTop: rpxToPx(14),
+                color: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : '#000'
+            }} >{getCountownTime(health.windows, health.mode)}
                 <View className={timePointClass()}
                     style={{ backgroundColor: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : getThemeColor(health.mode) }} />
             </View>
-            <Text className="main_summary_duration" style={{ color: MainColorType.g01,marginBottom:rpxToPx(30) }}>{getDuration(health.windows, health.mode)}</Text>
+            <Text className="main_summary_duration" style={{ color: MainColorType.g01, marginBottom: rpxToPx(30) }}>{getDuration(health.windows, health.mode)}</Text>
             <View className="border_footer_line" />
         </View>
         <View style={{ backgroundColor: '#fff', width: rpxToPx(750) }}>
             {
                 detail()
             }
-            {
+            {/* {
                 health.mode == 'ACTIVE' && <View onClick={() => {
                     var list = getScenario(health.windows, health.mode).timeline
                     jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
                 }}>测试</View>
-            }
+            } */}
         </View>
         <View className="main_footer2">
             <View style={{ width: rpxToPx(316), height: rpxToPx(128), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
@@ -978,24 +795,18 @@ export default function MainConsole(props: { type: WindowType }) {
                 >
                 </NewButton>
             </View>
-            {/* {
-                (health.mode == 'EAT' || health.mode == 'ACTIVE') && <Text style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={more}>更多</Text>
-            } */}
-            {/* {
-                (health.mode == 'DAY' || health.mode == 'NIGHT') && <Text onClick={chooseLocation}>选择位置</Text>
-            } */}
             {
-                (health.mode == 'DAY' || health.mode == 'NIGHT') && <Text onClick={tapClearLocation}>清除位置</Text>
+                showMoreBtn() && <NewButton
+                    btnStyle={{
+                        position: 'absolute',
+                        top: rpxToPx(42),
+                        right: rpxToPx(40)
+                    }}
+                    type={NewButtonType.more}
+                    onClick={more}
+                />
             }
-            <NewButton
-                btnStyle={{
-                    position: 'absolute',
-                    top: rpxToPx(42),
-                    right: rpxToPx(40)
-                }}
-                type={NewButtonType.more}
-                onClick={more}
-            />
+
 
         </View>
         {
@@ -1010,7 +821,7 @@ export default function MainConsole(props: { type: WindowType }) {
                 }}>
                     <Image className="active_icon" src={require('@assets/_health/walk.png')} />
                     <Text className="active_text">Move More</Text>
-                    <IconArrow width={rpxToPx(34)} color={MainColorType.g03}/>
+                    <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
                 </View>
 
             </View>
@@ -1048,17 +859,17 @@ export default function MainConsole(props: { type: WindowType }) {
                         fastWithSleepStatus()
                     }
                     {
-                        health.fast_with_sleep.status=='OG2_MISALIGNED' && <View style={{
-                            backgroundColor:MainColorType.error,
-                            width:rpxToPx(12),
-                            height:rpxToPx(12),
-                            borderRadius:rpxToPx(6),
-                            marginLeft:rpxToPx(12),
-                            marginRight:rpxToPx(12)
-                        }}/>
+                        health.fast_with_sleep.status == 'OG2_MISALIGNED' && <View style={{
+                            backgroundColor: MainColorType.error,
+                            width: rpxToPx(12),
+                            height: rpxToPx(12),
+                            borderRadius: rpxToPx(6),
+                            marginLeft: rpxToPx(12),
+                            marginRight: rpxToPx(12)
+                        }} />
                     }
-                    <View style={{width:rpxToPx(12)}}/>
-                    <IconArrow width={rpxToPx(34)} color={MainColorType.g03}/>
+                    <View style={{ width: rpxToPx(12) }} />
+                    <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
                     {
                         health.mode == 'FAST' && <View className="border_footer_line" style={{ left: rpxToPx(100) }} />
                     }
@@ -1081,24 +892,13 @@ export default function MainConsole(props: { type: WindowType }) {
                     {
                         longFastStatus()
                     }
-                    <View style={{width:rpxToPx(12)}}/>
-                    <IconArrow width={rpxToPx(34)} color={MainColorType.g03}/>
+                    <View style={{ width: rpxToPx(12) }} />
+                    <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
                 </View>
 
             </View>
         }
-        <View onClick={()=>{
-            if (!user.isLogin) {
-                jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-                return
-            }
-            jumpPage('/_health/pages/guide_fast')
-        }}>Guide</View>
         <View className="circle" />
-
-        {
-            showTimePicker && modalContent()
-        }
         {
             showPicker && timeContent()
         }

+ 3 - 1
src/features/health/MainDayNightCard.tsx

@@ -16,6 +16,7 @@ import { durationArc, isCurrentTimeInRange, startArc } from "./util";
 import { setMode } from "@/store/health";
 import { IconSwitch1, IconSwitch2 } from "@/components/basic/Icons";
 import { getScenario, getWindowStatus } from "./hooks/health_hooks";
+import { useTranslation } from "react-i18next";
 
 export default function MainDayNightCard(props: {
     count: number,
@@ -29,6 +30,7 @@ export default function MainDayNightCard(props: {
     const user = useSelector((state: any) => state.user);
     const health = useSelector((state: any) => state.health);
     const dispatch = useDispatch();
+    const {t} = useTranslation()
 
     useEffect(() => {
         const { day } = health.windows.night_day
@@ -188,7 +190,7 @@ export default function MainDayNightCard(props: {
             {
                 ring()
             }
-            <View className={health.selTab == 0 ? 'window_name window_name_sel' : 'window_name'}>{isDayMode ? 'Day' : 'Night'}</View>
+            <View className={health.selTab == 0 ? 'window_name window_name_sel' : 'window_name'}>{isDayMode ? t('health.window_day') : t('health.night')}</View>
         </View>
     </View>
 }

+ 5 - 3
src/features/health/MainFastEatCard.tsx

@@ -23,6 +23,7 @@ import { durationArc, isCurrentTimeInRange, startArc } from "./util";
 import { setMode } from "@/store/health";
 import { IconSwitch1, IconSwitch2 } from "@/components/basic/Icons";
 import { getDurationArc, getScenario, getStartArc, getWindowStatus } from "./hooks/health_hooks";
+import { useTranslation } from "react-i18next";
 let useNavigation;
 
 let checkNotification;
@@ -64,11 +65,12 @@ export default function MainFastEatCard(props: {
 
 
     const { fast, eat } = health.windows.fast_eat
-    const t = new Date().getTime()
+    const t1 = new Date().getTime()
     const isTempFast = (fast.status == 'WAIT_FOR_END' ||
-        fast.target.start_time <= t && fast.target.end_time >= t) ||
+        fast.target.start_time <= t1 && fast.target.end_time >= t1) ||
         isCurrentTimeInRange(fast.period.start_time, fast.period.end_time)
     const [isFastMode, setIsFastMode] = useState(isTempFast)
+    const {t} = useTranslation()
 
 
     useEffect(() => {
@@ -387,7 +389,7 @@ export default function MainFastEatCard(props: {
             {
                 ring()
             }
-            <View className={health.selTab == 1 ? 'window_name window_name_sel' : 'window_name'}>{isFastMode ? 'Fast' : 'Eat'}</View>
+            <View className={health.selTab == 1 ? 'window_name window_name_sel' : 'window_name'}>{isFastMode ? t('health.fast') : t('health.eat')}</View>
         </View>
         {
             showModal && <Modal dismiss={() => setShowModal(false)}>

+ 3 - 1
src/features/health/MainSleepActiveCard.tsx

@@ -9,6 +9,7 @@ import { WindowStatusType, WindowType } from "@/utils/types";
 import { durationArc, isCurrentTimeInRange, startArc } from "./util";
 import { setMode } from "@/store/health";
 import { getScenario, getWindowStatus } from "./hooks/health_hooks";
+import { useTranslation } from "react-i18next";
 
 export default function MainSleepActiveCard(props: {
     count: any,
@@ -22,6 +23,7 @@ export default function MainSleepActiveCard(props: {
     const user = useSelector((state: any) => state.user);
     const health = useSelector((state: any) => state.health);
     const dispatch = useDispatch()
+    const {t} = useTranslation()
 
 
     useEffect(() => {
@@ -171,7 +173,7 @@ export default function MainSleepActiveCard(props: {
                     ring()
                 }
             </View>
-            <View className={health.selTab == 2 ? 'window_name window_name_sel' : 'window_name'}>{isSleepMode ? 'Sleep' : 'Activity'}</View>
+            <View className={health.selTab == 2 ? 'window_name window_name_sel' : 'window_name'}>{isSleepMode ? t('health.sleep') : t('health.active')}</View>
         </View>
     </View>
 }

+ 4 - 1
src/features/health/MainSwiper.tsx

@@ -10,6 +10,7 @@ import { setMode, setTab } from "@/store/health";
 import { MainColorType } from "@/context/themes/color";
 import { rpxToPx } from "@/utils/tools";
 import dayjs from "dayjs";
+import { useTranslation } from "react-i18next";
 
 
 let scrollPage = 0;
@@ -22,6 +23,8 @@ export default function MainSwiper(props: { count: number, pageChanged: Function
     const [scale0, setScale0] = useState(1.0)
     const [scale1, setScale1] = useState(maxScale)
     const [scale2, setScale2] = useState(maxScale)
+
+    const {t} = useTranslation()
     const dispatch = useDispatch()
 
     useEffect(()=>{
@@ -183,7 +186,7 @@ export default function MainSwiper(props: { count: number, pageChanged: Function
     }
 
     return <View style={{ flexDirection: 'column', display: 'flex', alignItems: 'center' }}>
-        <Text className="today">Today</Text>
+        <Text className="today">{t('health.today')}</Text>
         <Text className="main_date">{global.language == 'en' ? dayjs().format('dddd, MMM D') : dayjs().format('MMMD日, dddd')}</Text>
         {/* <View className="tabs">
             <View className="tab_item" style={{ backgroundColor: current != 0 ? '#B2B2B2' : isDay() ? MainColorType.day : MainColorType.night }} onClick={() => tapScroll(0)}></View>

+ 31 - 7
src/features/health/calendar.tsx

@@ -8,6 +8,7 @@ import { useSelector } from "react-redux";
 import { getThemeColor } from "./hooks/health_hooks";
 import NewButton, { NewButtonType } from "@/_health/base/new_button";
 import { MainColorType } from "@/context/themes/color";
+import { useTranslation } from "react-i18next";
 
 export default function Calendar(props: { year: number, month: number }) {
     const weeks = ['日', '一', '二', '三', '四', '五', '六']
@@ -19,6 +20,7 @@ export default function Calendar(props: { year: number, month: number }) {
     const [month, setMonth] = useState(props.month)
     const [current, setCurrent] = useState<any>(null)
     const [loaded, setLoaded] = useState(false)
+    const { t } = useTranslation()
 
     useEffect(() => {
         loadData()
@@ -151,7 +153,7 @@ export default function Calendar(props: { year: number, month: number }) {
             return 'right_day'
         }
         if (item.full) {
-            if (item.isToday){
+            if (item.isToday) {
                 return 'normal_day'
             }
             return 'full_day'
@@ -167,8 +169,8 @@ export default function Calendar(props: { year: number, month: number }) {
             return 'transparent'
         }
 
-        if (item.isToday){
-            if (item.full){
+        if (item.isToday) {
+            if (item.full) {
                 return 'transparent'
             }
         }
@@ -205,6 +207,14 @@ export default function Calendar(props: { year: number, month: number }) {
         }
     }
 
+    function getYearMonth(){
+        const date = new Date(year, month - 1);
+        if (global.language == 'en'){
+            return dayjs(date.getTime()).format('MMMM YYYY')
+        }
+        return dayjs(date.getTime()).format('YYYY年MMM')
+    }
+
     function content() {
         return <View className="calendar_main2">
             <View className="calendar_header">
@@ -217,7 +227,7 @@ export default function Calendar(props: { year: number, month: number }) {
                 }}>
                     <Image src={require('@assets/_health/pre.png')} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
                 </NewButton>
-                <Text style={{ width: rpxToPx(236), textAlign: 'center', fontSize: rpxToPx(28) }}>{`${year}年${month}月`}</Text>
+                <Text style={{ width: rpxToPx(236), textAlign: 'center', fontSize: rpxToPx(28) }}>{getYearMonth()}</Text>
 
                 <NewButton type={NewButtonType.img} onClick={() => {
                     const date = new Date(year, month + 1); // month - 1 因为月份是从 0 开始
@@ -249,7 +259,7 @@ export default function Calendar(props: { year: number, month: number }) {
                                     !item.full && item.isToday && <View className="today2" />
                                 }
                                 {
-                                    item.full && item.isToday && <View className="fullToday" style={{backgroundColor:getThemeColor(health.mode) + '33'}}>
+                                    item.full && item.isToday && <View className="fullToday" style={{ backgroundColor: getThemeColor(health.mode) + '33' }}>
                                         <View className="today3" />
                                     </View>
                                 }
@@ -265,6 +275,20 @@ export default function Calendar(props: { year: number, month: number }) {
         </View>
     }
 
+    function logTitle() {
+        switch (health.mode) {
+            case 'FAST':
+                return t('health.log_fast_streak')
+            case 'EAT':
+                return t('health.log_eat_streak')
+            case 'SLEEP':
+                return t('health.log_sleep_streak')
+            case 'ACTIVE':
+                return t('health.log_active_streak')
+        }
+        return ''
+    }
+
     function currentContent() {
         return <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(208) }}>
             {
@@ -275,8 +299,8 @@ export default function Calendar(props: { year: number, month: number }) {
                         marginRight: rpxToPx(36)
                     }}>{current ? current.days : '0'}</View>
                     <View style={{ display: 'flex', flexDirection: 'column', }}>
-                        <View className="h44 bold" style={{ color: getThemeColor(health.mode) }}>{current.days == 1 ? 'Day' : 'Days'}</View>
-                        <View className="h24">Log your xxx daily to build a streak</View>
+                        <View className="h44 bold" style={{ color: getThemeColor(health.mode) }}>{current.days == 1 ? t('health.day') : t('health.days')}</View>
+                        <View className="h24">{current.days == 0 ? logTitle() : 'Log your xxx daily to build a streak'}</View>
                         <View className="h20" style={{ color: MainColorType.g02, marginTop: rpxToPx(12) }}>Log your xxx daily to build a streak</View>
                     </View>
                 </View>

+ 4 - 4
src/pages/clock/Clock.tsx

@@ -107,13 +107,13 @@ export default function Clock() {
     function getStreakDesc(){
         switch(health.mode){
             case 'FAST':
-                return 'Faststreak'
+                return t('health.faststreak')
             case 'EAT':
-                return 'Eatstreak'
+                return t('health.eatstreak')
             case 'SLEEP':
-                return 'Sleepstreak'
+                return t('health.sleepstreak')
             case 'ACTIVE':
-                return 'Activestreak'
+                return t('health.activestreak')
         }
         return ''
     }

+ 11 - 6
src/store/health.tsx

@@ -4,7 +4,7 @@ import { createSlice } from "@reduxjs/toolkit";
 interface HealthState {
     windows: any;
     fast_with_sleep: any;
-    long_fast:any;
+    long_fast: any;
     mode: string;
     selTab: number;
     refreshs: any; //刷新数据时间点
@@ -13,12 +13,13 @@ interface HealthState {
     showActionCircadian: boolean;
     isCompleted: boolean;
     schedules: any;
+    footer: any;
 }
 
 const initialState: HealthState = {
     windows: null,
     fast_with_sleep: null,
-    long_fast:null,
+    long_fast: null,
     mode: 'DAY',
     selTab: 0,
     refreshs: [],
@@ -26,7 +27,8 @@ const initialState: HealthState = {
     eatArchived: null,
     showActionCircadian: false,
     isCompleted: false,
-    schedules: []
+    schedules: [],
+    footer: null
 }
 
 const healthSlice = createSlice({
@@ -40,7 +42,7 @@ const healthSlice = createSlice({
         setFastWithSleep(state, action) {
             state.fast_with_sleep = action.payload
         },
-        setLongFast(state,action){
+        setLongFast(state, action) {
             state.long_fast = action.payload
         },
         setMode(state, action) {
@@ -63,8 +65,11 @@ const healthSlice = createSlice({
             state.showActionCircadian = isShow
             state.isCompleted = isCompleted
         },
-        setSchedules(state,action){
+        setSchedules(state, action) {
             state.schedules = action.payload
+        },
+        setFooter(state, action) {
+            state.footer = action.payload
         }
 
     }
@@ -73,5 +78,5 @@ const healthSlice = createSlice({
 
 
 
-export const { setWindows, setMode, setTab, setRefreshs, setTitle, setEatArchived, setShowActionTip, setFastWithSleep,setLongFast,setSchedules } = healthSlice.actions;
+export const { setWindows, setMode, setTab, setRefreshs, setTitle, setEatArchived, setShowActionTip, setFastWithSleep, setLongFast, setSchedules, setFooter } = healthSlice.actions;
 export default healthSlice.reducer;