From 676986d800a97e8b815dabf8df937eb941f9acff Mon Sep 17 00:00:00 2001 From: "john.li" Date: Fri, 23 May 2025 15:27:21 +0800 Subject: [PATCH 1/3] wip --- .../static-resources/src/i18n/en_US/tables.ts | 2 +- .../static-resources/src/i18n/zh_CN/tables.ts | 2 +- .../tableList/dualTxsTable/DualAssetTable.tsx | 8 ++--- .../AssetPage/HistoryPanel/useDualAsset.tsx | 7 ++--- .../AssetPage/HistoryPanel/useDualAsset.tsx | 30 +++++++++++-------- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/packages/common-resources/static-resources/src/i18n/en_US/tables.ts b/packages/common-resources/static-resources/src/i18n/en_US/tables.ts index c3b7d31b5f..a49f05f100 100644 --- a/packages/common-resources/static-resources/src/i18n/en_US/tables.ts +++ b/packages/common-resources/static-resources/src/i18n/en_US/tables.ts @@ -240,7 +240,7 @@ export default { labelDualAssetSettlement_Date: 'Settlement Date', labelDualAssetAPR: 'APR', labelDualAssetAction: 'Actions', - labelDualAssetDetail: 'Detail', + labelDualAssetDetail: 'Details', labelDualAssetRefresh: 'Refresh', labelDualTxsSide: 'Type', labelDualTxsProduct: 'Product', diff --git a/packages/common-resources/static-resources/src/i18n/zh_CN/tables.ts b/packages/common-resources/static-resources/src/i18n/zh_CN/tables.ts index a94891c977..e3f968d924 100644 --- a/packages/common-resources/static-resources/src/i18n/zh_CN/tables.ts +++ b/packages/common-resources/static-resources/src/i18n/zh_CN/tables.ts @@ -239,7 +239,7 @@ export default { labelDualAssetSettlement_Date: 'Settlement Date', labelDualAssetAPR: 'APR', labelDualAssetAction: 'Actions', - labelDualAssetDetail: 'Detail', + labelDualAssetDetail: 'Details', labelDualAssetRefresh: 'Refresh', labelDualTxsSide: 'Type', labelDualTxsProduct: 'Product', diff --git a/packages/component-lib/src/components/tableList/dualTxsTable/DualAssetTable.tsx b/packages/component-lib/src/components/tableList/dualTxsTable/DualAssetTable.tsx index df8529b72e..f3cd181f6c 100644 --- a/packages/component-lib/src/components/tableList/dualTxsTable/DualAssetTable.tsx +++ b/packages/component-lib/src/components/tableList/dualTxsTable/DualAssetTable.tsx @@ -33,7 +33,7 @@ const TableWrapperStyled = styled(Box)` .rdg { ${({ isMobile }) => !isMobile - ? `--template-columns: 14% 16% 20% 10% 14% 10% 8% 8% !important` + ? `--template-columns: 14% 15% 20% 105px 14% 80px 110px 90px!important` : `--template-columns: 16% 30% 44% 10% !important;`} } @@ -245,7 +245,7 @@ export const DualAssetTable = withTranslation(['tables', 'common'])( }, { key: 'Settlement_Date', - sortable: true, + sortable: false, width: 'auto', name: t('labelDualAssetSettlement_Date'), cellClass: 'textAlignCenter', @@ -256,7 +256,7 @@ export const DualAssetTable = withTranslation(['tables', 'common'])( }, { key: 'APR', - sortable: true, + sortable: false, width: 'auto', cellClass: 'textAlignCenter', headerCellClass: 'textAlignCenter', @@ -267,7 +267,7 @@ export const DualAssetTable = withTranslation(['tables', 'common'])( }, { key: 'Auto', - sortable: true, + sortable: false, name: t('labelDualAutoReinvest'), formatter: ({ row }: FormatterProps) => { return row?.__raw__.order?.dualReinvestInfo?.isRecursive ? ( diff --git a/packages/web-earn/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx b/packages/web-earn/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx index e3174ddbc8..b6006cb91a 100644 --- a/packages/web-earn/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx +++ b/packages/web-earn/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx @@ -512,13 +512,12 @@ export const useDualAsset = ( tokenMap[sellTokenSymbol].precision, true, ) - const currentPrice = { - base: item.tokenInfoOrigin.base, - quote: item.tokenInfoOrigin.quote, + base: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenIn] : idIndex[item.tokenInfoOrigin.tokenOut], + quote: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenOut] : idIndex[item.tokenInfoOrigin.tokenIn], currentPrice: findIndex?.index, precisionForPrice: dualMarketMap[item.tokenInfoOrigin.market]?.precisionForPrice, - quoteUnit: item.tokenInfoOrigin.quote, + quoteUnit: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenOut] : idIndex[item.tokenInfoOrigin.tokenIn], } prev.push({ ...format, diff --git a/packages/webapp/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx b/packages/webapp/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx index 81bbd4d8cf..a4a20d6bbb 100644 --- a/packages/webapp/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx +++ b/packages/webapp/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx @@ -365,13 +365,20 @@ export const useDualAsset = ( ) }) const currentPrice = { - base: _item.tokenInfoOrigin.base, - quote: _item.tokenInfoOrigin.quote, + base: + _item.dualType === DUAL_TYPE.DUAL_BASE + ? idIndex[_item.tokenInfoOrigin.tokenIn] + : idIndex[_item.tokenInfoOrigin.tokenOut], + quote: + _item.dualType === DUAL_TYPE.DUAL_BASE + ? idIndex[_item.tokenInfoOrigin.tokenOut] + : idIndex[_item.tokenInfoOrigin.tokenIn], currentPrice: findIndex?.index, - precisionForPrice: - dualMarketMap[_item.tokenInfoOrigin.market]?.precisionForPrice ?? - tokenMap[_item.tokenInfoOrigin.quote]?.precision, - quoteUnit: _item.tokenInfoOrigin.quote, + precisionForPrice: dualMarketMap[_item.tokenInfoOrigin.market]?.precisionForPrice, + quoteUnit: + _item.dualType === DUAL_TYPE.DUAL_BASE + ? idIndex[_item.tokenInfoOrigin.tokenOut] + : idIndex[_item.tokenInfoOrigin.tokenIn], } const format = makeDualOrderedItem( _item, @@ -545,14 +552,13 @@ export const useDualAsset = ( ) const currentPrice = { - base: item.tokenInfoOrigin.base, - quote: item.tokenInfoOrigin.quote, + base: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenIn] : idIndex[item.tokenInfoOrigin.tokenOut], + quote: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenOut] : idIndex[item.tokenInfoOrigin.tokenIn], currentPrice: findIndex?.index, - precisionForPrice: - dualMarketMap[item.tokenInfoOrigin.market]?.precisionForPrice ?? - tokenMap[item.tokenInfoOrigin.quote]?.precision, - quoteUnit: item.tokenInfoOrigin.quote, + precisionForPrice: dualMarketMap[item.tokenInfoOrigin.market]?.precisionForPrice, + quoteUnit: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenOut] : idIndex[item.tokenInfoOrigin.tokenIn], } + prev.push({ ...format, amount, From 2dfcf92ddcf1da491fdf390ca3aa2000cf21a38c Mon Sep 17 00:00:00 2001 From: "john.li" Date: Fri, 23 May 2025 17:34:23 +0800 Subject: [PATCH 2/3] wip --- .../AssetPage/HistoryPanel/useDualAsset.tsx | 9 ++++---- .../AssetPage/HistoryPanel/useDualAsset.tsx | 23 +++++++------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/packages/web-earn/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx b/packages/web-earn/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx index b6006cb91a..32701b2229 100644 --- a/packages/web-earn/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx +++ b/packages/web-earn/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx @@ -512,12 +512,13 @@ export const useDualAsset = ( tokenMap[sellTokenSymbol].precision, true, ) + const market = dualMarketMap[item.tokenInfoOrigin.market] as sdk.DefiMarketInfo const currentPrice = { - base: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenIn] : idIndex[item.tokenInfoOrigin.tokenOut], - quote: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenOut] : idIndex[item.tokenInfoOrigin.tokenIn], + base: idIndex[market.baseTokenId], + quote: idIndex[market.quoteTokenId], currentPrice: findIndex?.index, - precisionForPrice: dualMarketMap[item.tokenInfoOrigin.market]?.precisionForPrice, - quoteUnit: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenOut] : idIndex[item.tokenInfoOrigin.tokenIn], + precisionForPrice: market.precisionForPrice, + quoteUnit: idIndex[market.quoteTokenId], } prev.push({ ...format, diff --git a/packages/webapp/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx b/packages/webapp/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx index a4a20d6bbb..717ffb70ce 100644 --- a/packages/webapp/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx +++ b/packages/webapp/src/pages/AssetPage/HistoryPanel/useDualAsset.tsx @@ -364,21 +364,13 @@ export const useDualAsset = ( indexP.quote === _item.tokenInfoOrigin.quote ) }) + const market = dualMarketMap[_item.tokenInfoOrigin.market] as sdk.DefiMarketInfo const currentPrice = { - base: - _item.dualType === DUAL_TYPE.DUAL_BASE - ? idIndex[_item.tokenInfoOrigin.tokenIn] - : idIndex[_item.tokenInfoOrigin.tokenOut], - quote: - _item.dualType === DUAL_TYPE.DUAL_BASE - ? idIndex[_item.tokenInfoOrigin.tokenOut] - : idIndex[_item.tokenInfoOrigin.tokenIn], + base: idIndex[market.baseTokenId], + quote: idIndex[market.quoteTokenId], currentPrice: findIndex?.index, precisionForPrice: dualMarketMap[_item.tokenInfoOrigin.market]?.precisionForPrice, - quoteUnit: - _item.dualType === DUAL_TYPE.DUAL_BASE - ? idIndex[_item.tokenInfoOrigin.tokenOut] - : idIndex[_item.tokenInfoOrigin.tokenIn], + quoteUnit: idIndex[market.quoteTokenId], } const format = makeDualOrderedItem( _item, @@ -550,13 +542,14 @@ export const useDualAsset = ( tokenMap[sellTokenSymbol].precision, true, ) + const market = dualMarketMap[item.tokenInfoOrigin.market] as sdk.DefiMarketInfo const currentPrice = { - base: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenIn] : idIndex[item.tokenInfoOrigin.tokenOut], - quote: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenOut] : idIndex[item.tokenInfoOrigin.tokenIn], + base: idIndex[market.baseTokenId], + quote: idIndex[market.quoteTokenId], currentPrice: findIndex?.index, precisionForPrice: dualMarketMap[item.tokenInfoOrigin.market]?.precisionForPrice, - quoteUnit: item.dualType === DUAL_TYPE.DUAL_BASE ? idIndex[item.tokenInfoOrigin.tokenOut] : idIndex[item.tokenInfoOrigin.tokenIn], + quoteUnit: idIndex[market.quoteTokenId], } prev.push({ From fa7b27d7dc56248690088763654f50282496ec79 Mon Sep 17 00:00:00 2001 From: "john.li" Date: Fri, 23 May 2025 17:40:58 +0800 Subject: [PATCH 3/3] wip --- .../src/components/tableList/dualTxsTable/DualAssetTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/component-lib/src/components/tableList/dualTxsTable/DualAssetTable.tsx b/packages/component-lib/src/components/tableList/dualTxsTable/DualAssetTable.tsx index f3cd181f6c..5d0d069b62 100644 --- a/packages/component-lib/src/components/tableList/dualTxsTable/DualAssetTable.tsx +++ b/packages/component-lib/src/components/tableList/dualTxsTable/DualAssetTable.tsx @@ -33,7 +33,7 @@ const TableWrapperStyled = styled(Box)` .rdg { ${({ isMobile }) => !isMobile - ? `--template-columns: 14% 15% 20% 105px 14% 80px 110px 90px!important` + ? `--template-columns: 16% 15% 20% 105px 14% 80px 110px 90px!important` : `--template-columns: 16% 30% 44% 10% !important;`} }