import { View, Text } from "@tarojs/components";
import Taro from "@tarojs/taro";
import { useTranslation } from "react-i18next";

export default function Component() {
    const { t } = useTranslation()
    function waitActionSheet() {
        Taro.showActionSheet({
            itemList: [t('feature.track_time_duration.action_sheet.change_schedule'), t('feature.track_time_duration.action_sheet.switch_scenario')]
        })
            .then(res => {
                console.log(res.tapIndex)
                switch(res.tapIndex){
                    case 0:
                        Taro.navigateTo({
                            url:'/pages/SetSchedule'
                        })
                        break;
                    case 1:
                        Taro.navigateTo({
                            url:'/pages/ChooseScenario'
                        })
                        break;
                }
            })
            .catch(err => {
                console.log(err.errMsg)
            })
    }


    function ongoingActionSheet() {
        Taro.showActionSheet({
            itemList: [t('feature.track_time_duration.action_sheet.give_up'), t('feature.track_time_duration.action_sheet.switch_scenario')]
        })
            .then(res => {
                console.log(res.tapIndex)
            })
            .catch(err => {
                console.log(err.errMsg)
            })
    }

    return (
        <View>
            <Text onClick={waitActionSheet}>More Component</Text>
        </View>
    )
}