import { ArrowSmDownIcon } from '@heroicons/react/solid' import BN from 'bn.js' import useTradeHistory from '../hooks/useTradeHistory' import Link from 'next/link' import { useRouter } from 'next/router' import { Table, Thead, Tbody, Tr, Th, Td } from 'react-super-responsive-table' import SideBadge from './SideBadge' import { LinkButton } from './Button' import { useSortableData } from '../hooks/useSortableData' import useMangoStore from '../stores/useMangoStore' const TradeHistoryTable = () => { const { asPath } = useRouter() const tradeHistory = useTradeHistory() const { items, requestSort, sortConfig } = useSortableData(tradeHistory) const marketConfig = useMangoStore((s) => s.selectedMarket.config) const renderTradeDateTime = (timestamp: BN | string) => { let date if (timestamp instanceof BN) { date = new Date(timestamp.toNumber() * 1000) } else { date = new Date(timestamp) } return ( <>
|
|
|
|
|
|
|
---|---|---|---|---|---|---|
|
{trade.size} | {trade.price} | ${trade.value.toFixed(2)} | {trade.liquidity} | ${trade.feeCost} | {trade.loadTimestamp || trade.timestamp ? renderTradeDateTime( trade.loadTimestamp || trade.timestamp ) : 'Recent'} |