Skip to content

Commit d332d47

Browse files
committed
Merge branch 'main' into feat/landing-page-menu
2 parents c1e56e3 + 17beed2 commit d332d47

18 files changed

Lines changed: 261 additions & 44 deletions

File tree

.changeset/huge-otters-battle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@venusprotocol/evm": minor
3+
---
4+
5+
feat: support isolated mode tag
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { cn } from '@venusprotocol/ui';
2+
3+
import { useTranslation } from 'libs/translations';
4+
import { InfoIcon } from '../InfoIcon';
5+
6+
export interface IsolatedAssetIndicatorProps {
7+
className?: string;
8+
}
9+
10+
export const IsolatedAssetIndicator: React.FC<IsolatedAssetIndicatorProps> = ({ className }) => {
11+
const { t } = useTranslation();
12+
13+
return (
14+
<span className={cn('inline-flex items-center gap-x-1 text-yellow', className)}>
15+
<span className="text-b2s">{t('marketTable.assetColumn.isolated')}</span>
16+
17+
<InfoIcon
18+
iconClassName="text-yellow"
19+
tooltip={t('marketTable.assetColumn.isolatedTooltip')}
20+
/>
21+
</span>
22+
);
23+
};

apps/evm/src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export * from './EModeIcon';
6060
export * from './ProtectionModeIndicator';
6161
export * from './MarketStatus';
6262
export * from './Slider';
63+
export * from './IsolatedAssetIndicator';
6364
export * from './IsolatedEModeGroupTooltip';
6465
export * from './TokenIcon';
6566
export * from './BalanceUpdates';

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface MarketTableProps
4242
columns: ColumnKey[];
4343
modalColumn?: boolean;
4444
userEModeGroup?: EModeGroup;
45+
eModeGroups?: EModeGroup[];
4546
isolatedModeGroup?: EModeGroup;
4647
controls?: boolean;
4748
rowControl?: boolean;
@@ -60,6 +61,7 @@ export const MarketTable: React.FC<MarketTableProps> = ({
6061
marketType,
6162
columns: columnKeys,
6263
userEModeGroup,
64+
eModeGroups,
6365
isolatedModeGroup,
6466
initialOrder,
6567
breakpoint,
@@ -115,6 +117,7 @@ export const MarketTable: React.FC<MarketTableProps> = ({
115117
columnKeys,
116118
collateralOnChange: handleCollateralChange,
117119
userEModeGroup,
120+
eModeGroups,
118121
marketType,
119122
});
120123

apps/evm/src/containers/MarketTable/useColumns/index.tsx

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import { cn } from '@venusprotocol/ui';
44
import {
55
EModeIcon,
66
InfoIcon,
7+
IsolatedAssetIndicator,
78
LayeredValues,
89
ProgressBar,
910
ProtectionModeIndicator,
1011
type TableColumn,
1112
Toggle,
13+
TokenIcon,
1214
TokenIconWithSymbol,
1315
Tooltip,
1416
} from 'components';
@@ -67,11 +69,13 @@ export const useColumns = ({
6769
columnKeys,
6870
collateralOnChange,
6971
userEModeGroup,
72+
eModeGroups,
7073
marketType,
7174
}: {
7275
columnKeys: ColumnKey[];
7376
collateralOnChange: (asset: Asset) => void;
7477
userEModeGroup?: EModeGroup;
78+
eModeGroups?: EModeGroup[];
7579
marketType?: 'supply' | 'borrow';
7680
}) => {
7781
const { t, Trans } = useTranslation();
@@ -132,14 +136,36 @@ export const useColumns = ({
132136
});
133137

134138
if (column === 'asset' || column === 'assetAndChain') {
139+
const showIsolatedIndicator =
140+
column === 'asset' &&
141+
asset.collateralFactor === 0 &&
142+
!asset.isBorrowable &&
143+
!!eModeGroups?.some(
144+
group =>
145+
group.isIsolated &&
146+
group.assetSettings.some(settings => areTokensEqual(settings.vToken, asset.vToken)),
147+
);
148+
135149
return (
136150
<div className="flex min-w-0 items-center space-x-1">
137-
<TokenIconWithSymbol
138-
token={asset.vToken.underlyingToken}
139-
displayChain={column === 'assetAndChain'}
140-
size={column === 'assetAndChain' ? 'md' : 'xl'}
141-
className="min-w-[5rem]"
142-
/>
151+
{showIsolatedIndicator ? (
152+
<div className="flex min-w-[5rem] items-center gap-x-3">
153+
<TokenIcon token={asset.vToken.underlyingToken} size="xl" className="shrink-0" />
154+
155+
<div className="min-w-0">
156+
<p className="truncate font-semibold">{asset.vToken.underlyingToken.symbol}</p>
157+
158+
<IsolatedAssetIndicator />
159+
</div>
160+
</div>
161+
) : (
162+
<TokenIconWithSymbol
163+
token={asset.vToken.underlyingToken}
164+
displayChain={column === 'assetAndChain'}
165+
size={column === 'assetAndChain' ? 'md' : 'xl'}
166+
className="min-w-[5rem]"
167+
/>
168+
)}
143169

144170
{userEModeGroup && isInUserEModeGroup && (
145171
<Tooltip

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@
289289
"assetWarning": {
290290
"borrowDescription": "You may borrow {{tokenSymbol}} according to your collateralized supply in the {{poolName}} pool. <Button>Show all tokens</Button>",
291291
"modalTitle": "{{ poolName }} tokens",
292-
"supplyDescription": "Supplying {{tokenSymbol}} to the {{poolName}} pool will enable you to borrow tokens from this pool exclusively. <Button>Show all markets</Button>"
292+
"modeInfoHint": "<LineBreak/>Visit the <ModeInfoButton>mode info</ModeInfoButton> section to explore more available groups.",
293+
"modeOnly": {
294+
"eMode": "{{tokenSymbol}} is only available in E-mode. Visit the <ModeInfoButton>mode info</ModeInfoButton> section to enable the group, or browse <ShowAllMarketsButton>other assets</ShowAllMarketsButton>.",
295+
"eModeAndIsolation": "{{tokenSymbol}} is only available in E-mode and Isolation mode. Visit the <ModeInfoButton>mode info</ModeInfoButton> section to enable one of the groups, or browse <ShowAllMarketsButton>other assets</ShowAllMarketsButton>.",
296+
"isolation": "{{tokenSymbol}} is only available in Isolation mode. Visit the <ModeInfoButton>mode info</ModeInfoButton> section to enable the group, or browse <ShowAllMarketsButton>other assets</ShowAllMarketsButton>."
297+
},
298+
"supplyDescription": "Supplying {{tokenSymbol}} to the Core Pool lets you borrow tokens from this pool exclusively. <ShowAllMarketsButton>Show all markets</ShowAllMarketsButton>"
293299
},
294300
"availableBalance": {
295301
"label": "Available"
@@ -1004,6 +1010,8 @@
10041010
"marketTable": {
10051011
"assetColumn": {
10061012
"eMode": "This market is part of the {{eModeGroupName}} E-mode group",
1013+
"isolated": "Isolated",
1014+
"isolatedTooltip": "This asset is only available in its corresponding isolation mode.",
10071015
"isolationMode": "This market is part of the {{eModeGroupName}} isolation mode group",
10081016
"pausedAssetTooltip": "Asset paused by Venus Governance. Borrowing and supplying have been disabled.",
10091017
"protectionMode": "Protection mode is active for {{tokenName}} due to price volatility, affecting its collateral and borrow prices. <LearnMore>Learn more</LearnMore>",

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@
289289
"assetWarning": {
290290
"borrowDescription": "{{poolName}}プールで担保として供給しているため、{{tokenSymbol}}を借りられます。<Button>すべてのトークンを表示</Button>",
291291
"modalTitle": "{{ poolName }} トークン",
292-
"supplyDescription": "{{poolName}}プールに{{tokenSymbol}}を供給すると、このプールのみからトークンを借りられるようになります。<Button>すべてのマーケットを表示</Button>"
292+
"modeInfoHint": "<LineBreak/>利用可能なグループをさらに確認するには、<ModeInfoButton>モード情報</ModeInfoButton>セクションをご覧ください。",
293+
"modeOnly": {
294+
"eMode": "{{tokenSymbol}}はEモードでのみ利用可能です。<ModeInfoButton>モード情報</ModeInfoButton>セクションでグループを有効にするか、<ShowAllMarketsButton>他の資産</ShowAllMarketsButton>をご覧ください。",
295+
"eModeAndIsolation": "{{tokenSymbol}}はEモードと隔離モードでのみ利用可能です。<ModeInfoButton>モード情報</ModeInfoButton>セクションでいずれかのグループを有効にするか、<ShowAllMarketsButton>他の資産</ShowAllMarketsButton>をご覧ください。",
296+
"isolation": "{{tokenSymbol}}は隔離モードでのみ利用可能です。<ModeInfoButton>モード情報</ModeInfoButton>セクションでグループを有効にするか、<ShowAllMarketsButton>他の資産</ShowAllMarketsButton>をご覧ください。"
297+
},
298+
"supplyDescription": "コアプールに{{tokenSymbol}}を供給すると、このプールからのみトークンを借りられます。<ShowAllMarketsButton>すべてのマーケットを表示</ShowAllMarketsButton>"
293299
},
294300
"availableBalance": {
295301
"label": "利用可能"
@@ -1004,6 +1010,8 @@
10041010
"marketTable": {
10051011
"assetColumn": {
10061012
"eMode": "このマーケットは{{eModeGroupName}}のEモードグループに含まれます",
1013+
"isolated": "隔離",
1014+
"isolatedTooltip": "この資産は対応する隔離モードでのみ利用可能です。",
10071015
"isolationMode": "このマーケットは{{eModeGroupName}}の隔離モードグループに含まれます",
10081016
"pausedAssetTooltip": "資産はVenusガバナンスにより停止されています。借入と供給が無効化されています。",
10091017
"protectionMode": "価格変動により、{{tokenName}} のプロテクションモードが有効になっています。担保価格と借入価格に影響します。 <LearnMore>詳細はこちら</LearnMore>",

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@
289289
"assetWarning": {
290290
"borrowDescription": "คุณสามารถยืม {{tokenSymbol}} ได้ตามยอดฝากที่เป็นหลักประกันในพูล {{poolName}} <Button>แสดงโทเคนทั้งหมด</Button>",
291291
"modalTitle": "โทเคน {{ poolName }}",
292-
"supplyDescription": "การฝาก {{tokenSymbol}} ในพูล {{poolName}} จะทำให้คุณยืมโทเคนได้เฉพาะจากพูลนี้ <Button>แสดงตลาดทั้งหมด</Button>"
292+
"modeInfoHint": "<LineBreak/>เยี่ยมชมส่วน <ModeInfoButton>ข้อมูลโหมด</ModeInfoButton> เพื่อสำรวจกลุ่มที่มีให้ใช้เพิ่มเติม",
293+
"modeOnly": {
294+
"eMode": "{{tokenSymbol}} ใช้งานได้เฉพาะใน E-mode เท่านั้น เยี่ยมชมส่วน <ModeInfoButton>ข้อมูลโหมด</ModeInfoButton> เพื่อเปิดใช้งานกลุ่ม หรือเรียกดู<ShowAllMarketsButton>สินทรัพย์อื่น</ShowAllMarketsButton>",
295+
"eModeAndIsolation": "{{tokenSymbol}} ใช้งานได้เฉพาะใน E-mode และโหมดแยกเท่านั้น เยี่ยมชมส่วน <ModeInfoButton>ข้อมูลโหมด</ModeInfoButton> เพื่อเปิดใช้งานกลุ่มใดกลุ่มหนึ่ง หรือเรียกดู<ShowAllMarketsButton>สินทรัพย์อื่น</ShowAllMarketsButton>",
296+
"isolation": "{{tokenSymbol}} ใช้งานได้เฉพาะในโหมดแยกเท่านั้น เยี่ยมชมส่วน <ModeInfoButton>ข้อมูลโหมด</ModeInfoButton> เพื่อเปิดใช้งานกลุ่ม หรือเรียกดู<ShowAllMarketsButton>สินทรัพย์อื่น</ShowAllMarketsButton>"
297+
},
298+
"supplyDescription": "การฝาก {{tokenSymbol}} ใน Core Pool จะทำให้คุณยืมโทเคนได้เฉพาะจากพูลนี้ <ShowAllMarketsButton>แสดงตลาดทั้งหมด</ShowAllMarketsButton>"
293299
},
294300
"availableBalance": {
295301
"label": "ใช้ได้"
@@ -1004,6 +1010,8 @@
10041010
"marketTable": {
10051011
"assetColumn": {
10061012
"eMode": "ตลาดนี้เป็นส่วนหนึ่งของกลุ่ม E-mode {{eModeGroupName}}",
1013+
"isolated": "แยก",
1014+
"isolatedTooltip": "สินทรัพย์นี้ใช้งานได้เฉพาะในโหมดแยกที่เกี่ยวข้องเท่านั้น",
10071015
"isolationMode": "ตลาดนี้เป็นส่วนหนึ่งของกลุ่มโหมดแยก {{eModeGroupName}}",
10081016
"pausedAssetTooltip": "สินทรัพย์ถูกหยุดโดยการกำกับดูแลของ Venus การยืมและการฝากถูกปิดใช้งาน",
10091017
"protectionMode": "โหมดป้องกันเปิดใช้งานสำหรับ {{tokenName}} เนื่องจากความผันผวนของราคา ส่งผลต่อราคาหลักประกันและราคาการกู้ยืม <LearnMore>เรียนรู้เพิ่มเติม</LearnMore>",

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@
289289
"assetWarning": {
290290
"borrowDescription": "{{poolName}} havuzundaki teminatlı tedarikinize göre {{tokenSymbol}} borç alabilirsiniz. <Button>Tüm tokenları göster</Button>",
291291
"modalTitle": "{{ poolName }} tokenları",
292-
"supplyDescription": "{{poolName}} havuzuna {{tokenSymbol}} tedarik etmek, yalnızca bu havuzdan token borç almanıza olanak tanır. <Button>Tüm piyasaları göster</Button>"
292+
"modeInfoHint": "<LineBreak/>Mevcut diğer grupları keşfetmek için <ModeInfoButton>mod bilgisi</ModeInfoButton> bölümünü ziyaret edin.",
293+
"modeOnly": {
294+
"eMode": "{{tokenSymbol}} yalnızca E-modunda kullanılabilir. <ModeInfoButton>mod bilgisi</ModeInfoButton> bölümünden grubu etkinleştirin veya <ShowAllMarketsButton>diğer varlıklara</ShowAllMarketsButton> göz atın.",
295+
"eModeAndIsolation": "{{tokenSymbol}} yalnızca E-modunda ve İzolasyon modunda kullanılabilir. <ModeInfoButton>mod bilgisi</ModeInfoButton> bölümünden gruplardan birini etkinleştirin veya <ShowAllMarketsButton>diğer varlıklara</ShowAllMarketsButton> göz atın.",
296+
"isolation": "{{tokenSymbol}} yalnızca İzolasyon modunda kullanılabilir. <ModeInfoButton>mod bilgisi</ModeInfoButton> bölümünden grubu etkinleştirin veya <ShowAllMarketsButton>diğer varlıklara</ShowAllMarketsButton> göz atın."
297+
},
298+
"supplyDescription": "Core Pool'a {{tokenSymbol}} tedarik etmek, yalnızca bu havuzdan token borç almanıza olanak tanır. <ShowAllMarketsButton>Tüm piyasaları göster</ShowAllMarketsButton>"
293299
},
294300
"availableBalance": {
295301
"label": "Mevcut"
@@ -1004,6 +1010,8 @@
10041010
"marketTable": {
10051011
"assetColumn": {
10061012
"eMode": "Bu piyasa {{eModeGroupName}} E-modu grubunun bir parçasıdır",
1013+
"isolated": "İzole",
1014+
"isolatedTooltip": "Bu varlık yalnızca ilgili izolasyon modunda kullanılabilir.",
10071015
"isolationMode": "Bu piyasa {{eModeGroupName}} izolasyon modu grubunun bir parçasıdır",
10081016
"pausedAssetTooltip": "Varlık Venus Yönetişimi tarafından duraklatıldı. Borç alma ve tedarik devre dışı bırakıldı.",
10091017
"protectionMode": "Fiyat dalgalanması nedeniyle {{tokenName}} için Koruma Modu etkin, teminat ve borçlanma fiyatlarını etkilemektedir. <LearnMore>Daha fazla bilgi</LearnMore>",

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@
289289
"assetWarning": {
290290
"borrowDescription": "Bạn có thể vay {{tokenSymbol}} theo mức cung cấp làm tài sản thế chấp trong pool {{poolName}}. <Button>Hiển thị tất cả token</Button>",
291291
"modalTitle": "Token {{ poolName }}",
292-
"supplyDescription": "Cung cấp {{tokenSymbol}} vào pool {{poolName}} sẽ cho phép bạn vay token chỉ từ pool này. <Button>Hiển thị tất cả thị trường</Button>"
292+
"modeInfoHint": "<LineBreak/>Truy cập phần <ModeInfoButton>thông tin chế độ</ModeInfoButton> để khám phá thêm các nhóm khả dụng.",
293+
"modeOnly": {
294+
"eMode": "{{tokenSymbol}} chỉ khả dụng trong E-mode. Truy cập phần <ModeInfoButton>thông tin chế độ</ModeInfoButton> để bật nhóm, hoặc duyệt <ShowAllMarketsButton>các tài sản khác</ShowAllMarketsButton>.",
295+
"eModeAndIsolation": "{{tokenSymbol}} chỉ khả dụng trong E-mode và chế độ cô lập. Truy cập phần <ModeInfoButton>thông tin chế độ</ModeInfoButton> để bật một trong các nhóm, hoặc duyệt <ShowAllMarketsButton>các tài sản khác</ShowAllMarketsButton>.",
296+
"isolation": "{{tokenSymbol}} chỉ khả dụng trong chế độ cô lập. Truy cập phần <ModeInfoButton>thông tin chế độ</ModeInfoButton> để bật nhóm, hoặc duyệt <ShowAllMarketsButton>các tài sản khác</ShowAllMarketsButton>."
297+
},
298+
"supplyDescription": "Cung cấp {{tokenSymbol}} vào Core Pool sẽ cho phép bạn vay token chỉ từ pool này. <ShowAllMarketsButton>Hiển thị tất cả thị trường</ShowAllMarketsButton>"
293299
},
294300
"availableBalance": {
295301
"label": "Có sẵn"
@@ -1004,6 +1010,8 @@
10041010
"marketTable": {
10051011
"assetColumn": {
10061012
"eMode": "Thị trường này thuộc nhóm E-mode {{eModeGroupName}}",
1013+
"isolated": "Cô lập",
1014+
"isolatedTooltip": "Tài sản này chỉ khả dụng trong chế độ cô lập tương ứng.",
10071015
"isolationMode": "Thị trường này thuộc nhóm chế độ cô lập {{eModeGroupName}}",
10081016
"pausedAssetTooltip": "Tài sản đã bị tạm dừng bởi Venus Governance. Việc vay và cung cấp đã bị vô hiệu hóa.",
10091017
"protectionMode": "Chế độ Bảo vệ đang hoạt động cho {{tokenName}} do biến động giá, ảnh hưởng đến giá thế chấp và giá vay. <LearnMore>Tìm hiểu thêm</LearnMore>",

0 commit comments

Comments
 (0)