import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { Collapse } from 'react-vant' import Button from '~/components/Button' import { eth_pledgeProducts } from '~/contract/api' import { useRouter } from '~/hooks/useRouter' import '~/styles/home.scss' import { openGitBook } from '~/utils' import { toString } from '~/utils/wei' const Home = () => { const { push } = useRouter() const { t } = useTranslation() const [pledgeList, setPledgeList] = useState([ { day: 180, rate: 1408 }, { day: 270, rate: 1521 }, { day: 360, rate: 1623 }, ]) const [pledgeIndex, setPledgeIndex] = useState(0) const pledgeHelp = useMemo(() => [ { title: '1. Stake', desc: 'Choose a staking plan' }, { title: '2. Receive NFT', desc: 'NFT as a stake certificate to withdraw daily staking rewards' }, { title: '3. Maturity', desc: 'Holding NFT can redeem all staking amount' }, ], []) const collapseData = useMemo(() => [ { title: 'Why should I stake Filecoin?', desc: 'FAQ1' }, { title: 'What can I do with the NFT after receiving it?', desc: 'FAQ2' }, { title: 'Where do my reward from staking come from?', desc: 'FAQ3' }, ], []) const getData = async () => { const res = await eth_pledgeProducts() res.data && setPledgeList(res.data) } useEffect(() => { getData() }, []) return (