|
@@ -56,6 +56,8 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
|
|
|
|
|
const [hideEatArchiveTip, setHideEatArchiveTip] = useState(false)
|
|
const [hideEatArchiveTip, setHideEatArchiveTip] = useState(false)
|
|
|
const [hideActiveArchiveTip, setHideActiveArchiveTip] = useState(false)
|
|
const [hideActiveArchiveTip, setHideActiveArchiveTip] = useState(false)
|
|
|
|
|
+ const [hideFastTip, setHideFastTip] = useState(false)
|
|
|
|
|
+ const [hideSleepTip, setHideSleepTip] = useState(false)
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
|
|
|
|
|
@@ -84,7 +86,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
chooseLocation()
|
|
chooseLocation()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- global.postMementSuccess = () => {
|
|
|
|
|
|
|
+ global.postMomentSuccess = () => {
|
|
|
if (health.mode == 'ACTIVE') {
|
|
if (health.mode == 'ACTIVE') {
|
|
|
setHideActiveArchiveTip(false)
|
|
setHideActiveArchiveTip(false)
|
|
|
global.hideActiveArchiveTip = false
|
|
global.hideActiveArchiveTip = false
|
|
@@ -95,6 +97,16 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ global.postFastBeginSuccess = () => {
|
|
|
|
|
+ setHideFastTip(false)
|
|
|
|
|
+ global.hideFastTip = false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ global.postSleepBeginSuccess = () => {
|
|
|
|
|
+ setHideSleepTip(false)
|
|
|
|
|
+ global.hideSleepTip = false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function edit(item) {
|
|
function edit(item) {
|
|
|
if (item.scenario != 'FAST' && item.scenario != 'SLEEP') {
|
|
if (item.scenario != 'FAST' && item.scenario != 'SLEEP') {
|
|
|
return
|
|
return
|
|
@@ -516,7 +528,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
content: '确认删除此记录?',
|
|
content: '确认删除此记录?',
|
|
|
showCancel: true,
|
|
showCancel: true,
|
|
|
confirm: () => {
|
|
confirm: () => {
|
|
|
- delRecord({ids:[obj.window_id]}).then(res => {
|
|
|
|
|
|
|
+ delRecord({ ids: [obj.window_id] }).then(res => {
|
|
|
global.refreshWindow()
|
|
global.refreshWindow()
|
|
|
|
|
|
|
|
if ((res as any).status_change) {
|
|
if ((res as any).status_change) {
|
|
@@ -656,7 +668,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
showCancel: true,
|
|
showCancel: true,
|
|
|
cancelText: '稍后',
|
|
cancelText: '稍后',
|
|
|
confirmText: '立即设置',
|
|
confirmText: '立即设置',
|
|
|
- cancel:()=>{
|
|
|
|
|
|
|
+ cancel: () => {
|
|
|
global.showIndexAddActive(labels)
|
|
global.showIndexAddActive(labels)
|
|
|
},
|
|
},
|
|
|
confirm: () => {
|
|
confirm: () => {
|
|
@@ -881,46 +893,122 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function markDoneTip() {
|
|
function markDoneTip() {
|
|
|
- if (health.mode != 'EAT' && health.mode != 'ACTIVE') return
|
|
|
|
|
|
|
+ if (health.mode == 'DAY' && health.mode != 'NIGHT') return
|
|
|
var scenario = getScenario(health.windows, health.mode)
|
|
var scenario = getScenario(health.windows, health.mode)
|
|
|
if (scenario.status != 'OG') return
|
|
if (scenario.status != 'OG') return
|
|
|
|
|
|
|
|
if (health.mode == 'EAT' && hideEatArchiveTip) return
|
|
if (health.mode == 'EAT' && hideEatArchiveTip) return
|
|
|
if (health.mode == 'ACTIVE' && hideActiveArchiveTip) return
|
|
if (health.mode == 'ACTIVE' && hideActiveArchiveTip) return
|
|
|
|
|
+ if (health.mode == 'FAST' && hideFastTip) return
|
|
|
|
|
+ if (health.mode == 'SLEEP' && hideSleepTip) return
|
|
|
|
|
|
|
|
- var strTitle = ''
|
|
|
|
|
- if (scenario.archive_timestamp) {
|
|
|
|
|
|
|
+ function tipContent() {
|
|
|
|
|
+ var strTime = ''
|
|
|
var today = new Date().getDate()
|
|
var today = new Date().getDate()
|
|
|
var date = new Date(scenario.archive_timestamp).getDate()
|
|
var date = new Date(scenario.archive_timestamp).getDate()
|
|
|
if (today == date) {
|
|
if (today == date) {
|
|
|
- strTitle = t('health.tonight_at', { time: dayjs(scenario.archive_timestamp).format('HH:mm') })
|
|
|
|
|
|
|
+ strTime = t('health.today_at', { time: dayjs(scenario.archive_timestamp).format('HH:mm') })
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- strTitle = t('health.tomorrow_at', { time: dayjs(scenario.archive_timestamp).format('HH:mm') })
|
|
|
|
|
|
|
+ strTime = t('health.tomorrow_at', { time: dayjs(scenario.archive_timestamp).format('HH:mm') })
|
|
|
}
|
|
}
|
|
|
|
|
+ switch (health.mode) {
|
|
|
|
|
+ case 'FAST':
|
|
|
|
|
+ if (global.language == 'en') {
|
|
|
|
|
+ return <Text className="h28">After you log <Text className="italic">End Fast</Text>,{'\n'}
|
|
|
|
|
+ Your moments <Text className="bold">today</Text> will appear in <Text className="bold">Recents</Text>.</Text>
|
|
|
|
|
+ }
|
|
|
|
|
+ return <Text className="h28">在您记录完 <Text className="italic">结束断食</Text> 之后,{'\n'}
|
|
|
|
|
+ 您<Text className="bold">今天</Text>的时刻将出现在<Text className="bold">最近</Text>中。</Text>
|
|
|
|
|
+ case 'SLEEP':
|
|
|
|
|
+ if (global.language == 'en') {
|
|
|
|
|
+ return <Text className="h28">After you log <Text className="italic">Wake Up</Text>,{'\n'}
|
|
|
|
|
+ Your moments <Text className="bold">today</Text> will appear in <Text className="bold">Recents</Text>.</Text>
|
|
|
|
|
+ }
|
|
|
|
|
+ return <Text className="h28">在您记录完 <Text className="italic">起床</Text> 之后,{'\n'}
|
|
|
|
|
+ 您<Text className="bold">今天</Text>的时刻将出现在<Text className="bold">最近</Text>中。</Text>
|
|
|
|
|
+ case 'EAT':
|
|
|
|
|
+ if (global.language == 'en') {
|
|
|
|
|
+ return <Text className="h28"><Text style={{ color: MainColorType.eat }}>{strTime}</Text> or after you <Text className="italic">Mark Done</Text>,{'\n'}
|
|
|
|
|
+ Your moments <Text className="bold">today</Text> will appear in <Text className="bold">Recents</Text>.</Text>
|
|
|
|
|
+ }
|
|
|
|
|
+ return <Text className="h28"><Text style={{ color: MainColorType.eat }}>{strTime}</Text> 或在您 <Text className="italic">标记完成</Text> 之后,{'\n'}
|
|
|
|
|
+ 您<Text className="bold">今天</Text>的时刻将出现在<Text className="bold">最近</Text>中。</Text>
|
|
|
|
|
+ case 'ACTIVE':
|
|
|
|
|
+ if (global.language == 'en') {
|
|
|
|
|
+ return <Text className="h28"><Text style={{ color: MainColorType.active }}>{strTime}</Text> or after you <Text className="italic">Mark Done</Text>,{'\n'}
|
|
|
|
|
+ Your moments <Text className="bold">today</Text> will appear in <Text className="bold">Recents</Text>.</Text>
|
|
|
|
|
+ }
|
|
|
|
|
+ return <Text className="h28"><Text style={{ color: MainColorType.active }}>{strTime}</Text> 或在您 <Text className="italic">标记完成</Text> 之后,{'\n'}
|
|
|
|
|
+ 您<Text className="bold">今天</Text>的时刻将出现在<Text className="bold">最近</Text>中。</Text>
|
|
|
|
|
+ }
|
|
|
|
|
+ return <Text className="h28">1</Text>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
return <View className="mark_done_tip" style={{
|
|
return <View className="mark_done_tip" style={{
|
|
|
backgroundColor: getThemeColor(health.mode) + '1A'
|
|
backgroundColor: getThemeColor(health.mode) + '1A'
|
|
|
}}>
|
|
}}>
|
|
|
<View style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
<View style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
|
- <Text className="h28 bold" style={{ color: getThemeColor(health.mode) }}>{strTitle}</Text>
|
|
|
|
|
- <Text className="h24 bold">{t('health.all_logs', { scenario: health.mode == 'EAT' ? t('health.meals') : t('health.activities') })}<Text style={{ fontWeight: 'normal' }}>{t('health.will_collected')}</Text>{t('health.journal_end')}</Text>
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ tipContent()
|
|
|
|
|
+ }
|
|
|
</View>
|
|
</View>
|
|
|
<NewButton type={NewButtonType.img} btnStyle={{
|
|
<NewButton type={NewButtonType.img} btnStyle={{
|
|
|
height: rpxToPx(32),
|
|
height: rpxToPx(32),
|
|
|
width: rpxToPx(32)
|
|
width: rpxToPx(32)
|
|
|
}} onClick={() => {
|
|
}} onClick={() => {
|
|
|
- if (health.mode == 'EAT') {
|
|
|
|
|
- setHideEatArchiveTip(true)
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- setHideActiveArchiveTip(true)
|
|
|
|
|
|
|
+ switch (health.mode) {
|
|
|
|
|
+ case 'FAST':
|
|
|
|
|
+ setHideFastTip(true)
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'EAT':
|
|
|
|
|
+ setHideEatArchiveTip(true)
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'SLEEP':
|
|
|
|
|
+ setHideSleepTip(true)
|
|
|
|
|
+ break
|
|
|
|
|
+ case 'ACTIVE':
|
|
|
|
|
+ setHideActiveArchiveTip(true)
|
|
|
|
|
+ break
|
|
|
}
|
|
}
|
|
|
}}>
|
|
}}>
|
|
|
<IconClose color={MainColorType.g01} width={rpxToPx(32)} height={rpxToPx(32)} />
|
|
<IconClose color={MainColorType.g01} width={rpxToPx(32)} height={rpxToPx(32)} />
|
|
|
</NewButton>
|
|
</NewButton>
|
|
|
</View>
|
|
</View>
|
|
|
|
|
+ // var strTitle = ''
|
|
|
|
|
+ // if (scenario.archive_timestamp) {
|
|
|
|
|
+ // var today = new Date().getDate()
|
|
|
|
|
+ // var date = new Date(scenario.archive_timestamp).getDate()
|
|
|
|
|
+ // if (today == date) {
|
|
|
|
|
+ // strTitle = t('health.tonight_at', { time: dayjs(scenario.archive_timestamp).format('HH:mm') })
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else {
|
|
|
|
|
+ // strTitle = t('health.tomorrow_at', { time: dayjs(scenario.archive_timestamp).format('HH:mm') })
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // return <View className="mark_done_tip" style={{
|
|
|
|
|
+ // backgroundColor: getThemeColor(health.mode) + '1A'
|
|
|
|
|
+ // }}>
|
|
|
|
|
+ // <View style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
|
|
|
+ // <Text className="h24 bold" style={{ color: getThemeColor(health.mode) }}>{strTitle}</Text>
|
|
|
|
|
+ // <Text className="h24 bold">{t('health.all_logs', { scenario: health.mode == 'EAT' ? t('health.meals') : t('health.activities') })}<Text style={{ fontWeight: 'normal' }}>{t('health.will_collected')}</Text>{t('health.journal_end')}</Text>
|
|
|
|
|
+ // </View>
|
|
|
|
|
+ // <NewButton type={NewButtonType.img} btnStyle={{
|
|
|
|
|
+ // height: rpxToPx(32),
|
|
|
|
|
+ // width: rpxToPx(32)
|
|
|
|
|
+ // }} onClick={() => {
|
|
|
|
|
+ // if (health.mode == 'EAT') {
|
|
|
|
|
+ // setHideEatArchiveTip(true)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else {
|
|
|
|
|
+ // setHideActiveArchiveTip(true)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }}>
|
|
|
|
|
+ // <IconClose color={MainColorType.g01} width={rpxToPx(32)} height={rpxToPx(32)} />
|
|
|
|
|
+ // </NewButton>
|
|
|
|
|
+ // </View>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return <View className="main-console-bg">
|
|
return <View className="main-console-bg">
|
|
@@ -988,10 +1076,10 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
|
|
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
- {
|
|
|
|
|
|
|
+ {/* {
|
|
|
markDoneTip()
|
|
markDoneTip()
|
|
|
- }
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } */}
|
|
|
|
|
+ {/* {
|
|
|
health.mode == 'ACTIVE' && <View>
|
|
health.mode == 'ACTIVE' && <View>
|
|
|
<View className="main_column_space" /><IconTitleCell
|
|
<View className="main_column_space" /><IconTitleCell
|
|
|
icon={<IconActive width={rpxToPx(32)} color={MainColorType.active} />}
|
|
icon={<IconActive width={rpxToPx(32)} color={MainColorType.active} />}
|
|
@@ -1000,8 +1088,8 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
jumpPage('/_health/pages/move')
|
|
jumpPage('/_health/pages/move')
|
|
|
}}
|
|
}}
|
|
|
/></View>
|
|
/></View>
|
|
|
- }
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } */}
|
|
|
|
|
+ {/* {
|
|
|
(health.mode == 'FAST' || health.mode == 'SLEEP') && <View >
|
|
(health.mode == 'FAST' || health.mode == 'SLEEP') && <View >
|
|
|
<View className="main_column_space" />
|
|
<View className="main_column_space" />
|
|
|
<IconTitleCell
|
|
<IconTitleCell
|
|
@@ -1051,8 +1139,8 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
|
|
|
|
|
|
|
|
|
|
</View>
|
|
</View>
|
|
|
- }
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } */}
|
|
|
|
|
+ {/* {
|
|
|
health.mode == 'FAST' && <IconTitleCell
|
|
health.mode == 'FAST' && <IconTitleCell
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
jumpPage('/_health/pages/long_fast')
|
|
jumpPage('/_health/pages/long_fast')
|
|
@@ -1063,7 +1151,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
longFastStatus()
|
|
longFastStatus()
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
- }
|
|
|
|
|
|
|
+ } */}
|
|
|
<View className="circle" />
|
|
<View className="circle" />
|
|
|
{
|
|
{
|
|
|
durationPicker && <DurationPicker
|
|
durationPicker && <DurationPicker
|
|
@@ -1092,7 +1180,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
// setErrors([])
|
|
// setErrors([])
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- jumpPage('/_health/pages/schedules?mode=' + health.mode+'&error='+JSON.stringify(res))
|
|
|
|
|
|
|
+ jumpPage('/_health/pages/schedules?mode=' + health.mode + '&error=' + JSON.stringify(res))
|
|
|
// setList((res as any).schedules)
|
|
// setList((res as any).schedules)
|
|
|
// dispatch(setFooter((res as any).footer))
|
|
// dispatch(setFooter((res as any).footer))
|
|
|
// setErrors((res as any).error_messages ? (res as any).error_messages : [])
|
|
// setErrors((res as any).error_messages ? (res as any).error_messages : [])
|