|
@@ -2,21 +2,22 @@ import { ColorType } from "@/context/themes/color";
|
|
|
import { ChooseScenarioBtn } from "@/features/common/SpecBtns";
|
|
import { ChooseScenarioBtn } from "@/features/common/SpecBtns";
|
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import { View, Text, Picker } from "@tarojs/components";
|
|
import { View, Text, Picker } from "@tarojs/components";
|
|
|
-import { useRouter } from "@tarojs/taro";
|
|
|
|
|
-import { useEffect } from "react";
|
|
|
|
|
|
|
+import { useDidShow, useRouter } from "@tarojs/taro";
|
|
|
|
|
+import { useEffect, useState } from "react";
|
|
|
import './ChooseScenario.scss';
|
|
import './ChooseScenario.scss';
|
|
|
import PickerViews from "@/components/input/PickerViews";
|
|
import PickerViews from "@/components/input/PickerViews";
|
|
|
-import { useSelector } from "react-redux";
|
|
|
|
|
-import { durationDatas } from "@/features/trackTimeDuration/hooks/Console";
|
|
|
|
|
|
|
+import { useDispatch, useSelector } from "react-redux";
|
|
|
|
|
+import { rpxToPx } from "@/utils/tools";
|
|
|
|
|
+import { updateFast, updateSleep, updateStep } from "@/store/set_target";
|
|
|
|
|
+import { TimeFormatter } from "@/utils/time_format";
|
|
|
|
|
+import { set } from "lodash";
|
|
|
|
|
|
|
|
export default function Suggest() {
|
|
export default function Suggest() {
|
|
|
- let router
|
|
|
|
|
|
|
+ let router: any = null
|
|
|
var navigation: any = null
|
|
var navigation: any = null
|
|
|
if (process.env.TARO_ENV === 'rn') {
|
|
if (process.env.TARO_ENV === 'rn') {
|
|
|
var useNavigation = require("@react-navigation/native").useNavigation
|
|
var useNavigation = require("@react-navigation/native").useNavigation
|
|
|
navigation = useNavigation()
|
|
navigation = useNavigation()
|
|
|
- }
|
|
|
|
|
- if (process.env.TARO_ENV === 'rn') {
|
|
|
|
|
const useRoute = require("@react-navigation/native").useRoute
|
|
const useRoute = require("@react-navigation/native").useRoute
|
|
|
router = useRoute()
|
|
router = useRoute()
|
|
|
}
|
|
}
|
|
@@ -24,123 +25,328 @@ export default function Suggest() {
|
|
|
router = useRouter()
|
|
router = useRouter()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const isMixed = parseInt(router.params.isMixed + '')
|
|
|
|
|
- const isFast = parseInt(router.params.isFast + '')
|
|
|
|
|
- const isActionPlan = parseInt(router.params.isActionPlan + '')
|
|
|
|
|
const common = useSelector((state: any) => state.common);
|
|
const common = useSelector((state: any) => state.common);
|
|
|
|
|
+ const target = useSelector((state: any) => state.target);
|
|
|
|
|
+ const [pageStep] = useState(target.step);
|
|
|
|
|
+ const dispatch = useDispatch();
|
|
|
|
|
+
|
|
|
|
|
+ const [suggestIndex, setSuggestIndex] = useState(-1)
|
|
|
|
|
+ const [suggestItems, setSuggestItem] = useState<any>([])
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- console.log(router.params)
|
|
|
|
|
- }, [])
|
|
|
|
|
|
|
+ // console.log(target.isFast)
|
|
|
|
|
|
|
|
- function next() {
|
|
|
|
|
- if (isMixed == 1) {
|
|
|
|
|
- var url = '/pages/clock/Suggest?isMixed=1'
|
|
|
|
|
- var pageName = 'Suggest'
|
|
|
|
|
- var params: any = {
|
|
|
|
|
- isMixed: 1
|
|
|
|
|
|
|
+ if (pageStep == 1) {
|
|
|
|
|
+ var obj = target.fast.schedule.fast
|
|
|
|
|
+ var duration = obj.end_time.split(':')[0] * 60 + obj.end_time.split(':')[1] * 1 - (obj.start_time.split(':')[0] * 60 + obj.start_time.split(':')[1] * 1)
|
|
|
|
|
+ if (duration <= 0) {
|
|
|
|
|
+ duration += 24 * 60
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if (isFast) {
|
|
|
|
|
- if (isActionPlan) {
|
|
|
|
|
- url += '&isActionPlan=0&isFast=1'
|
|
|
|
|
- params.isActionPlan = 0
|
|
|
|
|
- params.isFast = 1
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- url += '&isActionPlan=1&isFast=0'
|
|
|
|
|
- params.isActionPlan = 1
|
|
|
|
|
- params.isFast = 0
|
|
|
|
|
|
|
+ var durationHours = Math.floor(duration / 60)
|
|
|
|
|
+ var durationMinutes = duration % 60
|
|
|
|
|
+ var currentIndex = -1;
|
|
|
|
|
+ var array: any = []
|
|
|
|
|
+ for (var i = 12; i <= 23; i++) {
|
|
|
|
|
+ if (i != 23 || durationMinutes == 0) {
|
|
|
|
|
+ array.push({
|
|
|
|
|
+ hours: i,
|
|
|
|
|
+ minutes: durationMinutes
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- else {
|
|
|
|
|
- if (isActionPlan) {
|
|
|
|
|
- url += '&isActionPlan=0&isFast=0'
|
|
|
|
|
- params.isActionPlan = 0
|
|
|
|
|
- params.isFast = 0
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- url = '/pages/clock/SetGoal?isMixed=1&isPlan=0'
|
|
|
|
|
- pageName = 'SetGoal'
|
|
|
|
|
|
|
+
|
|
|
|
|
+ for (var i = 0; i < array.length; i++) {
|
|
|
|
|
+ if (array[i].hours == durationHours && array[i].minutes == durationMinutes) {
|
|
|
|
|
+ currentIndex = i
|
|
|
|
|
+ break
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ setSuggestItem(array)
|
|
|
|
|
+ setSuggestIndex(currentIndex)
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (pageStep == 3) {
|
|
|
|
|
+ var obj = target.sleep.schedule.sleep
|
|
|
|
|
+ var sleep_cycle = obj.sleep_cycle
|
|
|
|
|
+ var sleep_latency = obj.sleep_latency.default_value
|
|
|
|
|
+ var array: any = []
|
|
|
|
|
+ for (var i = 0; i < sleep_cycle.numbers.length; i++) {
|
|
|
|
|
+ var count = sleep_cycle.numbers[i] * sleep_cycle.length + sleep_latency
|
|
|
|
|
+ array.push({
|
|
|
|
|
+ hours: Math.floor(count / 60),
|
|
|
|
|
+ minutes: count % 60
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ setSuggestItem(array)
|
|
|
|
|
+ setSuggestIndex(0)
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [])
|
|
|
|
|
|
|
|
|
|
+ useDidShow(() => {
|
|
|
|
|
+ dispatch(updateStep({ step: pageStep }))
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- jumpPage(url, pageName, navigation, params)
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ function next() {
|
|
|
|
|
+ if (pageStep == 1) {
|
|
|
|
|
+ var item = suggestItems[suggestIndex]
|
|
|
|
|
+ var fast = JSON.parse(JSON.stringify(target.fast))
|
|
|
|
|
+ var startCount = fast.schedule.fast.end_time.split(':')[0] * 60 + fast.schedule.fast.end_time.split(':')[1] * 1 - (item.hours * 60 + item.minutes)
|
|
|
|
|
+ if (startCount < 0) {
|
|
|
|
|
+ startCount += 24 * 60
|
|
|
|
|
+ }
|
|
|
|
|
+ var start = TimeFormatter.padZero(Math.floor(startCount / 60)) + ':' + TimeFormatter.padZero(startCount % 60)
|
|
|
|
|
+ fast.schedule.fast.start_time = start
|
|
|
|
|
+ dispatch(updateFast({ fast: fast }))
|
|
|
}
|
|
}
|
|
|
- if (isActionPlan == 1) {
|
|
|
|
|
- jumpPage(`/pages/clock/Suggest?isFast=${router.params.isFast}&isPlan=1&isMixed=0`, 'Suggest', navigation, {
|
|
|
|
|
- isFast: router.params.isFast,
|
|
|
|
|
- isPlan: 1,
|
|
|
|
|
- isMixed: 0
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ else if (pageStep == 3){
|
|
|
|
|
+ var item = suggestItems[suggestIndex]
|
|
|
|
|
+ var sleep = JSON.parse(JSON.stringify(target.sleep))
|
|
|
|
|
+ var startCount = sleep.schedule.sleep.end_time.split(':')[0] * 60 + sleep.schedule.sleep.end_time.split(':')[1] * 1 - (item.hours * 60 + item.minutes)
|
|
|
|
|
+ if (startCount < 0) {
|
|
|
|
|
+ startCount += 24 * 60
|
|
|
|
|
+ }
|
|
|
|
|
+ var start = TimeFormatter.padZero(Math.floor(startCount / 60)) + ':' + TimeFormatter.padZero(startCount % 60)
|
|
|
|
|
+ sleep.schedule.sleep.start_time = start
|
|
|
|
|
+ dispatch(updateSleep({ sleep: sleep }))
|
|
|
}
|
|
}
|
|
|
- jumpPage(`/pages/clock/SetGoal?isFast=${router.params.isFast}&isActionPlan=0&isMixed=0`, 'SetGoal', navigation, {
|
|
|
|
|
- isFast: router.params.isFast,
|
|
|
|
|
- isActionPlan: 0,
|
|
|
|
|
- isMixed: 0
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ var step: number = target.step + 1
|
|
|
|
|
+ dispatch(updateStep({ step: step }))
|
|
|
|
|
+
|
|
|
|
|
+ var url = '/pages/clock/Suggest'
|
|
|
|
|
+ var pageName = 'Suggest'
|
|
|
|
|
+ if (!target.isMixed) {
|
|
|
|
|
+ if (step == 2) {
|
|
|
|
|
+ url = '/pages/clock/SetGoal'
|
|
|
|
|
+ pageName = 'SetGoal'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ if (step == 4) {
|
|
|
|
|
+ url = '/pages/clock/SetGoal'
|
|
|
|
|
+ pageName = 'SetGoal'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ jumpPage(url, pageName, navigation, {})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function myself() {
|
|
function myself() {
|
|
|
- jumpPage(`/pages/clock/SetGoal?isMixed=${router.params.isMixed}&isPlan=0`, 'SetGoal', navigation, {
|
|
|
|
|
- isMixed: router.params.isMixed,
|
|
|
|
|
- isPlan: 0
|
|
|
|
|
|
|
+ jumpPage(`/pages/clock/SetGoal?isSelf=1`, 'SetGoal', navigation, {
|
|
|
|
|
+ isSelf: 1
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function suggestTitle() {
|
|
function suggestTitle() {
|
|
|
- if (isFast) {
|
|
|
|
|
- if (isActionPlan) {
|
|
|
|
|
|
|
+ switch (pageStep) {
|
|
|
|
|
+ case 0:
|
|
|
return 'Action Plan For Fasting'
|
|
return 'Action Plan For Fasting'
|
|
|
- }
|
|
|
|
|
- return 'Choose Action Plan For Fasting'
|
|
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ return 'Choose Action Plan For Fasting'
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ return 'Action Plan For Sleep'
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ return 'Choose Action Plan For Sleep'
|
|
|
|
|
+ default:
|
|
|
|
|
+ return ''
|
|
|
}
|
|
}
|
|
|
- if (isActionPlan) {
|
|
|
|
|
- return 'Action Plan For Sleep'
|
|
|
|
|
- }
|
|
|
|
|
- return 'Choose Action Plan For Sleep'
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function suggestDesc() {
|
|
function suggestDesc() {
|
|
|
- if (isFast) {
|
|
|
|
|
- if (isActionPlan) {
|
|
|
|
|
|
|
+ switch (pageStep) {
|
|
|
|
|
+ case 0:
|
|
|
return 'What time do you want to break your fast and start your breakfast?'
|
|
return 'What time do you want to break your fast and start your breakfast?'
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ return 'To benefit from overnight fasting and enjoy breakfast at 10:00 AM, start fasting at suggested time.'
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ return 'What time do you want to wake up?'
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ return 'To wake up refreshed at 7:00 AM, go to bed at suggested time.'
|
|
|
|
|
+ default:
|
|
|
|
|
+ return ''
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function durationDatas() {
|
|
|
|
|
+ var min: number = 0
|
|
|
|
|
+ var max: number = 23
|
|
|
|
|
+ var step: number = 5
|
|
|
|
|
+
|
|
|
|
|
+ // if (common.duration) {
|
|
|
|
|
+ // min = common.duration.min
|
|
|
|
|
+ // max = common.duration.max
|
|
|
|
|
+ // step = common.duration.step
|
|
|
|
|
+ // }
|
|
|
|
|
+ var minutes: string[] = []
|
|
|
|
|
+ for (let i = 0; i < 60; i += step) {
|
|
|
|
|
+ minutes.push(TimeFormatter.padZero(i))
|
|
|
|
|
+ }
|
|
|
|
|
+ var hours: string[] = []
|
|
|
|
|
+ for (let i = min; i <= max; i++) {
|
|
|
|
|
+ hours.push(TimeFormatter.padZero(i))
|
|
|
|
|
+ }
|
|
|
|
|
+ return [hours, minutes]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ function durationValues() {
|
|
|
|
|
+
|
|
|
|
|
+ var eatTime = target.fast.schedule.fast.end_time
|
|
|
|
|
+ if (pageStep == 2) {
|
|
|
|
|
+ eatTime = target.sleep.schedule.sleep.end_time
|
|
|
|
|
+ }
|
|
|
|
|
+ var eatHour = eatTime.split(':')[0]
|
|
|
|
|
+ var eatMin = eatTime.split(':')[1]
|
|
|
|
|
+ var list = durationDatas()
|
|
|
|
|
+ var hourIndex = 0
|
|
|
|
|
+ var minIndex = 0
|
|
|
|
|
+ for (let i = 0; i < list[0].length; i++) {
|
|
|
|
|
+ if (list[0][i] == eatHour) {
|
|
|
|
|
+ hourIndex = i
|
|
|
|
|
+ break
|
|
|
}
|
|
}
|
|
|
- return 'To benefit from overnight fasting and enjoy breakfast at 10:00 AM, start fasting at suggested time.'
|
|
|
|
|
}
|
|
}
|
|
|
- if (isActionPlan) {
|
|
|
|
|
- return 'What time do you want to wake up?'
|
|
|
|
|
|
|
+ for (let i = 0; i < list[1].length; i++) {
|
|
|
|
|
+ if (list[1][i] == eatMin) {
|
|
|
|
|
+ minIndex = i
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- return 'To wake up refreshed at 7:00 AM, go to bed at suggested time.'
|
|
|
|
|
|
|
+ return [hourIndex, minIndex]
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function timePicker(){
|
|
|
|
|
- return <View>
|
|
|
|
|
|
|
+ function sleepLatency() {
|
|
|
|
|
+ var obj = target.sleep.schedule.sleep.sleep_latency
|
|
|
|
|
+ var min: number = obj.min
|
|
|
|
|
+ var max: number = obj.max
|
|
|
|
|
+ var step: number = obj.step
|
|
|
|
|
+
|
|
|
|
|
+ var minutes: string[] = []
|
|
|
|
|
+ for (let i = min; i <= max; i += step) {
|
|
|
|
|
+ minutes.push(i + '')
|
|
|
|
|
+ }
|
|
|
|
|
+ return [minutes]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function sleepLatencyValue() {
|
|
|
|
|
+ var obj = target.sleep.schedule.sleep.sleep_latency
|
|
|
|
|
+ var value: number = obj.default_value
|
|
|
|
|
+ var min: number = obj.min
|
|
|
|
|
+ var step: number = obj.step
|
|
|
|
|
+ var index = (value - min) / step
|
|
|
|
|
+
|
|
|
|
|
+ return [index]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function timePickerChanged(e: any) {
|
|
|
|
|
+ var obj = target.fast.schedule.fast
|
|
|
|
|
+ if (pageStep == 2) {
|
|
|
|
|
+ obj = target.sleep.schedule.sleep
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var duration = obj.end_time.split(':')[0] * 60 + obj.end_time.split(':')[1] * 1 - (obj.start_time.split(':')[0] * 60 + obj.start_time.split(':')[1] * 1)
|
|
|
|
|
+ if (duration <= 0) {
|
|
|
|
|
+ duration += 24 * 60
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var endCount = duration - (e[0] * 60 + e[1] * 5)
|
|
|
|
|
+ if (endCount < 0) {
|
|
|
|
|
+ endCount += 24 * 60
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var time = TimeFormatter.padZero(e[0]) + ':' + TimeFormatter.padZero(e[1] * 5)
|
|
|
|
|
+ var start = TimeFormatter.padZero(Math.floor(endCount / 60)) + ':' + TimeFormatter.padZero(endCount % 60)
|
|
|
|
|
+
|
|
|
|
|
+ if (pageStep == 0) {
|
|
|
|
|
+ var fast = JSON.parse(JSON.stringify(target.fast))
|
|
|
|
|
+ fast.schedule.fast.end_time = time
|
|
|
|
|
+ fast.schedule.fast.start_time = start
|
|
|
|
|
+ dispatch(updateFast({ fast: fast }))
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ var sleep = JSON.parse(JSON.stringify(target.sleep))
|
|
|
|
|
+ sleep.schedule.sleep.end_time = time
|
|
|
|
|
+ fast.schedule.sleep.start_time = start
|
|
|
|
|
+ dispatch(updateSleep({ sleep: sleep }))
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function timePicker() {
|
|
|
|
|
+ return <View style={{ marginTop: rpxToPx(56) }}>
|
|
|
<PickerViews ref={null}
|
|
<PickerViews ref={null}
|
|
|
- onChange={()=>{}}
|
|
|
|
|
- items={durationDatas(common)}
|
|
|
|
|
- value={[1,2]} height={200}
|
|
|
|
|
- title=''
|
|
|
|
|
- themeColor={isFast ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
|
|
|
|
|
- showBtns={false}
|
|
|
|
|
- hideTitle={true}
|
|
|
|
|
- onCancel={() => { }} />
|
|
|
|
|
|
|
+ onChange={timePickerChanged}
|
|
|
|
|
+ items={durationDatas()}
|
|
|
|
|
+ value={durationValues()} height={200}
|
|
|
|
|
+ title=''
|
|
|
|
|
+ themeColor={target.isMixed ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
|
|
|
|
|
+ showBtns={false}
|
|
|
|
|
+ hideTitle={true}
|
|
|
|
|
+ onCancel={() => { }} />
|
|
|
|
|
+ <Text className="suggest_footer">If you plan to skip breakfast, pick a time for your first meal of the day.</Text>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function durationPicker(){
|
|
|
|
|
- return <View></View>
|
|
|
|
|
|
|
+ function fallSleepChanged(e: any) {
|
|
|
|
|
+ var value = target.sleep.schedule.sleep.sleep_latency
|
|
|
|
|
+ var time = e[0] * value.step + value.min
|
|
|
|
|
+ var sleep = JSON.parse(JSON.stringify(target.sleep))
|
|
|
|
|
+ sleep.schedule.sleep.sleep_latency.default_value = time
|
|
|
|
|
+ dispatch(updateSleep({ sleep: sleep }))
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function fallSleepPicker() {
|
|
|
|
|
+ return <View style={{ marginTop: rpxToPx(56) }}>
|
|
|
|
|
+ <PickerViews ref={null}
|
|
|
|
|
+ onChange={fallSleepChanged}
|
|
|
|
|
+ items={sleepLatency()}
|
|
|
|
|
+ value={sleepLatencyValue()} height={200}
|
|
|
|
|
+ title=''
|
|
|
|
|
+ themeColor={target.isMixed ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
|
|
|
|
|
+ showBtns={false}
|
|
|
|
|
+ hideTitle={true}
|
|
|
|
|
+ onCancel={() => { }} />
|
|
|
|
|
+ <Text className="suggest_footer">It takes 10 to 30 minutes for most people to fall asleep once they're in bed.</Text>
|
|
|
|
|
+ </View>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function content(){
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ function suggestList() {
|
|
|
|
|
+ if (pageStep == 1) {
|
|
|
|
|
+ return <View>
|
|
|
|
|
+ {
|
|
|
|
|
+ suggestItems.map((item: any, index: number) => {
|
|
|
|
|
+ return <View onClick={() => {
|
|
|
|
|
+ setSuggestIndex(index)
|
|
|
|
|
+ }} key={index} className={index == suggestIndex ? 'item_sel1' : 'item1'}>{item.hours} hours {item.minutes} minutes</View>
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+ return <View>
|
|
|
|
|
+ {
|
|
|
|
|
+ suggestItems.map((item: any, index: number) => {
|
|
|
|
|
+ return <View onClick={() => {
|
|
|
|
|
+ setSuggestIndex(index)
|
|
|
|
|
+ }} key={index} className={index == suggestIndex ? 'item_sel1' : 'item1'}>{item.hours} hours {item.minutes} minutes</View>
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function content() {
|
|
|
return <View >
|
|
return <View >
|
|
|
{
|
|
{
|
|
|
- timePicker()
|
|
|
|
|
|
|
+ (pageStep == 0 || pageStep == 2) && timePicker()
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ (pageStep == 1 || pageStep == 3) && suggestList()
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ pageStep == 2 && fallSleepPicker()
|
|
|
}
|
|
}
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
@@ -156,7 +362,7 @@ export default function Suggest() {
|
|
|
<View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
<View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
<ChooseScenarioBtn
|
|
<ChooseScenarioBtn
|
|
|
onClick={next}
|
|
onClick={next}
|
|
|
- title={parseInt(router.params.isActionPlan + '') == 1 ? 'Suggest Plan' : 'Next'}
|
|
|
|
|
|
|
+ title={pageStep == 0 || pageStep == 2 ? 'Suggest Plan' : 'Next'}
|
|
|
background={ColorType.fast}
|
|
background={ColorType.fast}
|
|
|
/>
|
|
/>
|
|
|
<Text style={{ color: '#fff', opacity: 0.4 }} onClick={myself}>Set It Myself</Text>
|
|
<Text style={{ color: '#fff', opacity: 0.4 }} onClick={myself}>Set It Myself</Text>
|