Skip to content

Commit 09fa532

Browse files
committed
feat: add E-mode and Isolation mode tabs to Markets page
1 parent 760bd7a commit 09fa532

34 files changed

Lines changed: 2312 additions & 629 deletions

File tree

apps/evm/src/components/ButtonGroup/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface ButtonGroupProps {
44
buttonLabels: React.ReactNode[];
55
activeButtonIndex: number;
66
onButtonClick: (newIndex: number) => void;
7+
variant?: 'primary' | 'secondary';
78
fullWidth?: boolean;
89
className?: string;
910
buttonClassName?: string;
@@ -15,15 +16,19 @@ export const ButtonGroup: React.FC<ButtonGroupProps> = ({
1516
activeButtonIndex = 0,
1617
onButtonClick,
1718
fullWidth = false,
19+
variant = 'primary',
1820
className,
1921
buttonClassName,
2022
buttonSize,
2123
}) => {
2224
return (
2325
<div
2426
className={cn(
25-
'flex items-center bg-dark-blue-disabled border border-dark-blue-hover rounded-lg whitespace-nowrap',
27+
'flex items-center whitespace-nowrap',
2628
fullWidth ? 'w-full' : 'max-sm:w-full',
29+
variant === 'primary'
30+
? 'bg-dark-blue-disabled border border-dark-blue-hover rounded-lg'
31+
: 'gap-x-3',
2732
className,
2833
)}
2934
>

apps/evm/src/components/CellGroup/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { cn } from '@venusprotocol/ui';
2+
import { Fragment } from 'react/jsx-runtime';
23

34
import { Card } from 'components';
45
import { Cell, type CellProps } from '../Cell';
@@ -33,9 +34,8 @@ export const CellGroup: React.FC<CellGroupProps> = ({
3334
{...containerProps}
3435
>
3536
{cells.map((cell, index) => (
36-
<>
37+
<Fragment key={`cell-group-item-${cell.label}`}>
3738
<Cell
38-
key={`cell-group-item-${cell.label}`}
3939
{...cell}
4040
className={cn(
4141
'xl:bg-transparent',
@@ -57,7 +57,7 @@ export const CellGroup: React.FC<CellGroupProps> = ({
5757
)}
5858
/>
5959
)}
60-
</>
60+
</Fragment>
6161
))}
6262
</Card>
6363
);

apps/evm/src/containers/SwitchChain/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { ChainId } from 'types';
99
export interface SwitchChainProps extends React.HTMLAttributes<HTMLDivElement> {
1010
buttonClassName?: string;
1111
buttonVariant?: ButtonProps['variant'];
12-
small?: boolean;
12+
buttonSize?: ButtonProps['size'];
1313
chainId?: ChainId;
1414
}
1515

@@ -18,7 +18,7 @@ export const SwitchChain: React.FC<SwitchChainProps> = ({
1818
chainId,
1919
buttonClassName,
2020
buttonVariant,
21-
small,
21+
buttonSize,
2222
...otherProps
2323
}) => {
2424
const { accountAddress } = useAccountAddress();
@@ -43,7 +43,7 @@ export const SwitchChain: React.FC<SwitchChainProps> = ({
4343
className={cn('w-full', buttonClassName)}
4444
onClick={handleSwitchChain}
4545
variant={buttonVariant}
46-
size={small ? 'xs' : 'md'}
46+
size={buttonSize}
4747
>
4848
{t('switchChain.switchButton', {
4949
chainName: targetChain.name,

apps/evm/src/libs/translations/translations/en.json

Lines changed: 69 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
"limit": "Limit:",
1919
"tooltip": "Borrow balance:<LineBreak/>{{borrowBalance}} ({{borrowLimitUsedPercentage}} of your borrow limit)<LineBreak/><LineBreak/>Safe borrow limit:<LineBreak/>{{safeBorrowLimit}} ({{safeBorrowLimitPercentage}}% of your borrow limit)"
2020
},
21-
"adBanner": {
22-
"learnMore": "Learn more",
23-
"startNow": "Start now"
24-
},
2521
"adCarousel": {
2622
"boostBanner": {
2723
"buttonLabel": "Learn more",
@@ -202,17 +198,6 @@
202198
"modalTitle": "{{ poolName }} tokens",
203199
"supplyDescription": "Supplying {{tokenSymbol}} to the {{poolName}} pool will enable you to borrow tokens from this pool exclusively. <Button>Show all markets</Button>"
204200
},
205-
"binanceWalletBanner": {
206-
"bgIllustrationAltText": "Background illustration",
207-
"binanceLogoAltText": "Binance logo",
208-
"description": "Borrow USDT and share <Bold>$400,000</Bold> in rewards!",
209-
"title": "Venus is live on Binance Wallet Earn."
210-
},
211-
"boostBanner": {
212-
"description": "One-click leverage to boost your yield <White>up to 5x</White>.",
213-
"rocketAltText": "Rocket illustration",
214-
"title": "Boost is available now!"
215-
},
216201
"breadcrumbs": {
217202
"bridge": "Bridge",
218203
"dashboard": "Dashboard",
@@ -392,9 +377,6 @@
392377
"title": "No borrow positions yet"
393378
}
394379
},
395-
"placeholder": {
396-
"title": "No supply or borrow positions yet"
397-
},
398380
"supplyTab": {
399381
"placeholder": {
400382
"title": "No supply positions yet"
@@ -462,7 +444,7 @@
462444
"exploreButtonLabel": "Explore",
463445
"illustrationAltText": "E-mode illustration",
464446
"manageEModeButtonLabel": "Manage E-mode",
465-
"title": "Boost your borrowing power with E-Mode"
447+
"title": "Boost your borrowing power with E-mode"
466448
},
467449
"errors": {
468450
"couldNotRetrieveSigner": "Signer could not be retrieved, please make sure your wallet is unlocked then reload the page",
@@ -584,11 +566,6 @@
584566
"utilizationRate": "Utilization rate"
585567
}
586568
},
587-
"isolatedPoolsSunsetBanner": {
588-
"description": "Claim your rewards and close your positions",
589-
"illustrationAltText": "Illustration",
590-
"title": "Isolated pools are being sunsetted"
591-
},
592569
"landing": {
593570
"benefits": {
594571
"text1": "Access an immutable money market directly on-chain.",
@@ -786,61 +763,32 @@
786763
},
787764
"supplyInfo": {
788765
"title": "Supply info"
766+
},
767+
"tabs": {
768+
"eMode": {
769+
"illustrationAltText": "Lightning illustration",
770+
"liquidationPenalty": {
771+
"label": "Liquidation penalty"
772+
},
773+
"liquidationThreshold": {
774+
"label": "Liquidation threshold"
775+
},
776+
"maxLtv": {
777+
"label": "Max LTV",
778+
"tooltip": "The maximum LTV is the borrowing limit. At {{maxLtv}} LTV, 1 {{tokenSymbol}} of collateral allows borrowing {{userCollateralFactor}} {{tokenSymbol}} worth of currency."
779+
}
780+
}
789781
}
790782
},
791783
"markets": {
792784
"eMode": {
793-
"group": {
794-
"cannotDisable": {
795-
"tooltip": {
796-
"blockingPositions": "You can't disable this e-mode group because you have borrow positions with assets that can't be borrowed from the pool. <Link>Show my positions</Link>",
797-
"notEnoughCollateral": "You can't disable this e-mode group because your total collateral value would not cover your total borrow balance"
798-
}
799-
},
800-
"cannotEnable": {
801-
"modal": {
802-
"description": "You will need to close the following borrow positions in order to enable the <WhiteText>{{ eModeGroupName }}</WhiteText> E-mode group:",
803-
"repayButtonLabel": "Repay",
804-
"title": "Your positions"
805-
},
806-
"tooltip": {
807-
"blockingPositions": "You can't enable this e-mode group because you have borrow positions with assets that don't belong in that group. <Link>Show my positions</Link>",
808-
"notEnoughCollateral": "You can't enable this e-mode group because your total collateral value would not cover your total borrow balance"
809-
}
810-
},
811-
"disableButtonLabel": "Disable",
812-
"disabledNotice": "This E-Mode group is no longer supported. Your account now falls back to default parameters. Please switch to another available E-mode group or disable it.",
813-
"enableButtonLabel": "Enable",
814-
"healthFactor": "Health factor:",
815-
"switchButtonLabel": "Switch"
816-
},
817-
"notice": "Enabling E-Mode allows you to maximize your borrowing power, however, borrowing is restricted to assets within the selected group. <Link>Learn more</Link>",
818-
"search": {
819-
"placeholder": "Search asset or group"
820-
},
821785
"table": {
822786
"card": {
823787
"header": {
824788
"borrowable": "Borrowable",
825789
"collateral": "Collateral"
826-
},
827-
"rows": {
828-
"liquidationPenalty": "Liquidation penalty",
829-
"liquidationThreshold": "Liquidation threshold",
830-
"maxLtv": "Max LTV"
831790
}
832-
},
833-
"columns": {
834-
"asset": "Asset",
835-
"collateral": "Collateral",
836-
"isBorrowable": "Borrowable",
837-
"liquidationPenalty": "Liquidation penalty",
838-
"liquidationThreshold": "Liquidation threshold",
839-
"maxLtv": "Max LTV",
840-
"penalty": "Penalty",
841-
"threshold": "Threshold"
842-
},
843-
"mobileSelectLabel": "Sort by:"
791+
}
844792
}
845793
},
846794
"errors": {
@@ -868,22 +816,62 @@
868816
}
869817
},
870818
"tabs": {
871-
"assets": {
872-
"title": "Assets"
873-
},
874819
"eMode": {
875-
"illustrationAltText": "Lightning illustration",
876-
"liquidationPenalty": {
877-
"label": "Liquidation penalty"
820+
"eModeNotice": "Enabling E-mode allows you to maximize your borrowing power, however, borrowing is restricted to assets within the selected group. <Link>Learn more</Link>",
821+
"group": {
822+
"cannotDisable": {
823+
"tooltip": {
824+
"blockingPositions": "You can't disable this group because you have borrow positions with assets that can't be borrowed from the pool. <Link>Show my positions</Link>",
825+
"notEnoughCollateral": "You can't disable this group because your total collateral value would not cover your total borrow balance"
826+
}
827+
},
828+
"cannotEnable": {
829+
"modal": {
830+
"description": "You will need to close the following borrow positions in order to enable the <WhiteText>{{ eModeGroupName }}</WhiteText> group:",
831+
"repayButtonLabel": "Repay",
832+
"title": "Your positions"
833+
},
834+
"tooltip": {
835+
"blockingPositions": "You can't enable this group because you have borrow positions with assets that don't belong in that group. <Link>Show my positions</Link>",
836+
"notEnoughCollateral": "You can't enable this group because your total collateral value would not cover your total borrow balance"
837+
}
838+
},
839+
"disableButtonLabel": "Disable",
840+
"disabledNotice": "This group is no longer supported. Your account now falls back to Core Pool parameters. Please switch to another available group or disable it.",
841+
"enableButtonLabel": "Enable",
842+
"healthFactor": "Health factor:",
843+
"switchButtonLabel": "Switch"
878844
},
879-
"liquidationThreshold": {
880-
"label": "Liquidation threshold"
845+
"isolationModeNotice": "Enabling isolation mode allows you to maximize your borrowing power, however, supplying and borrowing are restricted to assets within the selected group. <Link>Learn more</Link>",
846+
"label": "E-mode",
847+
"pausedAssetsToggle": {
848+
"label": "Paused assets"
881849
},
882-
"maxLtv": {
883-
"label": "Max LTV",
884-
"tooltip": "The maximum LTV is the borrowing limit. At {{maxLtv}} LTV, 1 {{tokenSymbol}} of collateral allows borrowing {{userCollateralFactor}} {{tokenSymbol}} worth of currency."
850+
"search": {
851+
"placeholder": "Search asset or group"
852+
},
853+
"table": {
854+
"columns": {
855+
"asset": "Asset",
856+
"collateral": "Collateral",
857+
"isBorrowable": "Borrowable",
858+
"liquidationPenalty": "Liquidation penalty",
859+
"liquidationThreshold": "Liquidation threshold",
860+
"maxLtv": "Max LTV",
861+
"penalty": "Penalty",
862+
"threshold": "Threshold"
863+
},
864+
"mobileSelectLabel": "Sort by:"
885865
},
886-
"title": "E-mode"
866+
"userAssetsOnlyToggle": {
867+
"label": "My assets only"
868+
}
869+
},
870+
"isolationMode": {
871+
"label": "Isolation mode"
872+
},
873+
"markets": {
874+
"label": "Markets"
887875
}
888876
}
889877
},
@@ -1133,11 +1121,6 @@
11331121
"tokensLeft_other": "<WhiteText>{{count}}</WhiteText> prime tokens left",
11341122
"waitForPrimeTitle": "{{claimWaitingPeriod}} until you can claim Prime rewards"
11351123
},
1136-
"probableBanner": {
1137-
"description": "Give your conviction a boost on probable.markets",
1138-
"probableAltText": "Probable illustration",
1139-
"title": "Believe in something?"
1140-
},
11411124
"proposalList": {
11421125
"selectOptions": {
11431126
"all": {

0 commit comments

Comments
 (0)