This commit is contained in:
Finn 2024-05-07 23:35:09 +02:00 committed by Maximilian Schneider
parent bdfd9ff466
commit fb23b86b7c
2 changed files with 35 additions and 5 deletions

View File

@ -55,7 +55,7 @@ const CollateralFeeWarningModal = ({ isOpen }: WarningProps) => {
<thead>
<TrHead>
<Th className="text-left">{t('collateral')}</Th>
<Th className="text-right">{t('funding-rate')} (APR)</Th>
<Th className="text-right">{t('funding-rate')} Per Day</Th>
<Th>
<div className="flex justify-end">{t('daily-fee')}</div>
</Th>
@ -72,10 +72,7 @@ const CollateralFeeWarningModal = ({ isOpen }: WarningProps) => {
</Td>
<Td>
<p className="text-right">
{(ltvRatio * bank.collateralFeePerDay * 365 * 100).toFixed(
2,
)}
%
{(ltvRatio * bank.collateralFeePerDay * 100).toFixed(4)}%
</p>
</Td>
<Td>

View File

@ -74,6 +74,33 @@ const Prospective: NextPage = () => {
return []
}, [tokensList])
const downloadTokens = () => {
let csvContent = 'data:text/csv;charset=utf-8,'
const filteredTokens = tokensList.filter(
(token) => !bankNames.includes(token.symbol.toUpperCase()),
)
if (filteredTokens.length > 0) {
const headers = Object.keys(filteredTokens[0]).join(',')
const rows = filteredTokens.map((token) =>
Object.values(token)
.map(
(value) => `"${value?.toString().replace(/"/g, '""')}"`, // Handle quotes in data
)
.join(','),
)
csvContent += headers + '\n' + rows.join('\n')
}
const encodedUri = encodeURI(csvContent)
const link = document.createElement('a')
link.setAttribute('href', encodedUri)
link.setAttribute('download', 'non_bank_tokens.csv')
document.body.appendChild(link) // Required for FF
link.click()
document.body.removeChild(link)
}
return (
<div className="col-span-12 w-full lg:col-span-8 lg:col-start-3">
<DashboardNavbar />
@ -82,6 +109,12 @@ const Prospective: NextPage = () => {
<p className="flex items-center space-x-4 text-th-fgd-4">
<span>Hidden Gems to Prospect On</span>
</p>
<button
onClick={downloadTokens}
className="rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600"
>
Download
</button>
</div>
<div className="w-full overflow-scroll" style={{ maxHeight: '70vh' }}>
<Table className="h-full">