import { View } from "@tarojs/components";
import TimelineStage from "./TimelineStage";
import { useTranslation } from "react-i18next";
import { useState } from "react";
import Modal from "@/components/layout/Modal.weapp";
import { ModalType } from "@/utils/types";

export default function SegmentPop(props: { data: any }) {
    const [showModal, setShowModal] = useState(false)
    const { t } = useTranslation()

    global.showSegmentPop = () => {
        setShowModal(true)
    }

    function schedules() {
        var timestamp = new Date().getTime()//props.data.first_real_check_time
        return <View style={{ display: 'flex', flexDirection: 'column' }}>
            <TimelineStage data={props.data.current_record} title={t('feature.track_time_duration.record_fast_sleep.pop_title')}
                subTitle='今天' first_real_check_time={timestamp} />
        </View>
    }


    return <View style={{ width: 0, height: 0 }}>
        {
            showModal && <Modal children={schedules()}
                modalType={ModalType.center}
                dismiss={() => { setShowModal(false); }}
                confirm={() => { }} />
        }
    </View>
}