|
|
@@ -140,14 +140,16 @@ export default function FastSleepCard(props: { step: number, data: any }) {
|
|
|
|
|
|
function real0BigRing() {
|
|
|
const { fast, sleep, status } = props.data
|
|
|
- if (status == 'WFS'){
|
|
|
- return {
|
|
|
- color: MainColorType.fast,
|
|
|
- startArc: getStartArc(fast.target.start_timestamp),
|
|
|
- durationArc: getDurationArc(fast.target.start_timestamp, new Date().getTime())
|
|
|
- }
|
|
|
+ if (status == 'WFS') {
|
|
|
+ if (fast.target.start_timestamp <= new Date().getTime() && new Date().getTime() < fast.target.end_timestamp)
|
|
|
+ return {
|
|
|
+ color: MainColorType.fast,
|
|
|
+ startArc: getStartArc(fast.target.start_timestamp),
|
|
|
+ durationArc: getDurationArc(fast.target.start_timestamp, new Date().getTime())
|
|
|
+ }
|
|
|
+ return null
|
|
|
}
|
|
|
- if ( status == 'OG2_NO1') {
|
|
|
+ if (status == 'OG2_NO1') {
|
|
|
return null;
|
|
|
}
|
|
|
return {
|
|
|
@@ -217,11 +219,9 @@ export default function FastSleepCard(props: { step: number, data: any }) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function currentDot(mode) {
|
|
|
-
|
|
|
-
|
|
|
+ function currentDot(mode, outRange?: boolean) {
|
|
|
return {
|
|
|
- color: getThemeColor(mode),
|
|
|
+ color: outRange ? '#B2B2B2' : getThemeColor(mode),
|
|
|
lineWidth: 4,
|
|
|
borderColor: '#ffffff',
|
|
|
offset: 0
|
|
|
@@ -231,6 +231,24 @@ export default function FastSleepCard(props: { step: number, data: any }) {
|
|
|
|
|
|
|
|
|
function circle0() {
|
|
|
+ const { fast, sleep, status } = props.data
|
|
|
+ var outRange = true
|
|
|
+ var outRange2 = true
|
|
|
+ if (fast.status == 'OG') {
|
|
|
+ outRange = false
|
|
|
+ }
|
|
|
+ else if (fast.target.start_timestamp <= new Date().getTime() && new Date().getTime() < fast.target.end_timestamp) {
|
|
|
+ outRange = false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sleep.status == 'OG') {
|
|
|
+ outRange2 = false
|
|
|
+ }
|
|
|
+ else if (sleep.target.start_timestamp <= new Date().getTime() && new Date().getTime() < sleep.target.end_timestamp) {
|
|
|
+ outRange2 = false
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return <View style={{
|
|
|
display: 'flex', alignItems: 'center', justifyContent: 'center', width: 114, height: 114,
|
|
|
marginLeft: rpxToPx(50),
|
|
|
@@ -242,7 +260,7 @@ export default function FastSleepCard(props: { step: number, data: any }) {
|
|
|
targetRing={target0BigRing()}
|
|
|
realRing={real0BigRing()}
|
|
|
canvasId={'circle0_big'}
|
|
|
- currentDot={currentDot('FAST')}
|
|
|
+ currentDot={currentDot('FAST', outRange)}
|
|
|
/>
|
|
|
|
|
|
<View style={{
|
|
|
@@ -260,7 +278,7 @@ export default function FastSleepCard(props: { step: number, data: any }) {
|
|
|
targetRing={target0SmallRing()}
|
|
|
realRing={real0SmallRing()}
|
|
|
canvasId={'circle0_small'}
|
|
|
- currentDot={currentDot('SLEEP')}
|
|
|
+ currentDot={currentDot('SLEEP', outRange2)}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
|
@@ -268,33 +286,58 @@ export default function FastSleepCard(props: { step: number, data: any }) {
|
|
|
}
|
|
|
|
|
|
function circle1() {
|
|
|
+ const { fast, sleep, status } = props.data
|
|
|
+ var outRange = true
|
|
|
+ if (fast.status == 'OG') {
|
|
|
+ outRange = false
|
|
|
+ }
|
|
|
+ else if (fast.target.start_timestamp <= new Date().getTime() && new Date().getTime() < fast.target.end_timestamp) {
|
|
|
+ outRange = false
|
|
|
+ }
|
|
|
return <View style={{ display: 'flex', marginTop: rpxToPx(100), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 96, height: 96, position: 'relative' }}> <Rings common={common3}
|
|
|
bgRing={bgRing}
|
|
|
targetRing={target1BigRing()}
|
|
|
realRing={real1BigRing()}
|
|
|
canvasId={'circle1_big'}
|
|
|
- currentDot={currentDot('FAST')}
|
|
|
+ currentDot={currentDot('FAST', outRange)}
|
|
|
/></View>
|
|
|
}
|
|
|
|
|
|
function circle2() {
|
|
|
+ const { fast, sleep, status } = props.data
|
|
|
+ var outRange = true
|
|
|
+ if (sleep.status == 'OG') {
|
|
|
+ outRange = false
|
|
|
+ }
|
|
|
+ else if (sleep.target.start_timestamp <= new Date().getTime() && new Date().getTime() < sleep.target.end_timestamp) {
|
|
|
+ outRange = false
|
|
|
+ }
|
|
|
return <View style={{ display: 'flex', marginTop: rpxToPx(100), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 96, height: 96, position: 'relative' }}> <Rings common={common3}
|
|
|
bgRing={bgRing}
|
|
|
targetRing={target2BigRing()}
|
|
|
realRing={real2BigRing()}
|
|
|
canvasId={'circle2_big'}
|
|
|
- currentDot={currentDot('SLEEP')}
|
|
|
+ currentDot={currentDot('SLEEP', outRange)}
|
|
|
|
|
|
/></View>
|
|
|
}
|
|
|
|
|
|
function circle3() {
|
|
|
+ const { fast, sleep, status } = props.data
|
|
|
+ var outRange = true
|
|
|
+ if (fast.status == 'OG') {
|
|
|
+ outRange = false
|
|
|
+ }
|
|
|
+ else if (fast.target.start_timestamp <= new Date().getTime() && new Date().getTime() < fast.target.end_timestamp) {
|
|
|
+ outRange = false
|
|
|
+ }
|
|
|
+
|
|
|
return <View style={{ display: 'flex', marginTop: rpxToPx(100), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 96, height: 96, position: 'relative' }}> <Rings common={common3}
|
|
|
bgRing={bgRing}
|
|
|
targetRing={target3BigRing()}
|
|
|
realRing={real3BigRing()}
|
|
|
canvasId={'circle3_big'}
|
|
|
- currentDot={currentDot('FAST')}
|
|
|
+ currentDot={currentDot('FAST',outRange)}
|
|
|
|
|
|
/></View>
|
|
|
}
|
|
|
@@ -611,27 +654,27 @@ export default function FastSleepCard(props: { step: number, data: any }) {
|
|
|
switch (props.step) {
|
|
|
case 0:
|
|
|
return <View className='right_content'>
|
|
|
- <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.fasting')}</View>
|
|
|
+ <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.fasting')}</View>
|
|
|
<View className='h36 bold' style={{ color: MainColorType.fast, lineHeight: rpxToPx(52) + 'px' }}>{fastTime()}</View>
|
|
|
<View style={{ height: rpxToPx(24) }} />
|
|
|
- <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.sleep')}</View>
|
|
|
+ <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.sleep')}</View>
|
|
|
<View className='h36 bold' style={{ color: MainColorType.sleep, lineHeight: rpxToPx(52) + 'px' }}>{sleepTime()}</View>
|
|
|
</View>
|
|
|
case 1:
|
|
|
return <View className='right_content'>
|
|
|
- <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.fast_before_bed')}</View>
|
|
|
+ <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.fast_before_bed')}</View>
|
|
|
<View style={{ height: rpxToPx(12) }} />
|
|
|
<View className='h36 bold' style={{ color: MainColorType.fast, lineHeight: rpxToPx(52) + 'px' }}>{step1()}</View>
|
|
|
</View>
|
|
|
case 2:
|
|
|
return <View className='right_content'>
|
|
|
- <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.fast_while_sleep')}</View>
|
|
|
+ <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.fast_while_sleep')}</View>
|
|
|
<View style={{ height: rpxToPx(12) }} />
|
|
|
<View className='h36 bold' style={{ color: MainColorType.sleep, lineHeight: rpxToPx(52) + 'px' }}>{step2()}</View>
|
|
|
</View>
|
|
|
case 3:
|
|
|
return <View className='right_content'>
|
|
|
- <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.fast_after_sleep')}</View>
|
|
|
+ <View className='h34 ' style={{ lineHeight: rpxToPx(42) + 'px' }}>{t('health.fast_after_sleep')}</View>
|
|
|
<View style={{ height: rpxToPx(12) }} />
|
|
|
<View className='h36 bold' style={{ color: MainColorType.fast, lineHeight: rpxToPx(52) + 'px' }}>{step3()}</View>
|
|
|
</View>
|