Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
torztomasz committed Oct 29, 2024
1 parent 646e63f commit 7dfc471
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/frontend/src/view/pages/user/UserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function UserPage(props: UserPageProps) {
user={props.context.user}
starkKey={props.starkKey}
chainId={props.context.chainId}
collateralAsset={props.context.tradingMode === 'perpetual' ? props.context.collateralAsset : undefined}
ethereumAddress={props.ethereumAddress}
positionValue={props.positionValue}
/>
Expand Down
10 changes: 6 additions & 4 deletions packages/frontend/src/view/pages/user/components/UserProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UserDetails } from '@explorer/shared'
import { AssetId, EthereumAddress, StarkKey } from '@explorer/types'
import { CollateralAsset, UserDetails } from '@explorer/shared'
import { EthereumAddress, StarkKey } from '@explorer/types'
import React from 'react'

import { assetToInfo } from '../../../../utils/assets'
Expand All @@ -18,6 +18,7 @@ interface UserProfileProps {
user: Partial<UserDetails> | undefined
starkKey: StarkKey
chainId: number
collateralAsset: CollateralAsset | undefined
positionValue: bigint | undefined
ethereumAddress?: EthereumAddress
}
Expand All @@ -28,6 +29,7 @@ export function UserProfile({
chainId,
ethereumAddress,
positionValue,
collateralAsset
}: UserProfileProps) {
const isMine = user?.starkKey === starkKey
return (
Expand Down Expand Up @@ -86,7 +88,7 @@ export function UserProfile({
)}
</>
)}
{positionValue ? (
{positionValue && collateralAsset ? (
<>
<p className="mb-1.5 mt-6 flex items-center gap-0.5 text-sm font-semibold text-zinc-500">
Estimated position value{' '}
Expand All @@ -97,7 +99,7 @@ export function UserProfile({
<div className="flex items-center gap-2 font-semibold text-white">
{formatWithDecimals(positionValue, 2)}{' '}
<AssetWithLogo
assetInfo={assetToInfo({ hashOrId: AssetId('USDC-6') })}
assetInfo={assetToInfo({ hashOrId: collateralAsset.assetId })}
type="small"
/>
</div>
Expand Down

0 comments on commit 7dfc471

Please sign in to comment.