Portfolio fix (#809)
* fix: fixed the portfolio account detail page layout * fix: fixed portfolio cards * tidy: refactor
This commit is contained in:
parent
0154065ffb
commit
6946ceddfc
@ -63,16 +63,22 @@ export default function HealthBar({
|
|||||||
health={isUpdated ? updatedHealth : health}
|
health={isUpdated ? updatedHealth : health}
|
||||||
healthFactor={isUpdated ? updatedHealthFactor : healthFactor}
|
healthFactor={isUpdated ? updatedHealthFactor : healthFactor}
|
||||||
>
|
>
|
||||||
<>
|
<div className={classNames('flex w-full', showIcon && 'gap-2')}>
|
||||||
{showIcon && (
|
{showIcon && (
|
||||||
<HealthIcon
|
<HealthIcon
|
||||||
health={health}
|
health={health}
|
||||||
isLoading={healthFactor === 0}
|
isLoading={healthFactor === 0}
|
||||||
className={classNames('mr-2', iconClassName)}
|
className={iconClassName}
|
||||||
colorClass='text-white'
|
colorClass='text-white'
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className={classNames('flex w-full', 'rounded-full overflow-hidden', className)}>
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'flex w-full flex-shrink',
|
||||||
|
'rounded-full overflow-hidden',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
version='1.1'
|
version='1.1'
|
||||||
xmlns='http://www.w3.org/2000/svg'
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
@ -153,7 +159,7 @@ export default function HealthBar({
|
|||||||
)}
|
)}
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</div>
|
||||||
</HealthTooltip>
|
</HealthTooltip>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { ExclamationMarkCircled, Heart } from 'components/common/Icons'
|
|||||||
interface Props {
|
interface Props {
|
||||||
isLoading: boolean
|
isLoading: boolean
|
||||||
health: number
|
health: number
|
||||||
className: string
|
className?: string
|
||||||
colorClass?: string
|
colorClass?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,9 +14,9 @@ export default function HealthIcon(props: Props) {
|
|||||||
const color = colorClass ?? 'text-white'
|
const color = colorClass ?? 'text-white'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className='w-5'>
|
||||||
{!isLoading && health === 0 ? (
|
{!isLoading && health === 0 ? (
|
||||||
<ExclamationMarkCircled className={classNames('w-5 text-loss animate-pulse', className)} />
|
<ExclamationMarkCircled className={classNames(' text-loss animate-pulse', className)} />
|
||||||
) : (
|
) : (
|
||||||
<Heart
|
<Heart
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@ -26,6 +26,6 @@ export default function HealthIcon(props: Props) {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ export const Tooltip = (props: Props) => {
|
|||||||
visible={props.visible}
|
visible={props.visible}
|
||||||
>
|
>
|
||||||
{props.children ? (
|
{props.children ? (
|
||||||
<span
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
props.underline &&
|
props.underline &&
|
||||||
'border-b hover:cursor-help border-dashed border-white/20 pb-1 hover:border-transparent',
|
'border-b hover:cursor-help border-dashed border-white/20 pb-1 hover:border-transparent',
|
||||||
@ -57,7 +57,7 @@ export const Tooltip = (props: Props) => {
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</span>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<span
|
<span
|
||||||
className={classNames(
|
className={classNames(
|
||||||
|
@ -19,7 +19,9 @@ export default function PortfolioAccountPageHeader(props: Props) {
|
|||||||
<NavLink to={getRoute('portfolio', searchParams, address, selectedAccountId)}>
|
<NavLink to={getRoute('portfolio', searchParams, address, selectedAccountId)}>
|
||||||
<Text className='text-white/40'>Portfolio</Text>
|
<Text className='text-white/40'>Portfolio</Text>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<ArrowRight className='h-3 text-white/60 ' />
|
<div className='h-3'>
|
||||||
|
<ArrowRight className='h-3 text-white/60 ' />
|
||||||
|
</div>
|
||||||
<Text tag='span'>Credit Account {props.accountId}</Text>
|
<Text tag='span'>Credit Account {props.accountId}</Text>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -2,9 +2,9 @@ import React from 'react'
|
|||||||
|
|
||||||
import HealthBar from 'components/account/Health/HealthBar'
|
import HealthBar from 'components/account/Health/HealthBar'
|
||||||
import Card from 'components/common/Card'
|
import Card from 'components/common/Card'
|
||||||
import HLSTag from 'components/hls/HLSTag'
|
|
||||||
import Text from 'components/common/Text'
|
import Text from 'components/common/Text'
|
||||||
import TitleAndSubCell from 'components/common/TitleAndSubCell'
|
import TitleAndSubCell from 'components/common/TitleAndSubCell'
|
||||||
|
import HLSTag from 'components/hls/HLSTag'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
stats: { title: React.ReactNode; sub: string }[]
|
stats: { title: React.ReactNode; sub: string }[]
|
||||||
@ -33,7 +33,7 @@ export default function Skeleton(props: Props) {
|
|||||||
<TitleAndSubCell key={`${accountId}-${sub}`} title={title} sub={sub} />
|
<TitleAndSubCell key={`${accountId}-${sub}`} title={title} sub={sub} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className='flex gap-1 mt-6'>
|
<div className='flex mt-6'>
|
||||||
<HealthBar health={health} healthFactor={healthFactor} showIcon />
|
<HealthBar health={health} healthFactor={healthFactor} showIcon />
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -3,10 +3,10 @@ import React from 'react'
|
|||||||
import HealthBar from 'components/account/Health/HealthBar'
|
import HealthBar from 'components/account/Health/HealthBar'
|
||||||
import HealthIcon from 'components/account/Health/HealthIcon'
|
import HealthIcon from 'components/account/Health/HealthIcon'
|
||||||
import Card from 'components/common/Card'
|
import Card from 'components/common/Card'
|
||||||
import HLSTag from 'components/hls/HLSTag'
|
|
||||||
import Loading from 'components/common/Loading'
|
import Loading from 'components/common/Loading'
|
||||||
import Text from 'components/common/Text'
|
import Text from 'components/common/Text'
|
||||||
import TitleAndSubCell from 'components/common/TitleAndSubCell'
|
import TitleAndSubCell from 'components/common/TitleAndSubCell'
|
||||||
|
import HLSTag from 'components/hls/HLSTag'
|
||||||
import useAccount from 'hooks/accounts/useAccount'
|
import useAccount from 'hooks/accounts/useAccount'
|
||||||
import { DEFAULT_PORTFOLIO_STATS } from 'utils/constants'
|
import { DEFAULT_PORTFOLIO_STATS } from 'utils/constants'
|
||||||
|
|
||||||
@ -31,9 +31,11 @@ export default function SummarySkeleton(props: Props) {
|
|||||||
{account?.kind === 'high_levered_strategy' && <HLSTag />}
|
{account?.kind === 'high_levered_strategy' && <HLSTag />}
|
||||||
</div>
|
</div>
|
||||||
{health !== undefined && healthFactor !== undefined && (
|
{health !== undefined && healthFactor !== undefined && (
|
||||||
<div className='flex gap-1 max-w-[300px] flex-grow'>
|
<div className='flex items-center justify-end flex-grow gap-2'>
|
||||||
<HealthIcon isLoading={healthFactor === 0} health={health} className='w-5' />
|
<HealthIcon isLoading={healthFactor === 0} health={health} />
|
||||||
<HealthBar health={health} healthFactor={healthFactor} className='h-full' />
|
<div className='w-[260px]'>
|
||||||
|
<HealthBar health={health} healthFactor={healthFactor} className='h-3' />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user