|
@@ -211,57 +211,6 @@ export default function StreakCalendar() {
|
|
|
return scenario.current_streak.days
|
|
return scenario.current_streak.days
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function content() {
|
|
|
|
|
- return <View className="calendar_main2">
|
|
|
|
|
- <View className="calendar_header">
|
|
|
|
|
-
|
|
|
|
|
- <NewButton type={NewButtonType.img} onClick={() => {
|
|
|
|
|
- const date = new Date(year, month - 1); // month - 1 因为月份是从 0 开始
|
|
|
|
|
- date.setMonth(date.getMonth() - 1);
|
|
|
|
|
- setYear(date.getFullYear())
|
|
|
|
|
- setMonth(date.getMonth() + 1)
|
|
|
|
|
- }}>
|
|
|
|
|
- <Image src={require('@assets/_health/pre.png')} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
|
|
|
|
|
- </NewButton>
|
|
|
|
|
- <Text style={{ width: rpxToPx(236), textAlign: 'center' }}>{`${year}年${month}月`}</Text>
|
|
|
|
|
-
|
|
|
|
|
- <NewButton type={NewButtonType.img} onClick={() => {
|
|
|
|
|
- const date = new Date(year, month + 1); // month - 1 因为月份是从 0 开始
|
|
|
|
|
- date.setMonth(date.getMonth() - 1);
|
|
|
|
|
- setYear(date.getFullYear())
|
|
|
|
|
- setMonth(date.getMonth() + 1)
|
|
|
|
|
- }}>
|
|
|
|
|
- <Image src={require('@assets/_health/next.png')} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
|
|
|
|
|
- </NewButton>
|
|
|
|
|
- </View>
|
|
|
|
|
- <View className="calendar_body">
|
|
|
|
|
- <View className="calendar_weekly">
|
|
|
|
|
- {
|
|
|
|
|
- weeks.map((item, index) => {
|
|
|
|
|
- return <View className="week_item" key={index}>{item}</View>
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- </View>
|
|
|
|
|
- <View className="calendar_main3">
|
|
|
|
|
- {
|
|
|
|
|
- spaces.map((item, i) => {
|
|
|
|
|
- return <View className="calendar_item" style={{ width: rpxToPx(90) }} key={i * 10} />
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- {
|
|
|
|
|
- days.map((item, index) => {
|
|
|
|
|
- return <View className={itemClass(item)} style={{ width: rpxToPx(90), backgroundColor: bgColor(item) }} key={index}>
|
|
|
|
|
- <Text className={itemTextClass(item)} style={{ color: textColor(item) }}>{item.day}</Text>
|
|
|
|
|
- </View>
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- </View>
|
|
|
|
|
- </View>
|
|
|
|
|
- <View className="calendar_footer">
|
|
|
|
|
-
|
|
|
|
|
- </View>
|
|
|
|
|
- </View>
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
function detail() {
|
|
function detail() {
|
|
|
return <View style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
|
|
return <View style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
|
|
@@ -273,8 +222,8 @@ export default function StreakCalendar() {
|
|
|
style={{ backgroundColor: mode == 'EAT' ? getThemeColor('EAT') + '1A' : 'transparent' }}
|
|
style={{ backgroundColor: mode == 'EAT' ? getThemeColor('EAT') + '1A' : 'transparent' }}
|
|
|
>
|
|
>
|
|
|
<Text className={mode == 'EAT' ? 'bold h30' : 'h30'}
|
|
<Text className={mode == 'EAT' ? 'bold h30' : 'h30'}
|
|
|
- style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01, marginRight: 5 }}>Eat </Text>
|
|
|
|
|
- <Text className="h20" style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01 }}>{currentCount('EAT')}</Text>
|
|
|
|
|
|
|
+ style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01, marginRight: 5 }}>{t('health.eat')}</Text>
|
|
|
|
|
+ {/* <Text className="h20" style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01 }}>{currentCount('EAT')}</Text> */}
|
|
|
</View>
|
|
</View>
|
|
|
</NewButton>
|
|
</NewButton>
|
|
|
|
|
|
|
@@ -283,8 +232,8 @@ export default function StreakCalendar() {
|
|
|
style={{ backgroundColor: mode == 'ACTIVE' ? getThemeColor('ACTIVE') + '1A' : 'transparent' }}
|
|
style={{ backgroundColor: mode == 'ACTIVE' ? getThemeColor('ACTIVE') + '1A' : 'transparent' }}
|
|
|
>
|
|
>
|
|
|
<Text className={mode == 'ACTIVE' ? 'bold h30' : 'h30'}
|
|
<Text className={mode == 'ACTIVE' ? 'bold h30' : 'h30'}
|
|
|
- style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01, marginRight: 5 }}>Active</Text>
|
|
|
|
|
- <Text className="h20" style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01 }}> {currentCount('ACTIVE')}</Text>
|
|
|
|
|
|
|
+ style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01, marginRight: 5 }}>{t('health.active')}</Text>
|
|
|
|
|
+ {/* <Text className="h20" style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01 }}> {currentCount('ACTIVE')}</Text> */}
|
|
|
</View>
|
|
</View>
|
|
|
</NewButton>
|
|
</NewButton>
|
|
|
<NewButton type={NewButtonType.img} onClick={() => setMode('FAST')}>
|
|
<NewButton type={NewButtonType.img} onClick={() => setMode('FAST')}>
|
|
@@ -292,8 +241,8 @@ export default function StreakCalendar() {
|
|
|
style={{ backgroundColor: mode == 'FAST' ? getThemeColor('FAST') + '1A' : 'transparent' }}
|
|
style={{ backgroundColor: mode == 'FAST' ? getThemeColor('FAST') + '1A' : 'transparent' }}
|
|
|
>
|
|
>
|
|
|
<Text className={mode == 'FAST' ? 'bold h30' : 'h30'}
|
|
<Text className={mode == 'FAST' ? 'bold h30' : 'h30'}
|
|
|
- style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01, marginRight: 5 }}>Fast</Text>
|
|
|
|
|
- <Text className="h20" style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01 }}> {currentCount('FAST')}</Text>
|
|
|
|
|
|
|
+ style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01, marginRight: 5 }}>{t('health.fast')}</Text>
|
|
|
|
|
+ {/* <Text className="h20" style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01 }}> {currentCount('FAST')}</Text> */}
|
|
|
</View>
|
|
</View>
|
|
|
</NewButton>
|
|
</NewButton>
|
|
|
<NewButton type={NewButtonType.img} onClick={() => setMode('SLEEP')}>
|
|
<NewButton type={NewButtonType.img} onClick={() => setMode('SLEEP')}>
|
|
@@ -301,8 +250,8 @@ export default function StreakCalendar() {
|
|
|
style={{ backgroundColor: mode == 'SLEEP' ? getThemeColor('SLEEP') + '1A' : 'transparent' }}
|
|
style={{ backgroundColor: mode == 'SLEEP' ? getThemeColor('SLEEP') + '1A' : 'transparent' }}
|
|
|
>
|
|
>
|
|
|
<Text className={mode == 'SLEEP' ? 'bold h30' : 'h30'}
|
|
<Text className={mode == 'SLEEP' ? 'bold h30' : 'h30'}
|
|
|
- style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01, marginRight: 5 }}>Sleep</Text>
|
|
|
|
|
- <Text className="h20" style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01 }}> {currentCount('SLEEP')}</Text>
|
|
|
|
|
|
|
+ style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01, marginRight: 5 }}>{t('health.sleep')}</Text>
|
|
|
|
|
+ {/* <Text className="h20" style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01 }}> {currentCount('SLEEP')}</Text> */}
|
|
|
</View>
|
|
</View>
|
|
|
</NewButton>
|
|
</NewButton>
|
|
|
<View style={{ width: rpxToPx(40), flexShrink: 0 }} />
|
|
<View style={{ width: rpxToPx(40), flexShrink: 0 }} />
|