SegmentPop.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import { View } from "@tarojs/components";
  2. import TimelineStage from "./TimelineStage";
  3. import { useTranslation } from "react-i18next";
  4. import { useState } from "react";
  5. import Modal from "@/components/layout/Modal.weapp";
  6. import { ModalType } from "@/utils/types";
  7. export default function SegmentPop(props: { data: any }) {
  8. const [showModal, setShowModal] = useState(false)
  9. const { t } = useTranslation()
  10. global.showSegmentPop = () => {
  11. setShowModal(true)
  12. }
  13. function schedules() {
  14. var timestamp = new Date().getTime()//props.data.first_real_check_time
  15. return <View style={{ display: 'flex', flexDirection: 'column' }}>
  16. <TimelineStage data={props.data.current_record} title={t('feature.track_time_duration.record_fast_sleep.pop_title')}
  17. subTitle='今天' first_real_check_time={timestamp} />
  18. </View>
  19. }
  20. return <View style={{ width: 0, height: 0 }}>
  21. {
  22. showModal && <Modal children={schedules()}
  23. modalType={ModalType.center}
  24. dismiss={() => { setShowModal(false); }}
  25. confirm={() => { }} />
  26. }
  27. </View>
  28. }