-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SOV-3003: Update mobile lending (#654)
* SOV-3003: Update mobile lending * Create nine-bobcats-end.md * feat: update table props --------- Co-authored-by: Peiman <[email protected]>
- Loading branch information
1 parent
60ce693
commit 45f981a
Showing
8 changed files
with
119 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"frontend": patch | ||
"@sovryn/ui": patch | ||
--- | ||
|
||
SOV-3003: Update mobile lending |
59 changes: 59 additions & 0 deletions
59
...rontend/src/app/2_molecules/FixedInterestPoolRowSubTitle/FixedInterestPoolRowSubTitle.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,59 @@ | ||
import React, { FC, useMemo } from 'react'; | ||
|
||
import { t } from 'i18next'; | ||
|
||
import { HelperButton } from '@sovryn/ui'; | ||
|
||
import { LendFrameBalance } from '../../5_pages/LendPage/components/LendFrame/components/LendFrameBalance/LendFrameBalance'; | ||
import { useGetAssetBalanceOf } from '../../5_pages/LendPage/components/LendFrame/components/LendFrameBalance/hooks/useGetAssetBalanceOf'; | ||
import { LendFrameInterestEarned } from '../../5_pages/LendPage/components/LendFrame/components/LendFrameInterestEarned/LendFrameInterestEarned'; | ||
import { NextSupplyInterestRate } from '../../5_pages/LendPage/components/NextSupplyInterestRate/NextSupplyInterestRate'; | ||
import { useAccount } from '../../../hooks/useAccount'; | ||
import { translations } from '../../../locales/i18n'; | ||
import { LendingPool } from '../../../utils/LendingPool'; | ||
|
||
type FixedInterestPoolRowSubTitleProps = { | ||
pool: LendingPool; | ||
}; | ||
|
||
export const FixedInterestPoolRowSubTitle: FC< | ||
FixedInterestPoolRowSubTitleProps | ||
> = ({ pool }) => { | ||
const asset = useMemo(() => pool.getAsset(), [pool]); | ||
const { account } = useAccount(); | ||
const { assetBalance } = useGetAssetBalanceOf(asset); | ||
|
||
if (!account || Number(assetBalance) === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="text-gray-30 text-xs font-medium bg-gray-70 rounded-b rounded-t-none px-4 pb-2 -mt-2"> | ||
<div className="flex justify-between items-center w-full mb-2"> | ||
<span className="flex items-center gap-1"> | ||
{t(translations.lendPage.table.lendApr)}{' '} | ||
<HelperButton content={t(translations.lendPage.table.lendAprInfo)} /> | ||
</span> | ||
<NextSupplyInterestRate | ||
asset={pool.getAsset()} | ||
className="text-xs pr-0" | ||
/> | ||
</div> | ||
|
||
<div className="flex justify-between items-center w-full mb-2"> | ||
<span>{t(translations.lendPage.table.balance)}</span> | ||
<LendFrameBalance pool={pool} /> | ||
</div> | ||
|
||
<div className="flex justify-between items-center w-full"> | ||
<span className="flex items-center gap-1"> | ||
{t(translations.lendPage.table.interestEarned)}{' '} | ||
<HelperButton | ||
content={t(translations.lendPage.table.interestEarnedInfo)} | ||
/> | ||
</span> | ||
<LendFrameInterestEarned pool={pool} /> | ||
</div> | ||
</div> | ||
); | ||
}; |
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
5 changes: 5 additions & 0 deletions
5
apps/frontend/src/app/5_pages/LendPage/components/LendFrame/LendFrame.utils.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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import React from 'react'; | ||
|
||
import { FixedInterestPoolRowSubTitle } from '../../../../2_molecules/FixedInterestPoolRowSubTitle/FixedInterestPoolRowSubTitle'; | ||
import { FixedInterestPoolRowTitle } from '../../../../2_molecules/FixedInterestPoolRowTitle/FixedInterestPoolRowTitle'; | ||
import { LendingPool } from '../../../../../utils/LendingPool'; | ||
|
||
export const generateRowTitle = (pool: LendingPool) => ( | ||
<FixedInterestPoolRowTitle pool={pool} isBorrow={false} /> | ||
); | ||
|
||
export const generateRowSubTitle = (pool: LendingPool) => ( | ||
<FixedInterestPoolRowSubTitle pool={pool} /> | ||
); |
11 changes: 10 additions & 1 deletion
11
...end/src/app/5_pages/LendPage/components/NextSupplyInterestRate/NextSupplyInterestRate.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
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