import { useEffect, useState } from 'react' import { RefreshClockwiseIcon } from './icons' import useMangoStore from '../stores/useMangoStore' import Tooltip from './Tooltip' import { IconButton } from './Button' import { useTranslation } from 'next-i18next' const ManualRefresh = ({ className = '' }) => { const { t } = useTranslation('common') const [spin, setSpin] = useState(false) const actions = useMangoStore((s) => s.actions) const handleRefreshData = async () => { setSpin(true) await actions.fetchMangoGroup() await actions.reloadMangoAccount() actions.fetchTradeHistory() } useEffect(() => { let timer if (spin) { timer = setTimeout(() => setSpin(false), 8000) } return () => { clearTimeout(timer) } }, [spin]) return (