User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
import { ArrowSmDownIcon } from '@heroicons/react/solid'
|
2021-07-24 11:12:52 -07:00
|
|
|
import BN from 'bn.js'
|
2021-04-12 21:40:26 -07:00
|
|
|
import useTradeHistory from '../hooks/useTradeHistory'
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
import Link from 'next/link'
|
|
|
|
import { useRouter } from 'next/router'
|
2021-04-20 07:19:08 -07:00
|
|
|
import SideBadge from './SideBadge'
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
import { LinkButton } from './Button'
|
|
|
|
import { useSortableData } from '../hooks/useSortableData'
|
2021-09-07 21:12:49 -07:00
|
|
|
import { useViewport } from '../hooks/useViewport'
|
|
|
|
import { breakpoints } from './TradePageGrid'
|
|
|
|
import { Table, Td, Th, TrBody, TrHead } from './TableElements'
|
|
|
|
import { ExpandableRow } from './TableElements'
|
|
|
|
import { formatUsdValue } from '../utils'
|
2021-04-07 14:49:37 -07:00
|
|
|
|
2021-09-13 09:40:28 -07:00
|
|
|
const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
const { asPath } = useRouter()
|
2021-08-14 16:24:55 -07:00
|
|
|
const tradeHistory = useTradeHistory({ excludePerpLiquidations: true })
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
const { items, requestSort, sortConfig } = useSortableData(tradeHistory)
|
2021-09-07 21:12:49 -07:00
|
|
|
const { width } = useViewport()
|
|
|
|
const isMobile = width ? width < breakpoints.md : false
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
|
2021-07-24 11:12:52 -07:00
|
|
|
const renderTradeDateTime = (timestamp: BN | string) => {
|
|
|
|
let date
|
|
|
|
if (timestamp instanceof BN) {
|
|
|
|
date = new Date(timestamp.toNumber() * 1000)
|
|
|
|
} else {
|
|
|
|
date = new Date(timestamp)
|
|
|
|
}
|
|
|
|
|
2021-04-22 05:33:35 -07:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div>{date.toLocaleDateString()}</div>
|
|
|
|
<div className="text-xs text-th-fgd-3">{date.toLocaleTimeString()}</div>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
2021-04-07 14:49:37 -07:00
|
|
|
|
2021-09-13 09:28:53 -07:00
|
|
|
const filteredTrades = numTrades ? items.slice(0, numTrades) : items
|
|
|
|
|
2021-04-07 14:49:37 -07:00
|
|
|
return (
|
2021-09-07 21:12:49 -07:00
|
|
|
<div className="flex flex-col pb-2 pt-4">
|
2021-07-24 13:15:27 -07:00
|
|
|
<div className="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
|
|
<div className="align-middle inline-block min-w-full sm:px-6 lg:px-8">
|
2021-04-13 09:57:58 -07:00
|
|
|
{tradeHistory && tradeHistory.length ? (
|
2021-09-07 21:12:49 -07:00
|
|
|
!isMobile ? (
|
|
|
|
<Table>
|
|
|
|
<thead>
|
|
|
|
<TrHead>
|
|
|
|
<Th>
|
2021-07-27 09:22:50 -07:00
|
|
|
<LinkButton
|
2021-08-22 05:45:10 -07:00
|
|
|
className="flex items-center no-underline font-normal"
|
2021-07-27 09:22:50 -07:00
|
|
|
onClick={() => requestSort('market')}
|
|
|
|
>
|
|
|
|
Market
|
|
|
|
<ArrowSmDownIcon
|
|
|
|
className={`default-transition flex-shrink-0 h-4 w-4 ml-1 ${
|
|
|
|
sortConfig?.key === 'market'
|
|
|
|
? sortConfig.direction === 'ascending'
|
|
|
|
? 'transform rotate-180'
|
|
|
|
: 'transform rotate-360'
|
|
|
|
: null
|
|
|
|
}`}
|
|
|
|
/>
|
|
|
|
</LinkButton>
|
|
|
|
</Th>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Th>
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
<LinkButton
|
2021-08-22 05:45:10 -07:00
|
|
|
className="flex items-center no-underline font-normal"
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
onClick={() => requestSort('side')}
|
|
|
|
>
|
|
|
|
Side
|
|
|
|
<ArrowSmDownIcon
|
|
|
|
className={`default-transition flex-shrink-0 h-4 w-4 ml-1 ${
|
|
|
|
sortConfig?.key === 'side'
|
|
|
|
? sortConfig.direction === 'ascending'
|
|
|
|
? 'transform rotate-180'
|
|
|
|
: 'transform rotate-360'
|
|
|
|
: null
|
|
|
|
}`}
|
|
|
|
/>
|
|
|
|
</LinkButton>
|
2021-04-20 07:19:08 -07:00
|
|
|
</Th>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Th>
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
<LinkButton
|
2021-08-22 05:45:10 -07:00
|
|
|
className="flex items-center no-underline font-normal"
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
onClick={() => requestSort('size')}
|
|
|
|
>
|
|
|
|
Size
|
|
|
|
<ArrowSmDownIcon
|
|
|
|
className={`default-transition flex-shrink-0 h-4 w-4 ml-1 ${
|
|
|
|
sortConfig?.key === 'size'
|
|
|
|
? sortConfig.direction === 'ascending'
|
|
|
|
? 'transform rotate-180'
|
|
|
|
: 'transform rotate-360'
|
|
|
|
: null
|
|
|
|
}`}
|
|
|
|
/>
|
|
|
|
</LinkButton>
|
2021-04-20 07:19:08 -07:00
|
|
|
</Th>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Th>
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
<LinkButton
|
2021-08-22 05:45:10 -07:00
|
|
|
className="flex items-center no-underline font-normal"
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
onClick={() => requestSort('price')}
|
|
|
|
>
|
|
|
|
Price
|
|
|
|
<ArrowSmDownIcon
|
|
|
|
className={`default-transition flex-shrink-0 h-4 w-4 ml-1 ${
|
|
|
|
sortConfig?.key === 'price'
|
|
|
|
? sortConfig.direction === 'ascending'
|
|
|
|
? 'transform rotate-180'
|
|
|
|
: 'transform rotate-360'
|
|
|
|
: null
|
|
|
|
}`}
|
|
|
|
/>
|
|
|
|
</LinkButton>
|
2021-04-20 07:19:08 -07:00
|
|
|
</Th>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Th>
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
<LinkButton
|
2021-08-22 05:45:10 -07:00
|
|
|
className="flex items-center no-underline font-normal"
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
onClick={() => requestSort('value')}
|
|
|
|
>
|
|
|
|
Value
|
|
|
|
<ArrowSmDownIcon
|
|
|
|
className={`default-transition flex-shrink-0 h-4 w-4 ml-1 ${
|
|
|
|
sortConfig?.key === 'value'
|
|
|
|
? sortConfig.direction === 'ascending'
|
|
|
|
? 'transform rotate-180'
|
|
|
|
: 'transform rotate-360'
|
|
|
|
: null
|
|
|
|
}`}
|
|
|
|
/>
|
|
|
|
</LinkButton>
|
2021-04-20 07:19:08 -07:00
|
|
|
</Th>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Th>
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
<LinkButton
|
2021-08-22 05:45:10 -07:00
|
|
|
className="flex items-center no-underline font-normal"
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
onClick={() => requestSort('liquidity')}
|
|
|
|
>
|
|
|
|
Liquidity
|
|
|
|
<ArrowSmDownIcon
|
|
|
|
className={`default-transition flex-shrink-0 h-4 w-4 ml-1 ${
|
|
|
|
sortConfig?.key === 'liquidity'
|
|
|
|
? sortConfig.direction === 'ascending'
|
|
|
|
? 'transform rotate-180'
|
|
|
|
: 'transform rotate-360'
|
|
|
|
: null
|
|
|
|
}`}
|
|
|
|
/>
|
|
|
|
</LinkButton>
|
2021-04-20 07:19:08 -07:00
|
|
|
</Th>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Th>
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
<LinkButton
|
2021-08-22 05:45:10 -07:00
|
|
|
className="flex items-center no-underline font-normal"
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
onClick={() => requestSort('feeCost')}
|
|
|
|
>
|
|
|
|
Fee
|
|
|
|
<ArrowSmDownIcon
|
|
|
|
className={`default-transition flex-shrink-0 h-4 w-4 ml-1 ${
|
|
|
|
sortConfig?.key === 'feeCost'
|
|
|
|
? sortConfig.direction === 'ascending'
|
|
|
|
? 'transform rotate-180'
|
|
|
|
: 'transform rotate-360'
|
|
|
|
: null
|
|
|
|
}`}
|
|
|
|
/>
|
|
|
|
</LinkButton>
|
2021-04-20 07:19:08 -07:00
|
|
|
</Th>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Th>
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
<LinkButton
|
2021-08-22 05:45:10 -07:00
|
|
|
className="flex items-center no-underline font-normal"
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
onClick={() => requestSort('loadTimestamp')}
|
|
|
|
>
|
2021-07-24 11:12:52 -07:00
|
|
|
Approx Time
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
<ArrowSmDownIcon
|
|
|
|
className={`default-transition flex-shrink-0 h-4 w-4 ml-1 ${
|
|
|
|
sortConfig?.key === 'loadTimestamp'
|
|
|
|
? sortConfig.direction === 'ascending'
|
|
|
|
? 'transform rotate-180'
|
|
|
|
: 'transform rotate-360'
|
|
|
|
: null
|
|
|
|
}`}
|
|
|
|
/>
|
|
|
|
</LinkButton>
|
2021-04-20 07:19:08 -07:00
|
|
|
</Th>
|
2021-09-07 21:12:49 -07:00
|
|
|
</TrHead>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2021-09-13 09:28:53 -07:00
|
|
|
{filteredTrades.map((trade: any, index) => (
|
2021-09-07 21:12:49 -07:00
|
|
|
<TrBody
|
|
|
|
index={index}
|
2021-08-23 15:37:48 -07:00
|
|
|
key={`${trade.seqNum}${trade.marketName}`}
|
2021-04-07 14:49:37 -07:00
|
|
|
>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Td>
|
2021-07-27 09:22:50 -07:00
|
|
|
<div className="flex items-center">
|
|
|
|
<img
|
|
|
|
alt=""
|
|
|
|
width="20"
|
|
|
|
height="20"
|
|
|
|
src={`/assets/icons/${trade.marketName
|
|
|
|
.split(/-|\//)[0]
|
|
|
|
.toLowerCase()}.svg`}
|
|
|
|
className={`mr-2.5`}
|
|
|
|
/>
|
|
|
|
<div>{trade.marketName}</div>
|
|
|
|
</div>
|
|
|
|
</Td>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Td>
|
2021-04-20 07:19:08 -07:00
|
|
|
<SideBadge side={trade.side} />
|
|
|
|
</Td>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Td>{trade.size}</Td>
|
2021-09-07 21:34:52 -07:00
|
|
|
<Td>{formatUsdValue(trade.price)}</Td>
|
2021-09-07 21:12:49 -07:00
|
|
|
<Td>{formatUsdValue(trade.value)}</Td>
|
|
|
|
<Td>{trade.liquidity}</Td>
|
|
|
|
<Td>{formatUsdValue(trade.feeCost)}</Td>
|
|
|
|
<Td>
|
2021-07-24 11:12:52 -07:00
|
|
|
{trade.loadTimestamp || trade.timestamp
|
|
|
|
? renderTradeDateTime(
|
|
|
|
trade.loadTimestamp || trade.timestamp
|
|
|
|
)
|
2021-04-13 16:41:04 -07:00
|
|
|
: 'Recent'}
|
2021-04-20 07:19:08 -07:00
|
|
|
</Td>
|
2021-09-07 21:12:49 -07:00
|
|
|
</TrBody>
|
2021-04-07 14:49:37 -07:00
|
|
|
))}
|
2021-09-07 21:12:49 -07:00
|
|
|
</tbody>
|
2021-04-20 07:19:08 -07:00
|
|
|
</Table>
|
2021-09-07 21:12:49 -07:00
|
|
|
) : (
|
2021-09-19 17:36:02 -07:00
|
|
|
items.map((trade: any, index) => (
|
|
|
|
<ExpandableRow
|
|
|
|
buttonTemplate={
|
|
|
|
<>
|
|
|
|
<div className="col-span-11 flex items-center text-fgd-1">
|
|
|
|
<div className="flex items-center">
|
|
|
|
<img
|
|
|
|
alt=""
|
|
|
|
width="20"
|
|
|
|
height="20"
|
|
|
|
src={`/assets/icons/${trade.marketName
|
|
|
|
.split(/-|\//)[0]
|
|
|
|
.toLowerCase()}.svg`}
|
|
|
|
className={`mr-2.5`}
|
|
|
|
/>
|
|
|
|
<div>
|
|
|
|
<div className="mb-0.5 text-left">
|
|
|
|
{trade.marketName}
|
|
|
|
</div>
|
|
|
|
<div className="text-th-fgd-3 text-xs">
|
|
|
|
<span
|
|
|
|
className={`mr-1
|
2021-09-07 21:12:49 -07:00
|
|
|
${
|
|
|
|
trade.side === 'buy' || trade.side === 'long'
|
|
|
|
? 'text-th-green'
|
|
|
|
: 'text-th-red'
|
|
|
|
}
|
|
|
|
`}
|
2021-09-19 17:36:02 -07:00
|
|
|
>
|
|
|
|
{trade.side.toUpperCase()}
|
|
|
|
</span>
|
|
|
|
{`${trade.size} at ${formatUsdValue(
|
|
|
|
trade.price
|
|
|
|
)}`}
|
2021-09-07 21:12:49 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-09-19 17:36:02 -07:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
key={`${index}`}
|
|
|
|
index={index}
|
|
|
|
panelTemplate={
|
|
|
|
<>
|
|
|
|
<div className="col-span-1 text-left">
|
|
|
|
<div className="pb-0.5 text-th-fgd-3 text-xs">
|
|
|
|
Value
|
2021-09-07 21:12:49 -07:00
|
|
|
</div>
|
2021-09-19 17:36:02 -07:00
|
|
|
{formatUsdValue(trade.value)}
|
|
|
|
</div>
|
|
|
|
<div className="col-span-1 text-left">
|
|
|
|
<div className="pb-0.5 text-th-fgd-3 text-xs">
|
|
|
|
Liquidity
|
2021-09-07 21:12:49 -07:00
|
|
|
</div>
|
2021-09-19 17:36:02 -07:00
|
|
|
{trade.liquidity}
|
|
|
|
</div>
|
|
|
|
<div className="col-span-1 text-left">
|
|
|
|
<div className="pb-0.5 text-th-fgd-3 text-xs">Fee</div>
|
|
|
|
{formatUsdValue(trade.feeCost)}
|
|
|
|
</div>
|
|
|
|
<div className="col-span-1 text-left">
|
|
|
|
<div className="pb-0.5 text-th-fgd-3 text-xs">
|
|
|
|
Approx Time
|
2021-09-07 21:12:49 -07:00
|
|
|
</div>
|
2021-09-19 17:36:02 -07:00
|
|
|
{trade.loadTimestamp || trade.timestamp
|
|
|
|
? renderTradeDateTime(
|
|
|
|
trade.loadTimestamp || trade.timestamp
|
|
|
|
)
|
|
|
|
: 'Recent'}
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
))
|
2021-09-07 21:12:49 -07:00
|
|
|
)
|
2021-04-07 14:49:37 -07:00
|
|
|
) : (
|
2021-07-24 13:15:27 -07:00
|
|
|
<div className="w-full text-center py-6 bg-th-bkg-1 text-th-fgd-3 rounded-md">
|
2021-08-15 10:06:52 -07:00
|
|
|
No trade history
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
{asPath === '/account' ? (
|
|
|
|
<Link href={'/'}>
|
2021-07-24 13:15:27 -07:00
|
|
|
<a className="inline-flex ml-2 py-0">Make a trade</a>
|
User account page (#22)
* layout, overview, start on assets, borrows and open orders
* trade history, sortable data hook for tables, borrow page
* handle deposit and withdraw buttons
* borrow modal ui and integration + settle borrow for individual assets
* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks
* account switch/creation flow
* accounts modal, update to usebalances hook
* handle settle, deposit before settle, save last account
* disable borrow/withdraw button when no account
2021-06-05 07:11:44 -07:00
|
|
|
</Link>
|
|
|
|
) : null}
|
2021-04-07 14:49:37 -07:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2021-09-13 09:28:53 -07:00
|
|
|
<div className="flex items-center">
|
|
|
|
{numTrades && items.length > numTrades ? (
|
|
|
|
<div className="mx-auto mt-4">
|
|
|
|
<Link href="/account">View all trades in the Account page</Link>
|
|
|
|
</div>
|
|
|
|
) : null}
|
|
|
|
</div>
|
2021-04-07 14:49:37 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TradeHistoryTable
|