-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tangle-dapp): Update restaking page organization (#2711)
- Loading branch information
1 parent
b1e678a
commit f671e21
Showing
95 changed files
with
1,439 additions
and
1,794 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
apps/tangle-dapp/src/components/LiquidStaking/LstListItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { FC } from 'react'; | ||
import LstIcon from './LstIcon'; | ||
import { | ||
AmountFormatStyle, | ||
EMPTY_VALUE_PLACEHOLDER, | ||
formatDisplayAmount, | ||
Typography, | ||
} from '@webb-tools/webb-ui-components'; | ||
import { LsPool } from '../../constants/liquidStaking/types'; | ||
import { LstIconSize } from './types'; | ||
import formatFractional from '@webb-tools/webb-ui-components/utils/formatFractional'; | ||
import getLsProtocolDef from '../../utils/liquidStaking/getLsProtocolDef'; | ||
import LogoListItem from '../Lists/LogoListItem'; | ||
|
||
type Props = { | ||
pool: LsPool; | ||
isSelfStaked: boolean; | ||
}; | ||
|
||
const LstListItem: FC<Props> = ({ pool, isSelfStaked }) => { | ||
const lsProtocol = getLsProtocolDef(pool.protocolId); | ||
|
||
const fmtStakeAmount = formatDisplayAmount( | ||
pool.totalStaked, | ||
lsProtocol.decimals, | ||
AmountFormatStyle.SI, | ||
); | ||
|
||
const fmtCommission = | ||
pool.commissionFractional === undefined | ||
? undefined | ||
: `${formatFractional(pool.commissionFractional)} commission`; | ||
|
||
const stakeText = `${fmtStakeAmount} ${lsProtocol.token}`; | ||
|
||
return ( | ||
<LogoListItem | ||
leftUpperContent={ | ||
<Typography | ||
variant="body1" | ||
fw="bold" | ||
className="block text-mono-200 dark:text-mono-0" | ||
> | ||
{pool.name?.toUpperCase()} | ||
<span className="text-mono-180 dark:text-mono-120">#{pool.id}</span> | ||
</Typography> | ||
} | ||
leftBottomContent={`${stakeText} ${isSelfStaked ? 'self ' : ''}staked`} | ||
rightUpperText={`${pool.apyPercentage ?? EMPTY_VALUE_PLACEHOLDER}% APY`} | ||
rightBottomText={fmtCommission} | ||
logo={ | ||
<LstIcon | ||
lsProtocolId={pool.protocolId} | ||
iconUrl={pool.iconUrl} | ||
size={LstIconSize.LG} | ||
/> | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
export default LstListItem; |
Oops, something went wrong.