diff --git a/packages/dodoex-api/src/gql/gql.ts b/packages/dodoex-api/src/gql/gql.ts index ebf8a737..efef36ed 100644 --- a/packages/dodoex-api/src/gql/gql.ts +++ b/packages/dodoex-api/src/gql/gql.ts @@ -38,7 +38,7 @@ const documents = { types.FetchLiquidityPositionsDocument, '\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ': types.FetchUserSwapOrderHistoriesDocument, - '\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n }\n }\n ': + '\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n ': types.FetchNoticeCenterTransactionListDocument, }; @@ -124,7 +124,7 @@ export function graphql( * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: '\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n }\n }\n ', + source: '\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n ', ): typeof import('./graphql').FetchNoticeCenterTransactionListDocument; export function graphql(source: string) { diff --git a/packages/dodoex-api/src/gql/graphql.ts b/packages/dodoex-api/src/gql/graphql.ts index d6f3e054..73ae67cf 100644 --- a/packages/dodoex-api/src/gql/graphql.ts +++ b/packages/dodoex-api/src/gql/graphql.ts @@ -23236,6 +23236,8 @@ export type FetchNoticeCenterTransactionListQueryVariables = Exact<{ export type FetchNoticeCenterTransactionListQuery = { notice_center_transactionList?: { count?: number | null; + limit?: number | null; + page?: number | null; list?: Array<{ chainId?: number | null; createTime?: string | null; @@ -23929,6 +23931,8 @@ export const FetchNoticeCenterTransactionListDocument = type } count + limit + page } } `) as unknown as TypedDocumentString< diff --git a/packages/dodoex-api/src/helper/GraphQLRequests.ts b/packages/dodoex-api/src/helper/GraphQLRequests.ts index 1b012a53..e463973f 100644 --- a/packages/dodoex-api/src/helper/GraphQLRequests.ts +++ b/packages/dodoex-api/src/helper/GraphQLRequests.ts @@ -2,12 +2,14 @@ import crossFetch from 'cross-fetch'; import { GraphQLClient, RequestDocument, Variables } from 'graphql-request'; import type { TypedDocumentNode } from '@graphql-typed-document-node/core'; import { TypedDocumentString } from '../gql/graphql'; +import { GraphQLClientRequestHeaders } from 'graphql-request/build/esm/types'; type Fetch = typeof crossFetch; export interface GraphQLRequestsConfig { url?: string; fetch?: Fetch; + getHeaders?: () => GraphQLClientRequestHeaders; } const defaultConfig = { @@ -17,9 +19,11 @@ const defaultConfig = { export default class GraphQLRequests { private url: string; private client: GraphQLClient; + private getHeaders?: GraphQLRequestsConfig['getHeaders']; constructor(configProps?: GraphQLRequestsConfig) { const config = { ...defaultConfig, ...configProps }; this.url = config.url; + this.getHeaders = config.getHeaders; const client = new GraphQLClient(this.url, { fetch: config.fetch, requestMiddleware: (request) => { @@ -33,18 +37,22 @@ export default class GraphQLRequests { }; }, }); - const auth = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjMxMzg2NDYzMzAzMjMxNjQzNzM5NjIzMTM4Mzk2MjJkMzA2MjYzMzkzMDYxMzc2NjM4NjQzNDMxMzYzMTJkMzEzNjM0MzYzMjYzMzY2NjJkMzE2NjYxMzQzMDMwMmQzMTM4NjQ2MzMwMzIzMTY0MzczOTYzNjI2MjYzIiwicyI6NDAsImlhdCI6MTcwODMyNzg4OSwiZXhwIjoxNzA4NDE0Mjg5fQ.S6uFXnNWL64nGj23AHuWBV7fxJ0DGlpHXoZAZXtA_Zs'; - client.setHeaders({ - 'Access-Token': auth, - }); this.client = client; + this.setHeaders(); + } + + setHeaders() { + const headers = this.getHeaders?.(); + if (headers) { + this.client.setHeaders(headers); + } } async getData( document: RequestDocument | TypedDocumentNode, variables?: V, ) { + this.setHeaders(); const client = this.client; // @ts-ignore return client.request(document, variables); diff --git a/packages/dodoex-api/src/services/TokenApi/index.ts b/packages/dodoex-api/src/services/TokenApi/index.ts index 5bc62735..21ee759b 100644 --- a/packages/dodoex-api/src/services/TokenApi/index.ts +++ b/packages/dodoex-api/src/services/TokenApi/index.ts @@ -141,9 +141,9 @@ export class TokenApi { 'token', 'getFetchTokenQuery', chainId ?? '', - address?.toLocaleLowerCase(), account?.toLocaleLowerCase(), proxyContractAddress?.toLocaleLowerCase(), + address?.toLocaleLowerCase(), ], enabled: !!chainId && !!address && !!account, queryFn: async () => { diff --git a/packages/dodoex-api/src/services/system/graphqlQuery.ts b/packages/dodoex-api/src/services/system/graphqlQuery.ts index 9ffcba84..54cac87a 100644 --- a/packages/dodoex-api/src/services/system/graphqlQuery.ts +++ b/packages/dodoex-api/src/services/system/graphqlQuery.ts @@ -16,6 +16,8 @@ export const systemGraphqlQuery = { type } count + limit + page } } `), diff --git a/packages/dodoex-components/src/Lottie/EmptyDataIcon.tsx b/packages/dodoex-components/src/Lottie/EmptyDataIcon.tsx index 9c4be086..26277004 100644 --- a/packages/dodoex-components/src/Lottie/EmptyDataIcon.tsx +++ b/packages/dodoex-components/src/Lottie/EmptyDataIcon.tsx @@ -15,6 +15,7 @@ export default function EmptyDataIcon({ display: 'inline-block', width: 105, height: 105, + borderRadius: 24, ...sx, }} /> diff --git a/packages/dodoex-components/src/Tabs/TabPanel.tsx b/packages/dodoex-components/src/Tabs/TabPanel.tsx index e484e27f..7eac4524 100644 --- a/packages/dodoex-components/src/Tabs/TabPanel.tsx +++ b/packages/dodoex-components/src/Tabs/TabPanel.tsx @@ -3,7 +3,7 @@ import { Box, BoxProps } from '../Box'; import React from 'react'; export const TabPanel = React.forwardRef(function TabPanel( - props: TabPanelProps & { + props: Partial & { sx?: BoxProps['sx']; }, ref, diff --git a/packages/dodoex-components/src/Tabs/Tabs.tsx b/packages/dodoex-components/src/Tabs/Tabs.tsx index b147ce45..dff8316e 100644 --- a/packages/dodoex-components/src/Tabs/Tabs.tsx +++ b/packages/dodoex-components/src/Tabs/Tabs.tsx @@ -6,7 +6,7 @@ export const Tabs = React.forwardRef(function TabsList( { onChange, ...props - }: TabsProps & { + }: Partial & { sx?: BoxProps['sx']; }, ref: React.ForwardedRef, diff --git a/packages/dodoex-widgets/src/components/CardWidgets.tsx b/packages/dodoex-widgets/src/components/CardWidgets.tsx index 6d2df06f..df967e98 100644 --- a/packages/dodoex-widgets/src/components/CardWidgets.tsx +++ b/packages/dodoex-widgets/src/components/CardWidgets.tsx @@ -41,6 +41,7 @@ export function CardStatus({ display: 'flex', flexDirection: 'column', gap: 24, + px: 20, }} > {increaseArray(4).map((_, i) => ( diff --git a/packages/dodoex-widgets/src/components/Confirm.tsx b/packages/dodoex-widgets/src/components/Confirm.tsx index a84a7913..e1e09b43 100644 --- a/packages/dodoex-widgets/src/components/Confirm.tsx +++ b/packages/dodoex-widgets/src/components/Confirm.tsx @@ -17,6 +17,7 @@ export type ConfirmProps = React.PropsWithChildren<{ confirmLoading?: boolean; isManualClose?: boolean; onConfirm?: () => void; + modal?: boolean; }>; export default function Confirm(props: ConfirmProps) { const { ConfirmComponent } = useUserOptions(); @@ -39,10 +40,11 @@ export default function Confirm(props: ConfirmProps) { confirmLoading, isManualClose, onConfirm, + modal, } = props; return ( - + (); const swapOrderListQueryLocal = useTradeSwapOrderList({ diff --git a/packages/dodoex-widgets/src/components/Swap/components/TokenCard/TokenPickerDialog.tsx b/packages/dodoex-widgets/src/components/Swap/components/TokenCard/TokenPickerDialog.tsx index 8064fb8c..3ed7a3e5 100644 --- a/packages/dodoex-widgets/src/components/Swap/components/TokenCard/TokenPickerDialog.tsx +++ b/packages/dodoex-widgets/src/components/Swap/components/TokenCard/TokenPickerDialog.tsx @@ -38,6 +38,7 @@ export function TokenPickerDialog({ modal?: boolean; }) { const { height } = useUserOptions(); + const { isMobile } = useWidgetDevice(); return ( {children} diff --git a/packages/dodoex-widgets/src/components/Widget/index.tsx b/packages/dodoex-widgets/src/components/Widget/index.tsx index 6d82e835..82681f30 100644 --- a/packages/dodoex-widgets/src/components/Widget/index.tsx +++ b/packages/dodoex-widgets/src/components/Widget/index.tsx @@ -189,7 +189,7 @@ function InitStatus(props: PropsWithChildren) { ref={widgetRef} > - {props.children} + {props.children} ); } @@ -208,7 +208,9 @@ function Web3Provider(props: PropsWithChildren) { return ( - + + + ); } diff --git a/packages/dodoex-widgets/src/hooks/Token/useHasBalanceTokenList.ts b/packages/dodoex-widgets/src/hooks/Token/useHasBalanceTokenList.ts new file mode 100644 index 00000000..c4eb5bc9 --- /dev/null +++ b/packages/dodoex-widgets/src/hooks/Token/useHasBalanceTokenList.ts @@ -0,0 +1,110 @@ +import { basicTokenMap, ChainId } from '@dodoex/api'; +import { useQuery, useQueryClient } from '@tanstack/react-query'; +import BigNumber from 'bignumber.js'; +import { isEqualWith } from 'lodash'; +import React from 'react'; +import { useSelector } from 'react-redux'; +import { tokenApi } from '../../constants/api'; +import { RootState } from '../../store/reducers'; +import { getPopularTokenList, getTokenList } from '../../store/selectors/token'; +import useTokenListFetchBalance from './useTokenListFetchBalance'; + +type TokenResult = NonNullable< + Awaited['queryFn']>> +>; + +export function useHasBalanceTokenList({ + account, + chainId, + visible, +}: { + account: string | undefined; + chainId: ChainId | undefined; + visible?: boolean; +}) { + const queryClient = useQueryClient(); + const [hasBalanceTokenList, setHasBalanceTokenList] = React.useState< + TokenResult[] + >([]); + const [hasTokenLoading, setHasTokenLoading] = React.useState(true); + + const tokenList = useSelector(getTokenList); + const popularTokenList = useSelector((state: RootState) => + getPopularTokenList(chainId ?? 1, state), + ); + useTokenListFetchBalance({ + chainId: chainId ?? 1, + tokenList, + popularTokenList, + visible: !!chainId && !!visible, + }); + + const basicToken = chainId ? basicTokenMap[chainId] : null; + useQuery(tokenApi.getFetchTokenQuery(chainId, basicToken?.address, account)); + + React.useEffect(() => { + let time: NodeJS.Timeout; + const commonKey = tokenApi + .getFetchTokenQuery(chainId, undefined, account) + .queryKey.filter((item) => !!item); + const unSubscribe = queryClient.getQueryCache().subscribe((event) => { + try { + const isNotMatch = commonKey.some( + (key) => !event.query.queryKey.includes(key), + ); + if (!isNotMatch) { + clearTimeout(time); + // 避免频繁调用 + time = setTimeout(() => { + const tokenQueriesData = queryClient.getQueriesData({ + queryKey: commonKey, + }); + let newHasBalanceTokenList = [] as TokenResult[]; + const hasBalanceAddressSet = new Set(); + tokenQueriesData.forEach((value) => { + const token = value[1]; + if ( + token && + token.balance?.gt(0) && + !hasBalanceAddressSet.has(token.address) + ) { + hasBalanceAddressSet.add(token.address); + newHasBalanceTokenList.push(token); + } + }); + newHasBalanceTokenList = newHasBalanceTokenList.sort((a, b) => + a.balance.gt(b.balance) ? -1 : 1, + ); + if ( + !isEqualWith( + newHasBalanceTokenList, + hasBalanceTokenList, + (newValue, oldValue, key) => { + if (key === 'balance' && BigNumber.isBigNumber(newValue)) { + return newValue.isEqualTo(oldValue); + } + return undefined; + }, + ) + ) { + setHasBalanceTokenList(newHasBalanceTokenList); + if (newHasBalanceTokenList.length) { + setHasTokenLoading(false); + } + } + }, 100); + } + } catch (error) {} + }); + + return () => { + unSubscribe(); + clearTimeout(time); + }; + }, [queryClient, account, chainId, hasBalanceTokenList]); + + return { + tokenLoading: hasTokenLoading, + hasBalanceTokenList, + }; +} diff --git a/packages/dodoex-widgets/src/index.tsx b/packages/dodoex-widgets/src/index.tsx index 87e4df7f..2965ca72 100644 --- a/packages/dodoex-widgets/src/index.tsx +++ b/packages/dodoex-widgets/src/index.tsx @@ -14,10 +14,11 @@ export { WIDGET_MODULE_CLASS_NAME } from './components/WidgetContainer'; export type { WidgetProps } from './components/Widget'; export type SwapWidgetProps = WidgetProps & SwapProps; export type { TokenInfo } from './hooks/Token/type'; +export { useHasBalanceTokenList } from './hooks/Token/useHasBalanceTokenList'; +export { useMessageState } from './hooks/useMessageState'; export { Swap } from './components/Swap'; export { default as SwapOrderHistory } from './components/Swap/SwapOrderHistory'; export { useTradeSwapOrderList } from './hooks/Swap/useTradeSwapOrderList'; -export { TokenCard } from './components/Swap/components/TokenCard'; export { Pool } from './widgets/PoolWidget'; export { default as PoolOperateDialog, @@ -27,6 +28,10 @@ export type { PoolOperateProps } from './widgets/PoolWidget/PoolOperate'; export { usePoolBalanceInfo } from './widgets/PoolWidget/hooks/usePoolBalanceInfo'; export { MiningList } from './widgets/MiningWidget/MiningList'; +export { TokenCard } from './components/Swap/components/TokenCard'; +export { default as TokenLogo } from './components/TokenLogo'; +export { FailedList } from './components/List/FailedList'; +export { EmptyList } from './components/List/EmptyList'; export { getEtherscanPage } from './utils/address'; export { formatReadableNumber, diff --git a/packages/dodoex-widgets/src/locales/en-US.po b/packages/dodoex-widgets/src/locales/en-US.po index 0e3b6a2a..0d9ee767 100644 --- a/packages/dodoex-widgets/src/locales/en-US.po +++ b/packages/dodoex-widgets/src/locales/en-US.po @@ -54,9 +54,9 @@ msgstr "To" msgid "{0} pending" msgstr "{0} pending" -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:327 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:328 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:336 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:472 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:474 msgid "Removing" msgstr "Removing" @@ -89,9 +89,9 @@ msgstr "Dismiss" msgid "Unstaking" msgstr "Unstaking" -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:330 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:331 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:339 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:475 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:477 msgid "Adding" msgstr "Adding" @@ -126,7 +126,7 @@ msgstr "Remove Liquidity" msgid "Rewards" msgstr "Rewards" -#: src/components/Swap/SwapOrderHistory/index.tsx:73 +#: src/components/Swap/SwapOrderHistory/index.tsx:72 msgid "Pay" msgstr "Pay" @@ -190,7 +190,7 @@ msgid "Hour" msgstr "Hour" #: src/widgets/PoolWidget/PoolCreate/components/DepthAndLiquidityChart.tsx:74 -#: src/widgets/PoolWidget/PoolList/index.tsx:185 +#: src/widgets/PoolWidget/PoolList/index.tsx:187 #: src/widgets/PoolWidget/PoolOperate/hooks/usePoolOrMiningTabs.ts:17 msgid "Liquidity" msgstr "Liquidity" @@ -212,7 +212,7 @@ msgstr "Community Treasury" msgid "Fee includes: Cross Chain fees + Swap fees. Gas fee not included." msgstr "Fee includes: Cross Chain fees + Swap fees. Gas fee not included." -#: src/components/Confirm.tsx:124 +#: src/components/Confirm.tsx:126 #: src/components/RiskDialog.tsx:122 #: src/components/SwitchChainDialog/index.tsx:139 #: src/components/WidgetConfirm.tsx:130 @@ -280,9 +280,9 @@ msgstr "Price impact exceeds the slippage tolerance you set. Try increasing the msgid "No results found" msgstr "No results found" -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:281 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:282 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:295 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:389 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:391 msgid "Pair" msgstr "Pair" @@ -324,7 +324,7 @@ msgstr "Mid Price" msgid "Insufficient funds - Please retry after depositing more {EtherTokenSymbol} into your wallet" msgstr "Insufficient funds - Please retry after depositing more {EtherTokenSymbol} into your wallet" -#: src/components/Confirm.tsx:84 +#: src/components/Confirm.tsx:86 #: src/components/WidgetConfirm.tsx:90 msgid "Done" msgstr "Done" @@ -379,12 +379,12 @@ msgid "Insufficient cross-chain fees, need at least {0} {1}" msgstr "Insufficient cross-chain fees, need at least {0} {1}" #: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:230 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:284 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:285 #: src/widgets/PoolWidget/PoolList/components/LoadingCard.tsx:77 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:197 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:298 #: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:254 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:392 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:394 msgid "TVL" msgstr "TVL" @@ -631,7 +631,7 @@ msgid "Estimated Time" msgstr "Estimated Time" #: src/widgets/PoolWidget/PoolCreate/hooks/useVersionList.ts:19 -#: src/widgets/PoolWidget/PoolList/index.tsx:186 +#: src/widgets/PoolWidget/PoolList/index.tsx:188 msgid "Classical AMM-like pool. Suitable for most assets." msgstr "Classical AMM-like pool. Suitable for most assets." @@ -666,9 +666,9 @@ msgid "Review Cross Chain" msgstr "Review Cross Chain" #: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:161 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:415 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:416 #: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:185 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:617 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:619 #: src/widgets/PoolWidget/PoolOperate/hooks/usePoolOrMiningTabs.ts:20 msgid "Mining" msgstr "Mining" @@ -677,7 +677,7 @@ msgstr "Mining" msgid "Price Impact" msgstr "Price Impact" -#: src/components/Swap/components/TokenCard/TokenPickerDialog.tsx:46 +#: src/components/Swap/components/TokenCard/TokenPickerDialog.tsx:47 msgid "Select a token" msgstr "Select a token" @@ -722,7 +722,7 @@ msgstr "Creator" msgid "Trader" msgstr "Trader" -#: src/components/Swap/SwapOrderHistory/index.tsx:114 +#: src/components/Swap/SwapOrderHistory/index.tsx:113 #: src/components/Swap/SwapOrderHistory/SameOrderCard.tsx:55 #: src/widgets/MiningWidget/OperateArea/AssociateMine.tsx:259 #: src/widgets/PoolWidget/PoolOperate/components/LiquidityInfo.tsx:329 @@ -779,7 +779,7 @@ msgstr "You are making changes to the liquidity of a private pool. This is a hig #: src/widgets/PoolWidget/PoolList/hooks/usePoolListTabs.ts:22 #: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:325 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:395 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:397 #: src/widgets/PoolWidget/PoolOperate/components/LiquidityInfo.tsx:359 msgid "My Liquidity" msgstr "My Liquidity" @@ -878,7 +878,7 @@ msgstr "Initial Price" msgid "Guide Price" msgstr "Guide Price" -#: src/components/Confirm.tsx:106 +#: src/components/Confirm.tsx:108 #: src/components/SwitchChainDialog/index.tsx:128 #: src/components/WidgetConfirm.tsx:112 #: src/widgets/PoolWidget/PoolCreate/operate-widgets/BottomButtonGroup.tsx:274 @@ -947,7 +947,7 @@ msgstr "Received" msgid "My Pools" msgstr "My Pools" -#: src/components/Swap/SwapOrderHistory/index.tsx:106 +#: src/components/Swap/SwapOrderHistory/index.tsx:105 msgid "Rate" msgstr "Rate" @@ -1047,7 +1047,7 @@ msgstr "Second" msgid "Total Swap Volume" msgstr "Total Swap Volume" -#: src/components/Swap/SwapOrderHistory/index.tsx:100 +#: src/components/Swap/SwapOrderHistory/index.tsx:99 #: src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.tsx:325 msgid "Receive" msgstr "Receive" @@ -1081,12 +1081,12 @@ msgid "My Staked" msgstr "My Staked" #: src/widgets/PoolWidget/PoolDetail/index.tsx:196 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:248 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:475 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:249 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:477 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:267 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:548 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:363 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:697 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:365 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:701 #: src/widgets/PoolWidget/PoolOperate/AddPoolOperate.tsx:89 #: src/widgets/PoolWidget/PoolOperate/hooks/usePoolOperateTabs.ts:15 msgid "Add" @@ -1114,7 +1114,7 @@ msgstr "Low" msgid "Select a liquidity pool" msgstr "Select a liquidity pool" -#: src/widgets/PoolWidget/PoolList/index.tsx:135 +#: src/widgets/PoolWidget/PoolList/index.tsx:137 msgid "Create Pool" msgstr "Create Pool" @@ -1179,11 +1179,11 @@ msgstr "Detail" #: src/widgets/PoolWidget/PoolDetail/components/TitleInfo.tsx:194 #: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:192 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:287 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:288 #: src/widgets/PoolWidget/PoolList/components/LoadingCard.tsx:57 #: src/widgets/PoolWidget/PoolList/components/TokenListPoolItem.tsx:102 #: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:216 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:398 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:400 msgid "APY" msgstr "APY" @@ -1211,8 +1211,8 @@ msgstr "Initial Price Alert" #: src/widgets/PoolWidget/PoolDetail/index.tsx:189 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:252 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:536 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:349 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:686 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:350 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:689 #: src/widgets/PoolWidget/PoolOperate/hooks/usePoolOperateTabs.ts:16 #: src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.tsx:164 msgid "Remove" @@ -1234,7 +1234,7 @@ msgstr "Pool Creation Confirmation" msgid "Amounts" msgstr "Amounts" -#: src/components/Swap/SwapOrderHistory/index.tsx:103 +#: src/components/Swap/SwapOrderHistory/index.tsx:102 msgid "Status" msgstr "Status" diff --git a/packages/dodoex-widgets/src/locales/zh-CN.po b/packages/dodoex-widgets/src/locales/zh-CN.po index 678a10a4..9b17cef8 100644 --- a/packages/dodoex-widgets/src/locales/zh-CN.po +++ b/packages/dodoex-widgets/src/locales/zh-CN.po @@ -54,9 +54,9 @@ msgstr "至" msgid "{0} pending" msgstr "{0} 等待中" -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:327 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:328 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:336 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:472 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:474 msgid "Removing" msgstr "" @@ -89,9 +89,9 @@ msgstr "忽略" msgid "Unstaking" msgstr "" -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:330 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:331 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:339 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:475 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:477 msgid "Adding" msgstr "" @@ -126,7 +126,7 @@ msgstr "" msgid "Rewards" msgstr "" -#: src/components/Swap/SwapOrderHistory/index.tsx:73 +#: src/components/Swap/SwapOrderHistory/index.tsx:72 msgid "Pay" msgstr "" @@ -190,7 +190,7 @@ msgid "Hour" msgstr "小时" #: src/widgets/PoolWidget/PoolCreate/components/DepthAndLiquidityChart.tsx:74 -#: src/widgets/PoolWidget/PoolList/index.tsx:185 +#: src/widgets/PoolWidget/PoolList/index.tsx:187 #: src/widgets/PoolWidget/PoolOperate/hooks/usePoolOrMiningTabs.ts:17 msgid "Liquidity" msgstr "" @@ -212,7 +212,7 @@ msgstr "" msgid "Fee includes: Cross Chain fees + Swap fees. Gas fee not included." msgstr "费用包括过跨链桥和交易的手续费,不包括 gas 费。" -#: src/components/Confirm.tsx:124 +#: src/components/Confirm.tsx:126 #: src/components/RiskDialog.tsx:122 #: src/components/SwitchChainDialog/index.tsx:139 #: src/components/WidgetConfirm.tsx:130 @@ -280,9 +280,9 @@ msgstr "价格冲击超过了你设置的滑点, 请提高滑点后重试" msgid "No results found" msgstr "" -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:281 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:282 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:295 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:389 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:391 msgid "Pair" msgstr "" @@ -324,7 +324,7 @@ msgstr "" msgid "Insufficient funds - Please retry after depositing more {EtherTokenSymbol} into your wallet" msgstr "余额不足 - 请在钱包充值{EtherTokenSymbol}后重试" -#: src/components/Confirm.tsx:84 +#: src/components/Confirm.tsx:86 #: src/components/WidgetConfirm.tsx:90 msgid "Done" msgstr "" @@ -379,12 +379,12 @@ msgid "Insufficient cross-chain fees, need at least {0} {1}" msgstr "跨链费用不足,至少需要 {0} {1} " #: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:230 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:284 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:285 #: src/widgets/PoolWidget/PoolList/components/LoadingCard.tsx:77 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:197 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:298 #: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:254 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:392 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:394 msgid "TVL" msgstr "" @@ -631,7 +631,7 @@ msgid "Estimated Time" msgstr "预计时间" #: src/widgets/PoolWidget/PoolCreate/hooks/useVersionList.ts:19 -#: src/widgets/PoolWidget/PoolList/index.tsx:186 +#: src/widgets/PoolWidget/PoolList/index.tsx:188 msgid "Classical AMM-like pool. Suitable for most assets." msgstr "" @@ -666,9 +666,9 @@ msgid "Review Cross Chain" msgstr "预览跨链交易" #: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:161 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:415 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:416 #: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:185 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:617 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:619 #: src/widgets/PoolWidget/PoolOperate/hooks/usePoolOrMiningTabs.ts:20 msgid "Mining" msgstr "" @@ -677,7 +677,7 @@ msgstr "" msgid "Price Impact" msgstr "价格冲击" -#: src/components/Swap/components/TokenCard/TokenPickerDialog.tsx:46 +#: src/components/Swap/components/TokenCard/TokenPickerDialog.tsx:47 msgid "Select a token" msgstr "选择代币" @@ -722,7 +722,7 @@ msgstr "" msgid "Trader" msgstr "" -#: src/components/Swap/SwapOrderHistory/index.tsx:114 +#: src/components/Swap/SwapOrderHistory/index.tsx:113 #: src/components/Swap/SwapOrderHistory/SameOrderCard.tsx:55 #: src/widgets/MiningWidget/OperateArea/AssociateMine.tsx:259 #: src/widgets/PoolWidget/PoolOperate/components/LiquidityInfo.tsx:329 @@ -779,7 +779,7 @@ msgstr "" #: src/widgets/PoolWidget/PoolList/hooks/usePoolListTabs.ts:22 #: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:325 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:395 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:397 #: src/widgets/PoolWidget/PoolOperate/components/LiquidityInfo.tsx:359 msgid "My Liquidity" msgstr "" @@ -878,7 +878,7 @@ msgstr "" msgid "Guide Price" msgstr "" -#: src/components/Confirm.tsx:106 +#: src/components/Confirm.tsx:108 #: src/components/SwitchChainDialog/index.tsx:128 #: src/components/WidgetConfirm.tsx:112 #: src/widgets/PoolWidget/PoolCreate/operate-widgets/BottomButtonGroup.tsx:274 @@ -947,7 +947,7 @@ msgstr "" msgid "My Pools" msgstr "" -#: src/components/Swap/SwapOrderHistory/index.tsx:106 +#: src/components/Swap/SwapOrderHistory/index.tsx:105 msgid "Rate" msgstr "" @@ -1047,7 +1047,7 @@ msgstr "秒" msgid "Total Swap Volume" msgstr "" -#: src/components/Swap/SwapOrderHistory/index.tsx:100 +#: src/components/Swap/SwapOrderHistory/index.tsx:99 #: src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.tsx:325 msgid "Receive" msgstr "" @@ -1081,12 +1081,12 @@ msgid "My Staked" msgstr "" #: src/widgets/PoolWidget/PoolDetail/index.tsx:196 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:248 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:475 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:249 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:477 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:267 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:548 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:363 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:697 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:365 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:701 #: src/widgets/PoolWidget/PoolOperate/AddPoolOperate.tsx:89 #: src/widgets/PoolWidget/PoolOperate/hooks/usePoolOperateTabs.ts:15 msgid "Add" @@ -1114,7 +1114,7 @@ msgstr "" msgid "Select a liquidity pool" msgstr "" -#: src/widgets/PoolWidget/PoolList/index.tsx:135 +#: src/widgets/PoolWidget/PoolList/index.tsx:137 msgid "Create Pool" msgstr "" @@ -1179,11 +1179,11 @@ msgstr "详情" #: src/widgets/PoolWidget/PoolDetail/components/TitleInfo.tsx:194 #: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:192 -#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:287 +#: src/widgets/PoolWidget/PoolList/AddLiquidity.tsx:288 #: src/widgets/PoolWidget/PoolList/components/LoadingCard.tsx:57 #: src/widgets/PoolWidget/PoolList/components/TokenListPoolItem.tsx:102 #: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:216 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:398 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:400 msgid "APY" msgstr "" @@ -1211,8 +1211,8 @@ msgstr "" #: src/widgets/PoolWidget/PoolDetail/index.tsx:189 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:252 #: src/widgets/PoolWidget/PoolList/MyCreated.tsx:536 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:349 -#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:686 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:350 +#: src/widgets/PoolWidget/PoolList/MyLiquidity.tsx:689 #: src/widgets/PoolWidget/PoolOperate/hooks/usePoolOperateTabs.ts:16 #: src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.tsx:164 msgid "Remove" @@ -1234,7 +1234,7 @@ msgstr "" msgid "Amounts" msgstr "" -#: src/components/Swap/SwapOrderHistory/index.tsx:103 +#: src/components/Swap/SwapOrderHistory/index.tsx:102 msgid "Status" msgstr "" diff --git a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolCreate/components/FixedInitPriceConfirm.tsx b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolCreate/components/FixedInitPriceConfirm.tsx index a9cb58f2..eb7afb07 100644 --- a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolCreate/components/FixedInitPriceConfirm.tsx +++ b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolCreate/components/FixedInitPriceConfirm.tsx @@ -16,6 +16,7 @@ export default function FixedInitPriceConfirm({ onClose={onClose} onConfirm={onConfirm} title={t`Initial Price Alert`} + modal > The initial price is different from the current market price, which may diff --git a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/AddLiquidity.tsx b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/AddLiquidity.tsx index adabdb9e..ab87209e 100644 --- a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/AddLiquidity.tsx +++ b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/AddLiquidity.tsx @@ -242,6 +242,7 @@ function CardList({ evt.stopPropagation(); setOperatePool({ pool: convertFetchLiquidityToOperateData(lq), + hasMining, }); }} > @@ -469,6 +470,7 @@ function TableList({ onClick={() => { setOperatePool({ pool: convertFetchLiquidityToOperateData(lq), + hasMining, }); }} > diff --git a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/MyLiquidity.tsx b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/MyLiquidity.tsx index 4ba5a03e..e246c628 100644 --- a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/MyLiquidity.tsx +++ b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/MyLiquidity.tsx @@ -343,6 +343,7 @@ function CardList({ setOperatePool({ operate: OperateTab.Remove, pool: convertFetchLiquidityToOperateData(lq), + hasMining, }); }} > @@ -357,6 +358,7 @@ function CardList({ setOperatePool({ operate: OperateTab.Add, pool: convertFetchLiquidityToOperateData(lq), + hasMining, }); }} > @@ -680,6 +682,7 @@ function TableList({ setOperatePool({ operate: OperateTab.Remove, pool: convertFetchLiquidityToOperateData(lq), + hasMining, }); }} > @@ -691,6 +694,7 @@ function TableList({ onClick={() => { setOperatePool({ pool: convertFetchLiquidityToOperateData(lq), + hasMining, }); }} > diff --git a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/index.tsx b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/index.tsx index 2a25758b..b7841ce6 100644 --- a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/index.tsx +++ b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolList/index.tsx @@ -12,7 +12,10 @@ import { useRouterStore } from '../../../router'; import { PageType } from '../../../router/types'; import WidgetContainer from '../../../components/WidgetContainer'; import { useWidgetDevice } from '../../../hooks/style/useWidgetDevice'; -import PoolOperateDialog, { PoolOperateProps } from '../PoolOperate'; +import PoolOperateDialog, { + PoolOperate, + PoolOperateProps, +} from '../PoolOperate'; import { HowItWorks } from '../../../components/HowItWorks'; import { ReactComponent as LeftImage } from './pool-left.svg'; import { useUserOptions } from '../../../components/UserOptionsProvider'; @@ -56,7 +59,6 @@ export default function PoolList() { display: 'flex', gap: 12, flex: 1, - overflow: 'hidden', }), }} ref={scrollParentRef} @@ -188,12 +190,29 @@ export default function PoolList() { LeftImage={LeftImage} /> )} - setOperatePool(null)} - modal={isMobile} - {...operatePool} - /> + {isMobile ? ( + setOperatePool(null)} + modal={isMobile} + {...operatePool} + /> + ) : ( + !!operatePool && ( + setOperatePool(null)} + {...operatePool} + sx={{ + width: 375, + height: 'max-content', + backgroundColor: 'background.paper', + borderRadius: 16, + overflow: 'hidden', + }} + /> + ) + )} ); diff --git a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/AddPoolOperate.tsx b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/AddPoolOperate.tsx index d5b8610f..be85d378 100644 --- a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/AddPoolOperate.tsx +++ b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/AddPoolOperate.tsx @@ -216,6 +216,7 @@ export function AddPoolOperate({ onClose={() => setShowCompareConfirm(false)} title={t`Confirm submission`} onConfirm={submitLq} + modal > diff --git a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.tsx b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.tsx index 956ceeaa..c03efae7 100644 --- a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.tsx +++ b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.tsx @@ -425,6 +425,7 @@ export function RemovePoolOperate({ onClose={() => setShowCompareConfirm(false)} title={t`Confirm submission`} onConfirm={submitLq} + modal > diff --git a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/index.tsx b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/index.tsx index b63b9a6f..b097057f 100644 --- a/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/index.tsx +++ b/packages/dodoex-widgets/src/widgets/PoolWidget/PoolOperate/index.tsx @@ -43,7 +43,7 @@ export function PoolOperate({ address, operate, chainId, - hasMining = true, + hasMining, sx, }: PoolOperateProps) { const { account } = useWeb3React();