import { ColorType } from "@/context/themes/color"
import Taro from "@tarojs/taro"

export const getThemeColor = (time: any) => {
    if (time.scenario == 'FAST') {
        return global.fastColor ? global.fastColor : ColorType.fast
    }
    else if (time.scenario == 'SLEEP') {
        return global.sleepColor ? global.sleepColor : ColorType.sleep
    }
    else {
        if (time.status == 'WAIT_FOR_START' || time.status == 'ONGOING3') {
            return global.fastColor ? global.fastColor : ColorType.fast
        }
        return global.sleepColor ? global.sleepColor : ColorType.sleep
    }
}

export const jumpPage = (url?: string, pageName?: string, navigation?: any, params?: any) => {
    if (process.env.TARO_ENV == 'rn') {
        if (params){
            console.log(params)
        }
        navigation.push(pageName,params);
    }
    else {
        Taro.navigateTo({
            url: url ?? ''
        })
    }
}