update liquidation display in activity feed

This commit is contained in:
saml33 2022-12-30 11:04:23 +11:00
parent 74565aef7f
commit d6867732f7
12 changed files with 32 additions and 11 deletions

View File

@ -463,7 +463,7 @@ const ActivityDetails = ({
PREFERRED_EXPLORER_KEY,
EXPLORERS[0]
)
const { block_datetime } = activity
const { block_datetime, activity_type } = activity
const {
asset_amount,
asset_price,
@ -484,7 +484,7 @@ const ActivityDetails = ({
</IconButton>
<h2 className="text-lg">{t('activity:liquidation-details')}</h2>
</div>
<div className="grid grid-cols-1 gap-4 px-6 lg:grid-cols-3">
<div className="grid grid-cols-1 gap-4 px-6 md:grid-cols-2">
<div className="col-span-1">
<p className="mb-0.5 text-sm">{t('date')}</p>
<p className="text-th-fgd-1">
@ -494,6 +494,14 @@ const ActivityDetails = ({
{dayjs(block_datetime).format('h:mma')}
</p>
</div>
<div className="col-span-1">
<p className="mb-0.5 text-sm">{t('activity:liquidation-type')}</p>
<p className="text-th-fgd-1">
{activity_type === 'liquidate_token_with_token'
? t('spot')
: t('perp')}
</p>
</div>
<div className="col-span-1">
<p className="mb-0.5 text-sm">{t('activity:asset-liquidated')}</p>
<p className="font-mono text-th-fgd-1">
@ -525,7 +533,7 @@ const ActivityDetails = ({
</div>
<div className="col-span-3 mt-8 flex justify-center border-y border-th-bkg-3 py-3">
<a
className="default-transition flex items-center text-th-fgd-1 hover:text-th-fgd-3"
className="default-transition flex items-center text-th-fgd-2 hover:text-th-fgd-3"
href={`${preferredExplorer.url}${signature}`}
target="_blank"
rel="noopener noreferrer"
@ -536,9 +544,7 @@ const ActivityDetails = ({
height="20"
src={`/explorer-logos/${preferredExplorer.name}.png`}
/>
<span className="ml-2 text-base">{`View on ${t(
`settings:${preferredExplorer.name}`
)}`}</span>
<span className="ml-2 text-base">{t('view-transaction')}</span>
</a>
</div>
</div>

View File

@ -68,12 +68,12 @@ const ActivityFeedTable = ({
if (side === 'liqee') {
credit = { value: formatDecimal(liab_amount), symbol: liab_symbol }
debit = {
value: formatDecimal(asset_amount * -1),
value: formatDecimal(asset_amount),
symbol: asset_symbol,
}
} else {
credit = { value: formatDecimal(asset_amount), symbol: asset_symbol }
debit = { value: formatDecimal(liab_amount * -1), symbol: liab_symbol }
debit = { value: formatDecimal(liab_amount), symbol: liab_symbol }
}
}
if (activity_type === 'deposit') {
@ -117,9 +117,9 @@ const ActivityFeedTable = ({
const { side, liab_amount, liab_price, asset_amount, asset_price } =
activity.activity_details
if (side === 'liqee') {
value = asset_amount * asset_price - liab_amount * liab_price
value = asset_amount * asset_price
} else {
value = liab_amount * liab_price - asset_amount * asset_price
value = liab_amount * liab_price
}
}
if (activity_type === 'deposit' || activity_type === 'withdraw') {
@ -169,7 +169,7 @@ const ActivityFeedTable = ({
const isLiquidation =
activity_type === 'liquidate_token_with_token'
const activityName = isLiquidation
? 'liquidation'
? 'spot-liquidation'
: activity_type
const amounts = getCreditAndDebit(activity)
const value = getValue(activity)

View File

@ -12,6 +12,7 @@
"deposits": "Deposits",
"filter-results": "Filter Results",
"liquidation": "Liquidation",
"liquidation-type": "Liquidation Type",
"liquidations": "Liquidations",
"liquidation-details": "Liquidation Details",
"no-activity": "No account activity",
@ -19,6 +20,7 @@
"perp_trade": "Perp",
"reset-filters": "Reset Filters",
"select-tokens": "Select Tokens",
"spot-liquidation": "Spot Liquidation",
"swap": "Swap",
"swaps": "Swaps",
"update": "Update",

View File

@ -130,6 +130,7 @@
"updating-account-name": "Updating Account Name...",
"utilization": "Utilization",
"value": "Value",
"view-transaction": "View Transaction",
"wallet-address": "Wallet Address",
"wallet-balance": "Wallet Balance",
"wallet-disconnected": "Disconnected from wallet",

View File

@ -12,6 +12,7 @@
"deposits": "Deposits",
"filter-results": "Filter Results",
"liquidation": "Liquidation",
"liquidation-type": "Liquidation Type",
"liquidations": "Liquidations",
"liquidation-details": "Liquidation Details",
"no-activity": "No account activity",
@ -19,6 +20,7 @@
"perp_trade": "Perp",
"reset-filters": "Reset Filters",
"select-tokens": "Select Tokens",
"spot-liquidation": "Spot Liquidation",
"swap": "Swap",
"swaps": "Swaps",
"update": "Update",

View File

@ -130,6 +130,7 @@
"updating-account-name": "Updating Account Name...",
"utilization": "Utilization",
"value": "Value",
"view-transaction": "View Transaction",
"wallet-address": "Wallet Address",
"wallet-balance": "Wallet Balance",
"wallet-disconnected": "Disconnected from wallet",

View File

@ -12,6 +12,7 @@
"deposits": "Deposits",
"filter-results": "Filter Results",
"liquidation": "Liquidation",
"liquidation-type": "Liquidation Type",
"liquidations": "Liquidations",
"liquidation-details": "Liquidation Details",
"no-activity": "No account activity",
@ -19,6 +20,7 @@
"perp_trade": "Perp",
"reset-filters": "Reset Filters",
"select-tokens": "Select Tokens",
"spot-liquidation": "Spot Liquidation",
"swap": "Swap",
"swaps": "Swaps",
"update": "Update",

View File

@ -130,6 +130,7 @@
"updating-account-name": "Updating Account Name...",
"utilization": "Utilization",
"value": "Value",
"view-transaction": "View Transaction",
"wallet-address": "Wallet Address",
"wallet-balance": "Wallet Balance",
"wallet-disconnected": "Disconnected from wallet",

View File

@ -12,6 +12,7 @@
"deposits": "Deposits",
"filter-results": "Filter Results",
"liquidation": "Liquidation",
"liquidation-type": "Liquidation Type",
"liquidations": "Liquidations",
"liquidation-details": "Liquidation Details",
"no-activity": "No account activity",
@ -19,6 +20,7 @@
"perp_trade": "Perp",
"reset-filters": "Reset Filters",
"select-tokens": "Select Tokens",
"spot-liquidation": "Spot Liquidation",
"swap": "Swap",
"swaps": "Swaps",
"update": "Update",

View File

@ -130,6 +130,7 @@
"updating-account-name": "Updating Account Name...",
"utilization": "Utilization",
"value": "Value",
"view-transaction": "View Transaction",
"wallet-address": "Wallet Address",
"wallet-balance": "Wallet Balance",
"wallet-disconnected": "Disconnected from wallet",

View File

@ -12,6 +12,7 @@
"deposits": "Deposits",
"filter-results": "Filter Results",
"liquidation": "Liquidation",
"liquidation-type": "Liquidation Type",
"liquidations": "Liquidations",
"liquidation-details": "Liquidation Details",
"no-activity": "No account activity",
@ -19,6 +20,7 @@
"perp_trade": "Perp",
"reset-filters": "Reset Filters",
"select-tokens": "Select Tokens",
"spot-liquidation": "Spot Liquidation",
"swap": "Swap",
"swaps": "Swaps",
"update": "Update",

View File

@ -130,6 +130,7 @@
"updating-account-name": "Updating Account Name...",
"utilization": "Utilization",
"value": "Value",
"view-transaction": "View Transaction",
"wallet-address": "Wallet Address",
"wallet-balance": "Wallet Balance",
"wallet-disconnected": "Disconnected from wallet",