import { observer } from 'mobx-react' import { useState } from 'react' import { CountDown, Toast } from 'react-vant' import useLike from '~/hooks/useLike' import { useRouter } from '~/hooks/useRouter' import store from '~/store' import '~/styles/components.scss' import { MarketNFTData } from '~/types/store' import { getTime, toThousands } from '~/utils' import { copy } from '~/utils/copy' import Modal from './Modal' interface ProductInfoProps { data: MarketNFTData } const ProductInfo = (props: ProductInfoProps) => { const { data } = props const { push } = useRouter() const { likeNft, userInfo } = store.state const { setLike, isLike } = useLike() const [visible, setVisible] = useState(false) const [visibleTime, setVisibleTime] = useState(false) const share = () => { const pathname = `${process.env.REACT_APP_SHARE_LINK}detail?id=${data.id}&type=${data.type}` copy(pathname) setVisible(true) } const toShare = (type: "cast" | "sell") => { if (type === 'cast') { if (data.cast_id === userInfo.id) { push('/share') return } if (data.cast_show === 1) { push('/noShare', { id: data.cast_id }) } else { Toast.fail('對方未開放') } } if (type === 'sell') { if (data.sell_id === userInfo.id) { push('/share') return } if (data.sell_show === 1) { push('/noShare', { id: data.sell_id }) } else { Toast.fail('對方未開放') } } } return (