Skip to content

Commit

Permalink
Total rays earned portfolio (#3955)
Browse files Browse the repository at this point in the history
  • Loading branch information
piekczyk committed Jun 18, 2024
1 parent ddc923f commit a9e87f6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/portfolio/PortfolioOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PortfolioOverviewItem } from 'components/portfolio/PortfolioOverviewIte
import { Tag } from 'components/Tag'
import { WithArrow } from 'components/WithArrow'
import type { PortfolioPosition } from 'handlers/portfolio/types'
import { getLocalAppConfig } from 'helpers/config'
import { getLocalAppConfig, useAppConfig } from 'helpers/config'
import { formatCryptoBalance } from 'helpers/formatters/format'
import { getGradientColor, summerBrandGradient } from 'helpers/getGradientColor'
import { isTouchDevice } from 'helpers/isTouchDevice'
Expand All @@ -27,7 +27,9 @@ export const PortfolioOverview = ({
}) => {
const { t: tPortfolio } = useTranslation('portfolio')
const isMobile = useOnMobile() && isTouchDevice
const { Rays: isRaysEnabled } = useAppConfig('features')

const totalRays = portfolioWalletData.totalRaysEarned
const totalValue = overviewData.allAssetsUsdValue + portfolioWalletData.totalAssetsUsdValue
const availableToMigrateUsdValue =
migrationPositions == null
Expand Down Expand Up @@ -59,6 +61,16 @@ export const PortfolioOverview = ({
columnGap: '24px',
}}
>
{isRaysEnabled && totalRays && (
<PortfolioOverviewItem
header={tPortfolio('total-rays-earned')}
value={
<Heading variant="header4" sx={getGradientColor(summerBrandGradient)}>
{formatCryptoBalance(new BigNumber(totalRays)).split('.')[0]}
</Heading>
}
/>
)}
<PortfolioOverviewItem
header={tPortfolio('total-portfolio')}
value={
Expand Down
1 change: 1 addition & 0 deletions components/portfolio/types/domain-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export type PortfolioAssetsResponse = {
totalAssetsUsdValue: number
totalAssetsPercentageChange: number
assets: PortfolioWalletAsset[]
totalRaysEarned: number
}
1 change: 1 addition & 0 deletions public/locales/en/portfolio.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"total-value": "Total Value",
"view-assets": "View Assets",
"total-portfolio": "Summer.fi Portfolio",
"total-rays-earned": "Total Rays Earned",
"total-supplied": "Total Supplied",
"total-borrowed": "Total Borrowed",
"total-supplied-mobile": "Total Supplied on Summer",
Expand Down

0 comments on commit a9e87f6

Please sign in to comment.