diff --git a/_raw/locales/de/messages.json b/_raw/locales/de/messages.json index be4debb78cf..7a8cffd539c 100644 --- a/_raw/locales/de/messages.json +++ b/_raw/locales/de/messages.json @@ -1408,13 +1408,9 @@ "noMatch": "Keine Übereinstimmung", "lowValueDescription": "Vermögenswerte mit geringem Wert werden hier angezeigt", "lowValueAssets": "{{count}} Vermögenswerte mit geringem Wert", - "lowValueAssets_other": "{{count}} niedrigwertige Token", - "lowValueAssets_one": "{{count}} low value token", - "lowValueAssets_0": "{{count}} Low-Value-Token", "review": "Überprüfung", "noTokens": "Keine Token", - "searchToken": "Token suchen", - "lowValueDefis": "{{count}} Low-Value DeFi-Angebote" + "searchToken": "Token suchen" }, "noAssets": "Keine Vermögenswerte", "blockLinkText": "Adresse suchen, um Token zu blockieren", @@ -1453,7 +1449,6 @@ "addTokenEntryText": "Token", "price": "PREIS", "side": "SEITE", - "openInTab": "Im Tab öffnen", "searchTokenPlaceholder": "Token suchen" }, "hd": { @@ -3733,4 +3728,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Importiert durch Seed Phrase (Passphrase)" } -} \ No newline at end of file +} diff --git a/_raw/locales/en/messages.json b/_raw/locales/en/messages.json index cdde58fcc12..5fc23b3367e 100644 --- a/_raw/locales/en/messages.json +++ b/_raw/locales/en/messages.json @@ -1878,12 +1878,13 @@ "summaryDescription": "All assets in protocols (e.g. LP tokens) are resolved to the underlying assets for statistical calculations", "noMatch": "No Match", "noTokens": "No Tokens", + "noLpTokens": "No Liquidity Provider (LP) Token", "lowValueDescription": "Low value assets will be shown here", - "lowValueAssets_0": "{{count}} low value token", - "lowValueAssets_one": "{{count}} low value token", - "lowValueAssets_other": "{{count}} low value tokens", + "lowValueAssets_0": "{{count}} low-value token", + "lowValueAssets_one": "{{count}} low-value token", + "lowValueAssets_other": "{{count}} low-value tokens", "searchToken": "Search Token", - "lowValueDefis": "{{count}} low value defis" + "lowValueDefis": "{{count}} low-value DeFi assets" }, "noAssets": "No assets", "blockLinkText": "Search address to block token", @@ -1919,7 +1920,7 @@ }, "noTestnetAssets": "No Custom Network Assets", "addTokenEntryText": "Token", - "openInTab": "Open in tab", + "openInTab": "Open in Rabby Tab", "searchTokenPlaceholder": "Search Token" }, "hd": { @@ -3555,6 +3556,7 @@ "title": "Select Token" }, "noTokens": "No Tokens", + "noLpTokens": "No Liquidity Provider (LP) Token", "noMatch": "No Match", "noMatchSuggestion": "Try to search contract address on {{ chainName }}", "hot": "Hot", @@ -3638,6 +3640,7 @@ }, "LpTokenTag": { "title": "This is a liquidity provider(LP) token", + "descriptionFor": "This is a Liquidity Provider(LP) Token for {{ protocolName }}", "description": "LP tokens are issued by the DeFi protocols where you've deposited your assets. They serve as the proof of those assets, but their value isn't included in your total balance" } }, diff --git a/_raw/locales/es/messages.json b/_raw/locales/es/messages.json index a4fe6466d72..9c83966d039 100644 --- a/_raw/locales/es/messages.json +++ b/_raw/locales/es/messages.json @@ -1408,13 +1408,9 @@ "noMatch": "Sin coincidencias", "lowValueDescription": "Los activos de bajo valor se mostrarán aquí", "lowValueAssets": "{{count}} activos de bajo valor", - "lowValueAssets_other": "{{count}} low value tokens", - "lowValueAssets_0": "{{count}} token de bajo valor", - "lowValueAssets_one": "{{count}} low value token", "review": "Revisión", "noTokens": "Sin tokens", - "searchToken": "Buscar Token", - "lowValueDefis": "{{count}} defis de bajo valor" + "searchToken": "Buscar Token" }, "noAssets": "No hay activos", "blockLinkText": "Buscar dirección para bloquear token", @@ -1453,7 +1449,6 @@ "addTokenEntryText": "Token", "price": "PRECIO", "side": "LADO", - "openInTab": "Abrir en pestaña", "searchTokenPlaceholder": "Buscar Token" }, "hd": { @@ -3726,4 +3721,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Importado por Seed Phrase (Passphrase)" } -} \ No newline at end of file +} diff --git a/_raw/locales/fr-FR/messages.json b/_raw/locales/fr-FR/messages.json index 615b9e4c4c2..4a8c270ab87 100644 --- a/_raw/locales/fr-FR/messages.json +++ b/_raw/locales/fr-FR/messages.json @@ -717,13 +717,9 @@ "unlockAt": "Débloquer à", "unsupportedPoolType": "Type de pool non pris en charge", "useValue": "Valeur en USD", - "lowValueAssets_0": "{{count}} jeton de faible valeur", - "lowValueAssets_one": "{{count}} low value token", - "lowValueAssets_other": "{{count}} low value tokens", "review": "Revue", "noTokens": "Aucun Token", - "searchToken": "Recherche de Token", - "lowValueDefis": "{{count}} defis de faible valeur" + "searchToken": "Recherche de Token" }, "tokenButton": { "subTitle": "Le token de cette liste ne sera pas ajouté au solde total" @@ -759,7 +755,6 @@ "addTokenEntryText": "Jeton", "price": "PRIX", "side": "CÔTÉ", - "openInTab": "Ouvrir dans un onglet", "searchTokenPlaceholder": "Rechercher Token" }, "contacts": { @@ -3734,4 +3729,4 @@ "needDepositFirst": "Vous devez d'abord déposer des fonds." } } -} \ No newline at end of file +} diff --git a/_raw/locales/id/messages.json b/_raw/locales/id/messages.json index 973fd4475b6..9a94acb3ec2 100644 --- a/_raw/locales/id/messages.json +++ b/_raw/locales/id/messages.json @@ -1485,7 +1485,6 @@ "dailyUnlock": "Pembukaan harian", "unlockAt": "Buka di", "exerciseEnd": "Latihan selesai", - "lowValueAssets_0": "{{count}} token nilai rendah", "assetAmount": "Aset / Jumlah", "claimable": "Dapat Diklaim", "strikePrice": "Harga pelaksanaan", @@ -1496,14 +1495,11 @@ "noMatch": "Tidak Cocok", "tradePair": "Pasangan perdagangan", "summaryDescription": "Semua aset dalam protokol (misalnya token LP) diselesaikan ke aset dasar untuk perhitungan statistik.", - "lowValueAssets_one": "{{count}} token bernilai rendah", - "lowValueAssets_other": "{{count}} token nilai rendah", "summaryTips": "Nilai aset dibagi dengan total kekayaan bersih", "price": "Harga", "review": "Tinjau", "noTokens": "Tidak Ada Token", - "searchToken": "Cari Token", - "lowValueDefis": "{{count}} defis nilai rendah" + "searchToken": "Cari Token" }, "AddMainnetToken": { "tokenAddress": "Alamat Token", @@ -1543,7 +1539,6 @@ "customDescription": "Token kustom yang ditambahkan oleh Anda akan ditampilkan di sini", "price": "HARGA", "side": "SISI", - "openInTab": "Buka di tab", "searchTokenPlaceholder": "Cari Token" }, "hd": { @@ -3731,4 +3726,4 @@ "IMPORTED_HD_KEYRING": "Diimpor oleh Seed Phrase", "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Diimpor oleh Seed Phrase (Passphrase)" } -} \ No newline at end of file +} diff --git a/_raw/locales/ja/messages.json b/_raw/locales/ja/messages.json index 50c59a818a0..2ef9b287d13 100644 --- a/_raw/locales/ja/messages.json +++ b/_raw/locales/ja/messages.json @@ -1408,13 +1408,9 @@ "noMatch": "一致なし", "lowValueDescription": "低価値アセットがここに表示されます", "lowValueAssets": "{{count}}の低価値アセット", - "lowValueAssets_0": "{{count}} 個の low value token", - "lowValueAssets_one": "{{count}} low value token", - "lowValueAssets_other": "{{count}} 個の低価値トークン", "review": "レビュー", "noTokens": "トークンがありません", - "searchToken": "トークンを検索", - "lowValueDefis": "{{count}} 低価値のデファイ" + "searchToken": "トークンを検索" }, "noAssets": "アセットなし", "blockLinkText": "トークンをブロックするためのアドレスを検索", @@ -1453,7 +1449,6 @@ "customButtonText": "カスタムトークンを追加", "side": "サイド", "price": "価格", - "openInTab": "タブで開く", "searchTokenPlaceholder": "トークンを検索" }, "hd": { @@ -3734,4 +3729,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Seed Phrase (Passphrase) でインポート" } -} \ No newline at end of file +} diff --git a/_raw/locales/ko/messages.json b/_raw/locales/ko/messages.json index 9a5d341f555..4c2217706eb 100644 --- a/_raw/locales/ko/messages.json +++ b/_raw/locales/ko/messages.json @@ -1486,14 +1486,11 @@ "percent": "퍼센트", "tradePair": "거래 쌍", "side": "측면", - "lowValueAssets_other": "{{count}} 저가 토큰", "dailyUnlock": "일일 잠금 해제", "claimable": "청구 가능", "pool": "POOL", - "lowValueAssets_0": "{{count}} 저가 토큰", "type": "유형", "exerciseEnd": "운동 종료", - "lowValueAssets_one": "{{count}} 저가 토큰", "noMatch": "일치하지 않음", "lowValueDescription": "여기에는 저가 자산이 표시됩니다.", "summaryTips": "자산 가치는 총 순자산으로 나뉩니다.", @@ -1502,8 +1499,7 @@ "balanceValue": "잔액 / 가치", "review": "리뷰", "noTokens": "토큰 없음", - "searchToken": "토큰 검색", - "lowValueDefis": "{{count}} 저가 가치 디파이" + "searchToken": "토큰 검색" }, "AddMainnetToken": { "title": "맞춤형 토큰 추가", @@ -1543,7 +1539,6 @@ "searchPlaceholder": "토큰", "price": "가격", "side": "측면", - "openInTab": "탭에서 열기", "searchTokenPlaceholder": "토큰 검색" }, "hd": { @@ -3731,4 +3726,4 @@ "IMPORTED_HD_KEYRING": "시드 구문으로 가져오기", "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Seed Phrase(비밀번호)를 통해 임포트됨" } -} \ No newline at end of file +} diff --git a/_raw/locales/pt-BR/messages.json b/_raw/locales/pt-BR/messages.json index 21f78545c62..d7db2ae7476 100644 --- a/_raw/locales/pt-BR/messages.json +++ b/_raw/locales/pt-BR/messages.json @@ -1408,13 +1408,9 @@ "noMatch": "Sem Correspondência", "lowValueDescription": "Ativos de baixo valor serão exibidos aqui", "lowValueAssets": "{{count}} ativos de baixo valor", - "lowValueAssets_0": "{{count}} low value token", - "lowValueAssets_one": "{{count}} token de baixo valor", - "lowValueAssets_other": "{{count}} tokens de baixo valor", "review": "Revisar", "noTokens": "Sem Tokens", - "searchToken": "Buscar Token", - "lowValueDefis": "{{count}} defis de baixo valor" + "searchToken": "Buscar Token" }, "noAssets": "Sem ativos", "blockLinkText": "Pesquise o endereço para bloquear o token", @@ -1453,7 +1449,6 @@ "noTestnetAssets": "Nenhum ativo da rede personalizada", "price": "PREÇO", "side": "LADO", - "openInTab": "Abrir na aba", "searchTokenPlaceholder": "Pesquisar Token" }, "hd": { @@ -3737,4 +3732,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Importado por Seed Phrase (Passphrase)" } -} \ No newline at end of file +} diff --git a/_raw/locales/pt/messages.json b/_raw/locales/pt/messages.json index db7542603f4..8dc1097d1df 100644 --- a/_raw/locales/pt/messages.json +++ b/_raw/locales/pt/messages.json @@ -1487,22 +1487,18 @@ "PL": "P&L", "dailyUnlock": "Desbloqueio diário", "endAt": "Terminar em", - "lowValueAssets_0": "{{count}} token de baixo valor", "type": "Tipo", "noMatch": "Sem correspondência", "leverage": "Alavancar", "balanceValue": "Saldo / Valor", "token": "Token", - "lowValueAssets_one": "{{count}} token de baixo valor", "exerciseEnd": "Exercício encerrado", "summaryDescription": "Todos os ativos nos protocolos (por exemplo, tokens LP) são resolvidos para os ativos subjacentes para cálculos estatísticos.", "lowValueDescription": "Ativos de baixo valor serão exibidos aqui", - "lowValueAssets_other": "{{count}} tokens de baixo valor", "side": "Lado", "tradePair": "Par de negociação", "review": "Revisar", "noTokens": "Sem Tokens", - "lowValueDefis": "{{count}} defis de baixo valor", "searchToken": "Buscar Token" }, "AddMainnetToken": { @@ -1543,7 +1539,6 @@ "noTestnetAssets": "Nenhum ativo de rede personalizado", "side": "LADO", "price": "PREÇO", - "openInTab": "Abrir em uma nova guia", "searchTokenPlaceholder": "Buscar Token" }, "hd": { @@ -3731,4 +3726,4 @@ "IMPORTED_HD_KEYRING": "Importado pela Seed Phrase", "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Importado pela Frase Semente (Passphrase)" } -} \ No newline at end of file +} diff --git a/_raw/locales/ru/messages.json b/_raw/locales/ru/messages.json index f7458cbd9e2..f3b9abfa123 100644 --- a/_raw/locales/ru/messages.json +++ b/_raw/locales/ru/messages.json @@ -1409,13 +1409,9 @@ "noMatch": "Нет совпадений", "lowValueDescription": "Активы с низкой стоимостью будут показаны здесь", "lowValueAssets": "{{count}} активов с низкой стоимостью", - "lowValueAssets_one": "{{count}} low value token", - "lowValueAssets_0": "{{count}} с низкой стоимостью token", - "lowValueAssets_other": "{{count}} токенов с низкой стоимостью", "review": "Обзор", "noTokens": "Нет токенов", - "searchToken": "Поиск токена", - "lowValueDefis": "{{count}} низкоценные дефи" + "searchToken": "Поиск токена" }, "noAssets": "Нет активов", "blockLinkText": "Искать адрес, чтобы заблокировать токен", @@ -1454,7 +1450,6 @@ "customButtonText": "Добавить пользовательский токен", "price": "ЦЕНА", "side": "Сторона", - "openInTab": "Открыть в вкладке", "searchTokenPlaceholder": "Поиск токена" }, "hd": { @@ -3736,4 +3731,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Импортировано по сид фразе (С паролем)" } -} \ No newline at end of file +} diff --git a/_raw/locales/tr/messages.json b/_raw/locales/tr/messages.json index 9ef61d8b539..903baa05fa3 100644 --- a/_raw/locales/tr/messages.json +++ b/_raw/locales/tr/messages.json @@ -1408,12 +1408,8 @@ "noMatch": "Eşleşme Yok", "lowValueDescription": "Düşük değerdeki varlıklar burada gösterilecek", "lowValueAssets": "{{count}} düşük değerli varlık", - "lowValueAssets_other": "{{count}} düşük değerli tokenlar", - "lowValueAssets_one": "{{count}} düşük değerli token", - "lowValueAssets_0": "{{count}} düşük değerli token", "review": "Gözden Geçir", "noTokens": "No Tokens", - "lowValueDefis": "{{count}} düşük değerli defis", "searchToken": "Token Ara" }, "noAssets": "Varlık Yok", @@ -1453,7 +1449,6 @@ "customButtonText": "Özel token ekle", "side": "YAN TARAF", "price": "FİYAT", - "openInTab": "Sekmede aç", "searchTokenPlaceholder": "Token Ara" }, "hd": { @@ -3737,4 +3732,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Tohum Cümlesi (Parola) ile İçe Aktarıldı" } -} \ No newline at end of file +} diff --git a/_raw/locales/ua-UA/messages.json b/_raw/locales/ua-UA/messages.json index cf314d2e1ab..30e6050811f 100644 --- a/_raw/locales/ua-UA/messages.json +++ b/_raw/locales/ua-UA/messages.json @@ -1411,13 +1411,9 @@ "noMatch": "Немає збігів", "lowValueDescription": "Тут будуть показані активи з низькою вартістю", "lowValueAssets": "{{count}} малоцінні активи", - "lowValueAssets_0": "{{count}} токен з низькою вартістю", - "lowValueAssets_one": "{{count}} токенів низької вартості", - "lowValueAssets_other": "{{count}} низьковартісних токенів", "review": "Огляд", "noTokens": "Немає токенів", - "searchToken": "Пошук токена", - "lowValueDefis": "{{count}} низьковартісних defi" + "searchToken": "Пошук токена" }, "noAssets": "Немає активів", "blockLinkText": "Адреса для пошуку токена блоку", @@ -1456,7 +1452,6 @@ "noTestnetAssets": "Немає активів у користувацькій мережі", "price": "ЦІНА", "side": "БОКОВИЙ", - "openInTab": "Відкрити у вкладці", "searchTokenPlaceholder": "Пошук Токену" }, "hd": { @@ -3754,4 +3749,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Імпортовано за допомогою Seed Phrase (Passphrase)" } -} \ No newline at end of file +} diff --git a/_raw/locales/vi/messages.json b/_raw/locales/vi/messages.json index 84954b815eb..79aa2baff0d 100644 --- a/_raw/locales/vi/messages.json +++ b/_raw/locales/vi/messages.json @@ -1480,7 +1480,6 @@ "debtRatio": "Tỷ lệ nợ", "type": "Loại", "unlockAt": "Mở khóa tại", - "lowValueAssets_0": "{{count}} token giá trị thấp", "PL": "P&L", "pool": "POOL", "side": "Bên", @@ -1492,17 +1491,14 @@ "dailyUnlock": "Mở khóa hàng ngày", "tradePair": "Cặp giao dịch", "noMatch": "Không khớp", - "lowValueAssets_other": "{{count}} token giá trị thấp", "claimable": "Có thể yêu cầu", "endAt": "Kết thúc tại", "percent": "Phần trăm", - "lowValueAssets_one": "{{count}} token giá thấp", "summaryTips": "Giá trị tài sản chia cho tổng giá trị ròng", "summaryDescription": "Tất cả tài sản trong các giao thức (ví dụ: LP tokens) đều được quy đổi thành tài sản cơ sở để thực hiện các phép tính thống kê.", "lowValueDescription": "Tài sản có giá trị thấp sẽ được hiển thị ở đây", "review": "Xem lại", "noTokens": "Không có Token", - "lowValueDefis": "{{count}} defi giá thấp", "searchToken": "Tìm kiếm Token" }, "AddMainnetToken": { @@ -1543,7 +1539,6 @@ "customButtonText": "Thêm token tùy chỉnh", "side": "BÊN", "price": "GIÁ", - "openInTab": "Mở trong tab", "searchTokenPlaceholder": "Tìm kiếm Token" }, "hd": { @@ -3731,4 +3726,4 @@ "IMPORTED_HD_KEYRING": "Nhập khẩu bằng cụm từ hạt giống", "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "Nhập bằng Seed Phrase (Passphrase)" } -} \ No newline at end of file +} diff --git a/_raw/locales/zh-CN/messages.json b/_raw/locales/zh-CN/messages.json index 1ea3e96ad34..a89c0eb1ac7 100644 --- a/_raw/locales/zh-CN/messages.json +++ b/_raw/locales/zh-CN/messages.json @@ -375,13 +375,9 @@ "noMatch": "没有匹配", "lowValueDescription": "低价值资产将显示在这里", "lowValueAssets": "{{count}} 个低价值资产", - "lowValueAssets_one": "{{count}} 个低价值代币", - "lowValueAssets_other": "{{count}} 个低价值代币", - "lowValueAssets_0": "{{count}} 个低价值代币", "review": "审核", "noTokens": "没有代币", - "searchToken": "搜索 Token", - "lowValueDefis": "{{count}} 低价值 defis" + "searchToken": "搜索 Token" }, "noAssets": "没有资产", "blockLinkText": "搜索代币地址,隐藏代币", @@ -420,7 +416,6 @@ "addTokenEntryText": "代币", "side": "侧边", "price": "价格", - "openInTab": "在新标签页中打开", "searchTokenPlaceholder": "搜索代币" }, "hd": { @@ -3736,4 +3731,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "通过助记词(密码)导入" } -} \ No newline at end of file +} diff --git a/_raw/locales/zh-HK/messages.json b/_raw/locales/zh-HK/messages.json index a281c472a6f..305552bdb0e 100644 --- a/_raw/locales/zh-HK/messages.json +++ b/_raw/locales/zh-HK/messages.json @@ -375,12 +375,8 @@ "noMatch": "沒有匹配", "lowValueDescription": "低價值資產將顯示在這里", "lowValueAssets": "{{count}} 個低價值資產", - "lowValueAssets_other": "{{count}} 低價值代幣", - "lowValueAssets_one": "{{count}} 低價值代幣", - "lowValueAssets_0": "{{count}} 低價值代幣", "review": "審查", "noTokens": "沒有 Tokens", - "lowValueDefis": "{{count}} 低價值 defis", "searchToken": "搜索令牌" }, "noAssets": "沒有資產", @@ -420,7 +416,6 @@ "addTokenEntryText": "代幣", "side": "側邊", "price": "價格", - "openInTab": "在新标签页中打开", "searchTokenPlaceholder": "搜索 Token" }, "hd": { @@ -3736,4 +3731,4 @@ }, "IMPORTED_HD_KEYRING_NEED_PASSPHRASE": "通過種子短語(密碼)導入" } -} \ No newline at end of file +} diff --git a/src/ui/component/TokenAmountInput/index.tsx b/src/ui/component/TokenAmountInput/index.tsx index e250a577cb1..6be4d4fa1d5 100644 --- a/src/ui/component/TokenAmountInput/index.tsx +++ b/src/ui/component/TokenAmountInput/index.tsx @@ -174,6 +174,7 @@ const TokenAmountInput = ({ onChange && onChange(''); onTokenChange(token); setTokenSelectorVisible(false); + setLpTokenMode(false); tokenInputRef.current?.focus(); setChainServerId(token?.chain); }, @@ -182,8 +183,8 @@ const TokenAmountInput = ({ const handleTokenSelectorClose = useCallback(() => { setChainServerId(token?.chain); - setTokenSelectorVisible(false); setLpTokenMode(false); + setTokenSelectorVisible(false); }, [token?.chain, setChainServerId]); const checkBeforeConfirm = useCallback( @@ -223,7 +224,11 @@ const TokenAmountInput = ({ ); // when no any queryConds - const { tokens: allTokens, isLoading: isLoadingAllTokens } = useTokens( + const { + tokens: allTokens, + isLoading: isLoadingAllTokens, + isAllTokenLoading, // 包含lpToken + } = useTokens( currentAccount?.address, undefined, selectorOpened.current ? tokenSelectorVisible : true, @@ -432,7 +437,7 @@ const TokenAmountInput = ({ onConfirm={checkBeforeConfirm} onCancel={handleTokenSelectorClose} onSearch={handleSearchTokens} - isLoading={isListLoading} + isLoading={isListLoading || (lpTokenMode && isAllTokenLoading)} type={type} disableItemCheck={disableItemCheck} showCustomTestnetAssetList diff --git a/src/ui/component/TokenSelect/index.tsx b/src/ui/component/TokenSelect/index.tsx index 82782d8cd78..dd07f082ec2 100644 --- a/src/ui/component/TokenSelect/index.tsx +++ b/src/ui/component/TokenSelect/index.tsx @@ -156,6 +156,7 @@ const TokenSelect = forwardRef< const handleCurrentTokenChange = (token: TokenItem) => { onChange && onChange(''); onTokenChange(token); + setLpTokenMode(false); setTokenSelectorVisible(false); // const chainItem = findChainByServerID(token.chain); @@ -181,7 +182,11 @@ const TokenSelect = forwardRef< const isSwapType = isSwapTokenType(type); // when no any queryConds - const { tokens: allTokens, isLoading: isLoadingAllTokens } = useTokens( + const { + tokens: allTokens, + isLoading: isLoadingAllTokens, + isAllTokenLoading, // 包含lp Token的请求 + } = useTokens( useSwapTokenList ? undefined : currentAccount?.address, undefined, tokenSelectorVisible, @@ -285,7 +290,8 @@ const TokenSelect = forwardRef< ? isSearchLoading || remoteSwapToSearchTokensLoading : useSwapTokenList ? swapTokenListLoading - : isLoadingAllTokens) || initLoading; + : isLoadingAllTokens || (lpTokenMode && isAllTokenLoading)) || + initLoading; const handleSearchTokens = React.useCallback(async (ctx) => { setQueryConds({ diff --git a/src/ui/component/TokenSelector/index.tsx b/src/ui/component/TokenSelector/index.tsx index 930550aac82..02ea0282e35 100644 --- a/src/ui/component/TokenSelector/index.tsx +++ b/src/ui/component/TokenSelector/index.tsx @@ -307,13 +307,15 @@ const TokenSelector = ({ />

- {t('component.TokenSelector.noTokens')} + {lpTokenMode + ? t('component.TokenSelector.noLpTokens') + : t('component.TokenSelector.noTokens')}

); } return null; - }, [isSwapOrBridge, t]); + }, [isSwapOrBridge, t, lpTokenMode]); const NoDataUI = useMemo( () => @@ -341,7 +343,9 @@ const TokenSelector = ({ {!query || isSearchAddr ? (

- {t('component.TokenSelector.noTokens')} + {lpTokenMode + ? t('component.TokenSelector.noLpTokens') + : t('component.TokenSelector.noTokens')}

) : ( <> @@ -371,6 +375,7 @@ const TokenSelector = ({ type, isSwapOrBridge, query, + lpTokenMode, ] ); @@ -823,7 +828,12 @@ function CommonTokenItem(props: { {getTokenSymbol(token)} {isLpToken(token) && ( - + )} @@ -836,7 +846,12 @@ function CommonTokenItem(props: { {getTokenSymbol(token)} {isLpToken(token) && ( - + )} )} diff --git a/src/ui/utils/portfolio/index.ts b/src/ui/utils/portfolio/index.ts index 84eac0d58e6..642a0bc3395 100644 --- a/src/ui/utils/portfolio/index.ts +++ b/src/ui/utils/portfolio/index.ts @@ -13,7 +13,7 @@ export const useQueryProjects = ( withHistory = false, visible: boolean, isTestnet = false, - isAll = false, + lpTokenMode = false, showBlocked = false ) => { const [time, setTime] = useSafeState(dayjs().subtract(1, 'day')); @@ -33,6 +33,7 @@ export const useQueryProjects = ( tokens, netWorth: tokenNetWorth, isLoading: isTokensLoading, + isAllTokenLoading, hasValue: hasTokens, updateData: updateTokens, walletProject, @@ -45,7 +46,7 @@ export const useQueryProjects = ( 0, undefined, isTestnet, - isAll, + lpTokenMode, showBlocked ); @@ -83,6 +84,7 @@ export const useQueryProjects = ( grossNetWorth, refreshPositions, isTokensLoading, + isAllTokenLoading, isPortfoliosLoading, hasTokens, hasPortfolios, diff --git a/src/ui/utils/portfolio/token.ts b/src/ui/utils/portfolio/token.ts index e0936c9a0de..4b4c2c815f7 100644 --- a/src/ui/utils/portfolio/token.ts +++ b/src/ui/utils/portfolio/token.ts @@ -28,7 +28,7 @@ import { } from './tokenUtils'; import { isSameAddress } from '..'; import { Token } from 'background/service/preference'; -import { defaultTokenFilter, includeLpTokensFilter } from './lpToken'; +import { defaultTokenFilter, isLpToken } from './lpToken'; let lastResetTokenListAddr = ''; // export const tokenChangeLoadingAtom = atom(false); @@ -60,12 +60,13 @@ export const useTokens = ( isTestnet: boolean = chainServerId ? !!findChain({ serverId: chainServerId })?.isTestnet : false, - showAll = false, + lpTokensOnly = false, showBlocked = false ) => { const abortProcess = useRef(); const [data, setData] = useSafeState(walletProject); const [isLoading, setLoading] = useSafeState(true); + const [isAllTokenLoading, setIsAllTokenLoading] = useSafeState(true); const historyTime = useRef(); const historyLoad = useRef(false); const wallet = useWallet(); @@ -134,6 +135,7 @@ export const useTokens = ( const abortedFn = () => { if (callCount === callCountRef.current) { setLoading(false); + setIsAllTokenLoading(false); } }; @@ -151,6 +153,7 @@ export const useTokens = ( historyLoad.current = false; setLoading(true); + setIsAllTokenLoading(true); log('======Start-Tokens======', userAddr); let _data = produce(walletProject, (draft) => { draft.netWorth = 0; @@ -177,6 +180,7 @@ export const useTokens = ( if (!snapshot) { log('--Terminate-tokens-snapshot-', userAddr); setLoading(false); + setIsAllTokenLoading(false); return; } @@ -220,6 +224,7 @@ export const useTokens = ( if (!tokenRes) { log('--Terminate-tokens- no tokenRes', userAddr); setLoading(false); + setIsAllTokenLoading(false); } if (currentAbort.signal.aborted) { @@ -331,7 +336,7 @@ export const useTokens = ( ]); } setLoading(false); - + setIsAllTokenLoading(false); loadHistory(_data, currentAbort); log('<<==Tokens-end==>>', userAddr); @@ -455,15 +460,16 @@ export const useTokens = ( const tokens = useMemo(() => { const list = isTestnet ? testnetTokens.list : mainnetTokens.list; - if (showAll) { - return list.filter(includeLpTokensFilter); + if (lpTokensOnly) { + return list.filter(isLpToken); } return list.filter(defaultTokenFilter); - }, [isTestnet, testnetTokens.list, mainnetTokens.list, showAll]); + }, [isTestnet, testnetTokens.list, mainnetTokens.list, lpTokensOnly]); return { netWorth: data?.netWorth || 0, isLoading, + isAllTokenLoading, tokens, customizeTokens: isTestnet ? testnetTokens.customize diff --git a/src/ui/views/CommonPopup/AssetList/AssetListContainer.tsx b/src/ui/views/CommonPopup/AssetList/AssetListContainer.tsx index 164707dfeb5..6ce4de23525 100644 --- a/src/ui/views/CommonPopup/AssetList/AssetListContainer.tsx +++ b/src/ui/views/CommonPopup/AssetList/AssetListContainer.tsx @@ -49,6 +49,7 @@ export const AssetListContainer: React.FC = ({ const { setApps } = useCommonPopupView(); const { isTokensLoading, + isAllTokenLoading, isPortfoliosLoading, portfolios, tokens: tokenList, @@ -122,8 +123,8 @@ export const AssetListContainer: React.FC = ({ !appPortfolios?.length; React.useEffect(() => { - onEmptyAssets(isEmptyAssets); - }, [isEmptyAssets, onEmptyAssets]); + onEmptyAssets(isEmptyAssets && !lpTokenMode); + }, [isEmptyAssets, onEmptyAssets, lpTokenMode]); const sortTokens = useSortTokens(displayTokenList); const filteredPortfolios = useFilterProtocolList({ @@ -195,7 +196,7 @@ export const AssetListContainer: React.FC = ({ {/* {isFocus || search ? null : } */} - {isTokensLoading || isSearching ? ( + {isTokensLoading || isSearching || (lpTokenMode && isAllTokenLoading) ? ( ) : (
@@ -206,6 +207,7 @@ export const AssetListContainer: React.FC = ({ addTokenEntryRef.current?.startAddToken(); }} isSearch={!!search} + lpTokenMode={lpTokenMode} isNoResults={isNoResults} blockedTokens={displayBlockedTokens} customizeTokens={displayCustomizeTokens} diff --git a/src/ui/views/CommonPopup/AssetList/TokenItem.tsx b/src/ui/views/CommonPopup/AssetList/TokenItem.tsx index f00e27bb7d0..0cb07b6bbf3 100644 --- a/src/ui/views/CommonPopup/AssetList/TokenItem.tsx +++ b/src/ui/views/CommonPopup/AssetList/TokenItem.tsx @@ -62,7 +62,12 @@ const TokenItemAsset: React.FC = ({ item }) => { {item.symbol} {isLpToken(item) && ( - + )}
diff --git a/src/ui/views/CommonPopup/AssetList/TokenList.tsx b/src/ui/views/CommonPopup/AssetList/TokenList.tsx index 1dbf05feeca..8328d9d7f8f 100644 --- a/src/ui/views/CommonPopup/AssetList/TokenList.tsx +++ b/src/ui/views/CommonPopup/AssetList/TokenList.tsx @@ -19,6 +19,7 @@ export interface Props { customizeTokens?: TokenItemProps['item'][]; isTestnet: boolean; selectChainId?: string | null; + lpTokenMode?: boolean; } export const HomeTokenList = ({ @@ -31,6 +32,7 @@ export const HomeTokenList = ({ customizeTokens, isTestnet, selectChainId, + lpTokenMode, }) => { const totalValue = React.useMemo(() => { return list @@ -62,6 +64,20 @@ export const HomeTokenList = ({ /> ); } + if (lpTokenMode && !list?.length) { + return ( +
+ no site +

+ {t('component.TokenSelector.noLpTokens')} +

+
+ ); + } const hasList = !!( list?.length || diff --git a/src/ui/views/Dashboard/components/TokenDetailPopup/TokenDetail.tsx b/src/ui/views/Dashboard/components/TokenDetailPopup/TokenDetail.tsx index 02741a05a2c..104de9524f8 100644 --- a/src/ui/views/Dashboard/components/TokenDetailPopup/TokenDetail.tsx +++ b/src/ui/views/Dashboard/components/TokenDetailPopup/TokenDetail.tsx @@ -369,7 +369,12 @@ const TokenDetail = ({
{ellipsisOverflowedText(getTokenSymbol(token), 16)}
- {isLpToken(token) && } + {isLpToken(token) && ( + + )} diff --git a/src/ui/views/DesktopProfile/components/TokensTabPane/TokenItem.tsx b/src/ui/views/DesktopProfile/components/TokensTabPane/TokenItem.tsx index b6476d10247..59f138e57a9 100644 --- a/src/ui/views/DesktopProfile/components/TokensTabPane/TokenItem.tsx +++ b/src/ui/views/DesktopProfile/components/TokensTabPane/TokenItem.tsx @@ -121,7 +121,9 @@ export const TokenItemAsset: React.FC = ({ hover:text-r-blue-default hover:underline `} /> - {isLpToken(item) && } + {isLpToken(item) && ( + + )} {!disableSwap && ( { const { result: currentList, @@ -53,7 +55,13 @@ export const TokenList = ({ {selectedTab === 'mainnet' ? ( isNoResults ? ( - + ) : ( <> + ) : lpTokenMode ? ( + ) : (
) diff --git a/src/ui/views/DesktopProfile/components/TokensTabPane/TokenTab.tsx b/src/ui/views/DesktopProfile/components/TokensTabPane/TokenTab.tsx index 76517442927..963f2c23568 100644 --- a/src/ui/views/DesktopProfile/components/TokensTabPane/TokenTab.tsx +++ b/src/ui/views/DesktopProfile/components/TokensTabPane/TokenTab.tsx @@ -161,6 +161,7 @@ export const TokenTab = ({ searchList={searchList} isSearch={!!searchValue} search={searchValue} + lpTokenMode={lpTokenMode} /> )} diff --git a/src/ui/views/DesktopProfile/components/TokensTabPane/components/LpTokenTag.tsx b/src/ui/views/DesktopProfile/components/TokensTabPane/components/LpTokenTag.tsx index fc1f521ce00..c576bf56153 100644 --- a/src/ui/views/DesktopProfile/components/TokensTabPane/components/LpTokenTag.tsx +++ b/src/ui/views/DesktopProfile/components/TokensTabPane/components/LpTokenTag.tsx @@ -6,19 +6,19 @@ import { useTranslation } from 'react-i18next'; import { ReactComponent as RCLpTokenIconCC } from '@/ui/assets/lpToken-cc.svg'; -const Overlay = () => { +const Overlay = ({ protocolName }: { protocolName: string }) => { const { t } = useTranslation(); return (
-
+
- {t('component.LpTokenTag.title')} + {t('component.LpTokenTag.descriptionFor', { + protocolName: + protocolName?.charAt(0).toUpperCase() + protocolName?.slice(1), + })}
-
- {t('component.LpTokenTag.description')} -
); }; @@ -27,21 +27,25 @@ export const LpTokenTag = ({ iconClassName, className, size = 16, + protocolName, + inModal, }: { iconClassName?: string; className?: string; size?: number; + protocolName: string; + inModal?: boolean; }) => { return ( } + overlay={} mouseEnterDelay={0} > { const { // useQueryProjects isTokensLoading, + isAllTokenLoading, isPortfoliosLoading, portfolios, tokenList, @@ -338,7 +339,10 @@ export const DesktopProfile = () => { key="tokens" >