Leon 1 anno fa
parent
commit
58b16382c7

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

@@ -4,7 +4,7 @@ import '@/_health/pages/schedules.scss'
 import NewHeader, { NewHeaderType } from "../components/new_header";
 import { useEffect, useState } from "react";
 import { createSchedule, delSchedule, getLabelsEvent, 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";
@@ -66,6 +66,8 @@ export default function GuideActive() {
 
             if ((res as any).result) {
                 dispatch(setSchedules((res as any).schedules))
+                dispatch(setFooter((res as any).footer))
+                setList((res as any).schedules)
                 if (tapDone) {
                     jumpPage('./guide_full')
                 }
@@ -73,6 +75,7 @@ export default function GuideActive() {
             }
             else {
                 setList((res as any).schedules)
+                dispatch(setFooter((res as any).footer))
                 setErrors((res as any).error_messages ? (res as any).error_messages : [])
             }
         })

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

@@ -4,7 +4,7 @@ import '@/_health/pages/schedules.scss'
 import NewHeader, { NewHeaderType } from "../components/new_header";
 import { useEffect, useState } from "react";
 import { createSchedule, delSchedule, getLabelsEvent, 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";
@@ -67,6 +67,8 @@ export default function GuideEat() {
 
             if ((res as any).result) {
                 dispatch(setSchedules((res as any).schedules))
+                dispatch(setFooter((res as any).footer))
+                setList((res as any).schedules)
                 setErrors([])
                 if (tapDone) {
                     jumpPage('./guide_active')
@@ -74,6 +76,7 @@ export default function GuideEat() {
             }
             else {
                 setList((res as any).schedules)
+                dispatch(setFooter((res as any).footer))
                 setErrors((res as any).error_messages ? (res as any).error_messages : [])
             }
         })

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

@@ -31,7 +31,8 @@ export default function GuideFull() {
 
     function commit(){
         createSchedule({
-            schedules: health.schedules
+            schedules: health.schedules,
+            op_page:'SCHEDULE_FINISH_SETUP'
             // only_check: true
         }).then(res => {
             const data={

+ 4 - 1
src/_health/pages/guide_sleep.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";
@@ -40,7 +40,9 @@ export default function GuideSleep() {
         }).then(res => {
 
             if ((res as any).result) {
+                setList((res as any).schedules)
                 dispatch(setSchedules((res as any).schedules))
+                dispatch(setFooter((res as any).footer))
                 setErrors([])
                 if (tapDone) {
                     jumpPage('./guide_eat')
@@ -48,6 +50,7 @@ export default function GuideSleep() {
             }
             else {
                 setList((res as any).schedules)
+                dispatch(setFooter((res as any).footer))
                 setErrors((res as any).error_messages ? (res as any).error_messages : [])
             }
         })

+ 70 - 34
src/_health/pages/schedules.tsx

@@ -57,7 +57,7 @@ export default function Schedules() {
     const [tempArray, setTempArray] = useState<any>([])
     const [btnEnable, setBtnEnable] = useState(true)
     const [selMode, setSleMode] = useState(router.params.mode);
-    const {t} = useTranslation()
+    const { t } = useTranslation()
 
     useEffect(() => {
         if (selMode == '' && router.params.schedules) {
@@ -312,15 +312,24 @@ export default function Schedules() {
     }
 
     function more() {
-        var items = ['设置提醒', '个性化名称'];
+        var items: any = ['设置提醒', '个性化名称'];
+        if (errors.length == 0) {
+            items.push(t('health.reset_schedule'))
+        }
         showActionSheet({
             showActionSheetWithOptions: showActionSheetWithOptions,
             title: 'Oprate Title',
             itemList: items,
             success: (res) => {
-                var url = `./schedules_edit?type=${res == 0 ? 'reminder' : 'name'}&mode=${selMode}`
-                console.log(url)
-                jumpPage(url)
+                if (res == 0 || res == 1) {
+                    var url = `./schedules_edit?type=${res == 0 ? 'reminder' : 'name'}&mode=${selMode}`
+                    console.log(url)
+                    jumpPage(url)
+                }
+                else if (res == 2) {
+                    jumpPage('/_health/pages/guide_fast')
+                }
+
             }
         });
     }
@@ -328,7 +337,7 @@ export default function Schedules() {
 
     return <View>
         <View style={{ display: 'flex', flexDirection: 'column' }}>
-            <NewHeader type={NewHeaderType.left} title={getTitle()}/>
+            <NewHeader type={NewHeaderType.left} title={getTitle()} />
 
             <Card>
                 {
@@ -354,6 +363,9 @@ export default function Schedules() {
                         </StatusIndicator>
                     </View>
                 }
+                {
+                    !health.finish_setup && selMode == '' && <View className='success_tip' style={{ backgroundColor: MainColorType.blue + '1A', color: MainColorType.blue }}>You haven't finished setting up your schedule yet!</View>
+                }
                 {
                     list.map((obj, i) => {
                         return <ScheduleItem
@@ -363,6 +375,7 @@ export default function Schedules() {
                             showLine={i < list.length - 1}
                             errors={errors}
                             selMode={selMode}
+                            disable={!health.finish_setup}
                             onChange={time => {
                                 obj.time = time
                                 setSelItem(obj)
@@ -477,35 +490,58 @@ export default function Schedules() {
                 </View></Card>
             }
 
-            <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
-                            type={NewButtonType.link}
-                            title='View Full Schedule'
-                            onClick={showAll}
-                        >
-                        </NewButton>
-                    </View>}
-                <NewButton
-                    btnStyle={{
-                        position: 'absolute',
-                        top: rpxToPx(42),
-                        right: rpxToPx(40)
-                    }}
-                    type={NewButtonType.more}
-                    onClick={more}
-                />
+            {
+                health.finish_setup && <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
+                                type={NewButtonType.link}
+                                title='View Full Schedule'
+                                onClick={showAll}
+                            >
+                            </NewButton>
+                        </View>}
+                    <NewButton
+                        btnStyle={{
+                            position: 'absolute',
+                            top: rpxToPx(42),
+                            right: rpxToPx(40)
+                        }}
+                        type={NewButtonType.more}
+                        onClick={more}
+                    />
+
+                </View>
+            }
+
+
+            <View style={{ height: 300, flexShrink: 0 }} />
+
+            <View style={{ flex: 1 }} />
+            {
+                selMode == '' && !health.finish_setup && <View className="main_footer">
+                    <NewButton
+                        type={NewButtonType.fill}
+                        title={t('health.finish_setup')}
+                        disable={errors.length > 0}
+                        color={MainColorType.blue}
+                        width={rpxToPx(646)}
+                        height={rpxToPx(96)}
+                        onClick={() => {
+                            jumpPage('/_health/pages/guide_fast')
+                        }}
+                    />
+                </View>
+            }
 
-            </View>
 
             {/* <View className="edit_footer_btn" style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={tapEdit}>批量编辑</View> */}
             {

+ 10 - 5
src/_health/pages/streak_calendar.tsx

@@ -9,6 +9,7 @@ import { streaks } from "@/services/health";
 import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
 import NewButton, { NewButtonType } from "../base/new_button";
 import { MainColorType } from "@/context/themes/color";
+import Calendar from "@/features/health/calendar";
 
 
 export default function StreakCalendar() {
@@ -25,7 +26,7 @@ export default function StreakCalendar() {
     const [loaded, setLoaded] = useState(false)
 
     useEffect(() => {
-        loadData()
+        // loadData()
     }, [month, mode])
 
     function loadData() {
@@ -258,8 +259,8 @@ export default function StreakCalendar() {
         </View>
     }
 
-
-    return <View>
+    console.log(mode)
+    return <View style={{display:'flex',flexDirection:'column',height:'100vh'}}>
         <NewHeader type={NewHeaderType.left} title="Calendar" />
         <ScrollView style={{ width: rpxToPx(750), flexDirection: 'row', display: 'flex', height: rpxToPx(72) }} scrollX enableFlex showScrollbar={false}>
             <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
@@ -298,8 +299,12 @@ export default function StreakCalendar() {
             </NewButton>
             <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
         </ScrollView>
-        {
+        <View style={{ flex: 1, backgroundColor: '#fff',marginTop:rpxToPx(36) }}>
+            <Calendar year={year} month={month} mode={mode} />
+        </View>
+
+        {/* {
             content()
-        }
+        } */}
     </View>
 }

+ 0 - 2
src/app.config.ts

@@ -51,9 +51,7 @@ const appConfig = defineAppConfig({
       pages: [
         'pages/schedules',
         'pages/add_moment',
-        'pages/schedules_time',
         'pages/schedules_edit',
-        'pages/setting_reminder',
         'pages/moment_detail',
         'pages/timeline_detail',
         'pages/archive',

+ 25 - 0
src/components/basic/Icons.tsx

@@ -472,4 +472,29 @@ export const IconVip = (props: { width: number, color: string }) => {
         d="M3.49709 8.06467L4.78355 18.9996H19.2266L20.513 8.06467L16.5032 10.7379L12.0051 4.44054L7.50694 10.7379L3.49709 8.06467ZM2.80577 5.20009L7.00505 7.99961L11.1913 2.13884C11.5123 1.68943 12.1369 1.58534 12.5863 1.90635C12.6761 1.97049 12.7546 2.04905 12.8188 2.13884L17.0051 7.99961L21.2043 5.20009C21.6639 4.89374 22.2847 5.01791 22.5911 5.47744C22.7228 5.67506 22.7799 5.91311 22.7522 6.14898L21.109 20.1165C21.0497 20.6201 20.6229 20.9996 20.1158 20.9996H3.8943C3.38722 20.9996 2.9604 20.6201 2.90115 20.1165L1.25792 6.14898C1.19339 5.60048 1.58573 5.10352 2.13423 5.03899C2.37011 5.01124 2.60816 5.06835 2.80577 5.20009ZM12.0051 14.9996C10.9005 14.9996 10.0051 14.1042 10.0051 12.9996C10.0051 11.895 10.9005 10.9996 12.0051 10.9996C13.1096 10.9996 14.0051 11.895 14.0051 12.9996C14.0051 14.1042 13.1096 14.9996 12.0051 14.9996Z"></path>
 </svg>`
     return Icon(props.width, props.width, icon);
+}
+
+export const IconMap = (props: { width: number, color: string }) => {
+    const icon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none"
+    version="1.1" width="36" height="36" viewBox="0 0 36 36">
+    <defs>
+        <clipPath id="master_svg0_1651_39555">
+            <rect x="0" y="0" width="36" height="36" rx="0" />
+        </clipPath>
+    </defs>
+    <g clip-path="url(#master_svg0_1651_39555)">
+        <g transform="matrix(-1,0,0,1,57,0)">
+            <path
+                d="M47.510400000000004,5.95066Q43.9918,2.25,39,2.25Q34.00823,2.25,30.4896,5.95066Q27.0017,9.61901,27,14.7932Q27,21.903,37.91733,33.2882Q37.93911,33.310900000000004,37.96182,33.3327Q38.015010000000004,33.383700000000005,38.07294,33.4292Q38.13087,33.4748,38.19299,33.514399999999995Q38.2551,33.5541,38.32081,33.5874Q38.38651,33.6208,38.45517,33.6475Q38.5238,33.6743,38.5948,33.694199999999995Q38.6657,33.7141,38.7383,33.727000000000004Q38.8108,33.7398,38.884299999999996,33.7455Q38.9578,33.7512,39.0315,33.749700000000004Q39.1051,33.7481,39.1783,33.7394Q39.2515,33.730599999999995,39.3234,33.7147Q39.3954,33.6988,39.4654,33.676Q39.5355,33.653099999999995,39.603,33.6235Q39.6704,33.593900000000005,39.734700000000004,33.5578Q39.7989,33.521699999999996,39.8593,33.4794Q39.9197,33.437200000000004,39.9757,33.3893Q40.0317,33.3414,40.0827,33.2882Q51,21.903,51,14.7927Q50.9983,9.619,47.510400000000004,5.95066ZM32.66372,8.01783Q35.295410000000004,5.25,39,5.25Q42.7046,5.25,45.3363,8.01783Q47.9987,10.81798,48,14.7937Q48,20.3711,39,30.0647Q30,20.3711,30,14.7932Q30.0013,10.81799,32.66372,8.01783Z"
+                fill-rule="evenodd" fill="${props.color}" fill-opacity="1"
+                style="mix-blend-mode:passthrough" />
+        </g>
+        <g transform="matrix(-1,0,0,1,43.5,0)">
+            <ellipse cx="25.5" cy="14.25" rx="3.75" ry="3.75" fill-opacity="0" stroke-opacity="1"
+                stroke="${props.color}" fill="none" stroke-width="3" stroke-linecap="ROUND"
+                stroke-linejoin="round" style="mix-blend-mode:passthrough" />
+        </g>
+    </g>
+</svg>`
+    return Icon(props.width, props.width, icon);
 }

+ 3 - 2
src/context/locales/en.js

@@ -898,8 +898,9 @@ export default {
         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}}',
+        until_date_time: 'Active until tomorrow {{date}} {{time}}',
+        expire_date_time: 'Expiring tonight {{date}} {{time}}',
+        last_expire_date_time:'Last streak expired on {{date}} at {{time}}',
 
         day: 'Day',
         days: 'Days',

+ 3 - 2
src/context/locales/zh.js

@@ -899,8 +899,9 @@ export default {
         log_active_streak: '每天记录活跃,解锁连续天数',
 
         since_date: '{{date}}起生效',
-        until_date_time: '{{date}} {{time}} 失效',
-        expire_date_time: '{{date}} {{time}} 失效',
+        until_date_time: '明天 {{date}} {{time}} 失效',
+        expire_date_time: '今天 {{date}} {{time}} 失效',
+        last_expire_date_time:'上次连续记录 {{date}} {{time}} 失效',
 
 
         day: '天',

+ 1 - 1
src/context/themes/color.tsx

@@ -33,7 +33,7 @@ export enum MainColorType {
     link = '#5c7099',
     error = '#ff0000',
     success = '#00b218',
-    blue = '#0055ff',
+    blue = '#0080ff',
 
     black = '#000000',
     white = '#ffffff',

+ 40 - 3
src/features/health/MainConsole.tsx

@@ -54,6 +54,10 @@ export default function MainConsole(props: { type: WindowType }) {
 
     }, [props.type])
 
+    global.chooseLocation = ()=>{
+        chooseLocation()
+    }
+
     function edit(item) {
         if (item.scenario != 'FAST' && item.scenario != 'SLEEP') {
             return
@@ -465,7 +469,7 @@ export default function MainConsole(props: { type: WindowType }) {
 
         showActionSheet({
             showActionSheetWithOptions: showActionSheetWithOptions,
-            title: t('health.more_actions'),
+            title: (health.mode == 'DAY' || health.mode == 'NIGHT') ? getLocation() : t('health.more_actions'),
             itemList: actionList(),
             success: (res) => {
                 tapActionSheet(res)
@@ -473,6 +477,37 @@ export default function MainConsole(props: { type: WindowType }) {
         });
     }
 
+    function getLocation() {
+        var scenario = getScenario(health.windows, health.mode)
+        if (!scenario.extra.choose_location) {
+            return t('health.more_actions')
+        }
+        return `${getCity()} | ${Math.abs(parseInt(scenario.extra.lat))}°${parseInt(scenario.extra.lat) < 0 ? 'S' : 'N'} ${Math.abs(parseInt(scenario.extra.lng))}°${parseInt(scenario.extra.lng) < 0 ? 'W' : 'E'}`
+    }
+
+    function getCity() {
+        var city = ''
+        var scenario = getScenario(health.windows, health.mode)
+        if (scenario.extra.address) {
+            if (scenario.extra.address.city.length > 0) {
+                city = scenario.extra.address.city
+            }
+            else if (scenario.extra.address.province.length > 0) {
+                city = scenario.extra.address.province
+            }
+            else if (scenario.extra.address.country.length > 0) {
+                city = scenario.extra.address.country
+            }
+            else {
+                city = t('feature.track_time_duration.third_ring.unknown')
+            }
+        }
+        else {
+            city = t('feature.track_time_duration.third_ring.unknown')
+        }
+        return city
+    }
+
     function tapActionSheet(index) {
         var title = actionList()[index]
         switch (title) {
@@ -669,9 +704,11 @@ export default function MainConsole(props: { type: WindowType }) {
             jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
             return
         }
+        var scenario = getScenario(health.windows, health.mode)
+        debugger
         Taro.chooseLocation({
-            // latitude: authInfo && authInfo.lat ? authInfo.lat : undefined,
-            // longitude: authInfo && authInfo.lat ? authInfo.lng : undefined,
+            latitude: scenario.extra.choose_location ? parseFloat(scenario.extra.lat+'') : undefined,
+            longitude: scenario.extra.choose_location ? parseFloat(scenario.extra.lng+'') : undefined,
             success: function (res) {
                 uploadLocation(res)
             },

+ 12 - 0
src/features/health/calendar.scss

@@ -123,6 +123,17 @@
     z-index: 0;
 }
 
+.full_right_today{
+    position: absolute;
+    left: 0;
+    top: 0;
+    bottom: 0;
+    width: 77px;
+    z-index: 0;
+    border-bottom-right-radius: 30px;
+    border-top-right-radius: 30px;
+}
+
 .fullToday {
     height: 60px;
     width: 60px;
@@ -204,4 +215,5 @@
 .streak_days {
     font-size: 96px;
     font-weight: bold;
+    line-height: 108px;
 }

+ 81 - 17
src/features/health/calendar.tsx

@@ -10,7 +10,7 @@ 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 }) {
+export default function Calendar(props: { year: number, month: number,mode:string }) {
     const weeks = ['日', '一', '二', '三', '四', '五', '六']
     const indexBeginWeek = 0;
     const [spaces, setSpaces] = useState<any>([])
@@ -23,8 +23,16 @@ export default function Calendar(props: { year: number, month: number }) {
     const { t } = useTranslation()
 
     useEffect(() => {
+        console.log('------------------')
+        console.log(props.mode)
         loadData()
-    }, [month])
+    }, [month,props.mode])
+
+    // useEffect(()=>{
+    //     setYear(props.year)
+    //     setMonth(props.month)
+    //     // loadData(props.year,props.mo)
+    // },[props.year,props.month,props.mode])
 
     function loadData() {
 
@@ -62,7 +70,7 @@ export default function Calendar(props: { year: number, month: number }) {
 
 
         streaks({
-            window: health.mode,
+            window: props.mode,
             month: year + (month + '').padStart(2, '0')
         }).then(res => {
             const array = (res as any).streaks
@@ -178,7 +186,7 @@ export default function Calendar(props: { year: number, month: number }) {
 
         //     return '#000'
         // }
-        return getThemeColor(health.mode) + '33'
+        return getThemeColor(props.mode) + '33'
     }
 
     function textColor(item) {
@@ -192,7 +200,7 @@ export default function Calendar(props: { year: number, month: number }) {
             return '#ffffff'
         }
         return '#000000'
-        // return getThemeColor(health.mode)
+        // return getThemeColor(props.mode)
     }
 
     function leftSpace(days) {
@@ -207,9 +215,9 @@ export default function Calendar(props: { year: number, month: number }) {
         }
     }
 
-    function getYearMonth(){
+    function getYearMonth() {
         const date = new Date(year, month - 1);
-        if (global.language == 'en'){
+        if (global.language == 'en') {
             return dayjs(date.getTime()).format('MMMM YYYY')
         }
         return dayjs(date.getTime()).format('YYYY年MMM')
@@ -254,12 +262,21 @@ export default function Calendar(props: { year: number, month: number }) {
                     }
                     {
                         days.map((item, index) => {
+                            if (item.isToday && item.right) {
+                                return <View key={index} className="calendar_item" style={{ width: rpxToPx(94), position: 'relative' }}>
+                                    <View className="full_right_today" style={{backgroundColor: getThemeColor(props.mode) + '33'}}/>
+                                    <View className="fullToday">
+                                        <View className="today3"/>
+                                    </View>
+                                    <Text >{item.day}</Text>
+                                </View>
+                            }
                             return <View className={itemClass(item)} style={{ width: rpxToPx(94), backgroundColor: bgColor(item), position: 'relative' }} key={index}>
                                 {
                                     !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(props.mode) + '33' }}>
                                         <View className="today3" />
                                     </View>
                                 }
@@ -276,7 +293,7 @@ export default function Calendar(props: { year: number, month: number }) {
     }
 
     function logTitle() {
-        switch (health.mode) {
+        switch (props.mode) {
             case 'FAST':
                 return t('health.log_fast_streak')
             case 'EAT':
@@ -289,19 +306,66 @@ export default function Calendar(props: { year: number, month: number }) {
         return ''
     }
 
+    function streakTitle() {
+        var year = parseInt((current.start_date + '').substring(0, 4))
+        var month = parseInt((current.start_date + '').substring(4, 6)) - 1
+        var date = parseInt((current.start_date + '').substring(6, 8))
+        var dt = new Date(year, month, date)
+        var format = global.language == 'en' ? 'MMM D' : 'M月D日'
+        return t('health.since_date', { date: dayjs(dt.getTime()).format(format) })
+    }
+
+    function todayExpire() {
+        if (!current.reset) return false
+        var date = new Date(current.reset)
+        if (date.getDate() == new Date().getDate()) {
+            return true;
+        }
+        return false;
+    }
+
+    function streakDesc() {
+        var format = global.language == 'en' ? 'MMM D' : 'M月D日'
+        if (current.days == 0) {
+            if (current.prev_reset) {
+
+                return t('health.last_expire_date_time', {
+                    date: dayjs(current.prev_reset).format(format),
+                    time: dayjs(current.prev_reset).format('HH:mm'),
+                })
+            }
+        }
+        else {
+            if (todayExpire()) {
+                return t('health.expire_date_time', {
+                    date: dayjs(current.reset).format(format),
+                    time: dayjs(current.reset).format('HH:mm'),
+                })
+            }
+            else {
+                return t('health.until_date_time', {
+                    date: dayjs(current.reset).format(format),
+                    time: dayjs(current.reset).format('HH:mm'),
+                })
+            }
+        }
+        return ''
+    }
+
     function currentContent() {
-        return <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(208) }}>
+        return <View style={{ display: 'flex', flexDirection: 'row', height: rpxToPx(208) }}>
             {
-                loaded && <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(208) }}>
+                loaded && <View style={{ display: 'flex', flexDirection: 'row' }}>
                     <View className="streak_days" style={{
-                        color: getThemeColor(health.mode),
+                        color: getThemeColor(props.mode),
                         marginLeft: leftSpace(current ? current.days : 0),
-                        marginRight: rpxToPx(36)
+                        marginRight: rpxToPx(36),
+                        marginTop: rpxToPx(24)
                     }}>{current ? current.days : '0'}</View>
-                    <View style={{ display: 'flex', flexDirection: 'column', }}>
-                        <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 style={{ display: 'flex', flexDirection: 'column', marginTop: rpxToPx(36) }}>
+                        <View className="h44 bold" style={{ color: getThemeColor(props.mode) }}>{current.days == 1 ? t('health.day') : t('health.days')}</View>
+                        <View className="h24">{current.days == 0 ? logTitle() : streakTitle()}</View>
+                        <View className="h20" style={{ color: todayExpire() ? MainColorType.error : MainColorType.g02, marginTop: rpxToPx(12) }}>{streakDesc()}</View>
                     </View>
                 </View>
             }

+ 55 - 11
src/pages/clock/Clock.tsx

@@ -7,7 +7,7 @@ import { useDispatch, useSelector } from "react-redux";
 import { getInfoSuccess } from "@/store/user";
 import { useTranslation } from "react-i18next";
 import { MainColorType } from "@/context/themes/color";
-import { IconStreak } from "@/components/basic/Icons";
+import { IconMap, IconStreak } from "@/components/basic/Icons";
 import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
 import Streak from "@/features/health/Streak";
 import Calendar from "@/features/health/calendar";
@@ -104,8 +104,8 @@ export default function Clock() {
         return scenario.current_streak && scenario.current_streak.days
     }
 
-    function getStreakDesc(){
-        switch(health.mode){
+    function getStreakDesc() {
+        switch (health.mode) {
             case 'FAST':
                 return t('health.faststreak')
             case 'EAT':
@@ -139,14 +139,14 @@ export default function Clock() {
                 }}
                 style={{ height: 44, marginTop: systemInfo.statusBarHeight, }}>
                 <View style={{
-                    zIndex:1,
+                    zIndex: 1,
                     height: rpxToPx(64),
-                    display:'flex',
-                    flexDirection:'row',
-                    alignItems:'center',
-                    backgroundColor:getThemeColor(health.mode),
-                    borderRadius:rpxToPx(64),
-                    paddingRight:rpxToPx(24)
+                    display: 'flex',
+                    flexDirection: 'row',
+                    alignItems: 'center',
+                    backgroundColor: getThemeColor(health.mode),
+                    borderRadius: rpxToPx(64),
+                    paddingRight: rpxToPx(24)
                 }} onClick={() => {
                     setShowCalendar(false)
                 }}>
@@ -172,6 +172,47 @@ export default function Clock() {
         }
     }
 
+    function getCity() {
+        var city = ''
+        var scenario = getScenario(health.windows, health.mode)
+        if (scenario.extra.address) {
+            if (scenario.extra.address.city.length > 0) {
+                city = scenario.extra.address.city
+            }
+            else if (scenario.extra.address.province.length > 0) {
+                city = scenario.extra.address.province
+            }
+            else if (scenario.extra.address.country.length > 0) {
+                city = scenario.extra.address.country
+            }
+            else {
+                city = t('feature.track_time_duration.third_ring.unknown')
+            }
+        }
+        else {
+            city = t('feature.track_time_duration.third_ring.unknown')
+        }
+        return city
+    }
+
+    function locationIcon() {
+        if (!health.windows || !user.isLogin) return null
+        var scenario = getScenario(health.windows, health.mode)
+        if ((health.mode == 'DAY' || health.mode == 'NIGHT') && scenario.extra.address) {
+            return <View className="navi-streak"
+                onClick={()=>{
+                    global.chooseLocation()
+                }}
+                style={{ height: 44, marginTop: systemInfo.statusBarHeight, }}>
+                <View style={{ width: rpxToPx(16) }} />
+                <IconMap color='#000' width={20} />
+                <View style={{ width: rpxToPx(4) }} />
+                <Text className="h34 bold" style={{ color: '#000' }}>{getCity()}</Text>
+            </View>
+        }
+        return null
+    }
+
     if (!loaded)
         return <View />
 
@@ -189,6 +230,9 @@ export default function Clock() {
             {
                 steakIcon()
             }
+            {
+                locationIcon()
+            }
 
             <View style={{
                 position: 'absolute',
@@ -214,7 +258,7 @@ export default function Clock() {
                 confirm={() => { }}>
                 <View style={{ display: 'flex', flexDirection: 'column' }}>
                     <View style={{ height: navigationBarHeight }} />
-                    <Calendar year={2024} month={10} />
+                    <Calendar year={2024} month={10} mode={health.mode}/>
                 </View>
             </Streak>
         }

+ 2 - 2
src/pages/clock/ClockNew.tsx

@@ -12,7 +12,7 @@ import MainHistory from "@/features/health/MainHistory";
 import { WindowType } from "@/utils/types";
 import { getArchived, windows } from "@/services/health";
 import { useDispatch, useSelector } from "react-redux";
-import health, { setEatArchived, setFastWithSleep, setLongFast, setRefreshs, setTitle, setWindows } from "@/store/health";
+import health, { setEatArchived, setFastWithSleep, setFinishSetup, setLongFast, setRefreshs, setTitle, setWindows } from "@/store/health";
 import dayjs from "dayjs";
 import Modal from "@/components/layout/Modal.weapp";
 import Streak from "@/features/health/Streak";
@@ -124,7 +124,7 @@ export default function ClockNew() {
             dispatch(setWindows((res as any).windows))
             dispatch(setLongFast((res as any).long_fast))
             dispatch(setRefreshs((res as any).refresh_timestamps))
-
+            dispatch(setFinishSetup((res as any).finish_setup))
             setIsPulling(false)
         })
         archived()

+ 7 - 2
src/store/health.tsx

@@ -14,6 +14,7 @@ interface HealthState {
     isCompleted: boolean;
     schedules: any;
     footer: any;
+    finish_setup:boolean;
 }
 
 const initialState: HealthState = {
@@ -28,7 +29,8 @@ const initialState: HealthState = {
     showActionCircadian: false,
     isCompleted: false,
     schedules: [],
-    footer: null
+    footer: null,
+    finish_setup:false
 }
 
 const healthSlice = createSlice({
@@ -70,6 +72,9 @@ const healthSlice = createSlice({
         },
         setFooter(state, action) {
             state.footer = action.payload
+        },
+        setFinishSetup(state, action) {
+            state.finish_setup = action.payload
         }
 
     }
@@ -78,5 +83,5 @@ const healthSlice = createSlice({
 
 
 
-export const { setWindows, setMode, setTab, setRefreshs, setTitle, setEatArchived, setShowActionTip, setFastWithSleep, setLongFast, setSchedules, setFooter } = healthSlice.actions;
+export const { setWindows, setMode, setTab, setRefreshs, setTitle, setEatArchived, setShowActionTip, setFastWithSleep, setLongFast, setSchedules, setFooter,setFinishSetup } = healthSlice.actions;
 export default healthSlice.reducer;