|
@@ -66,7 +66,7 @@ function DataTableContent() {
|
|
|
const [data, setData] = useState<TableData[]>([])
|
|
const [data, setData] = useState<TableData[]>([])
|
|
|
const [loading, setLoading] = useState(true)
|
|
const [loading, setLoading] = useState(true)
|
|
|
const [poolOptions, setPoolOptions] = useState<PoolOption[]>([])
|
|
const [poolOptions, setPoolOptions] = useState<PoolOption[]>([])
|
|
|
- const [quickCopyAmount, setQuickCopyAmount] = useState<number>(0)
|
|
|
|
|
|
|
+ const [quickCopyAmount, setQuickCopyAmount] = useState<number>(1)
|
|
|
|
|
|
|
|
const [selectedPoolAddress, setSelectedPoolAddress] = useState<string>(
|
|
const [selectedPoolAddress, setSelectedPoolAddress] = useState<string>(
|
|
|
'FPBW9dtVRoUug2BeUKZAzaknd6iiet9jHM8RcTvwUkyC'
|
|
'FPBW9dtVRoUug2BeUKZAzaknd6iiet9jHM8RcTvwUkyC'
|
|
@@ -388,42 +388,44 @@ function DataTableContent() {
|
|
|
) => {
|
|
) => {
|
|
|
let currentSortField = sortField
|
|
let currentSortField = sortField
|
|
|
let shouldResetPage = false
|
|
let shouldResetPage = false
|
|
|
|
|
+ if (newPagination.current && newPagination.current !== pagination.current) {
|
|
|
|
|
+ const targetPage = newPagination.current
|
|
|
|
|
+ const targetPageSize = newPagination.pageSize || pagination.pageSize
|
|
|
|
|
+ setPagination({
|
|
|
|
|
+ ...pagination,
|
|
|
|
|
+ current: targetPage,
|
|
|
|
|
+ pageSize: targetPageSize,
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- if (sorter && typeof sorter === 'object' && 'field' in sorter) {
|
|
|
|
|
- const sorterObj = sorter as {
|
|
|
|
|
- field?: string
|
|
|
|
|
- order?: 'ascend' | 'descend' | null
|
|
|
|
|
- }
|
|
|
|
|
- if (sorterObj.field && sorterObj.order) {
|
|
|
|
|
- // 映射字段名到 API 的 sortField
|
|
|
|
|
- const fieldMap: Record<string, string> = {
|
|
|
|
|
- copies: 'copies',
|
|
|
|
|
- earnedUsd: 'earnedUsd',
|
|
|
|
|
- pnlUsd: 'pnlUsd',
|
|
|
|
|
- liquidityUsd: 'liquidity',
|
|
|
|
|
- positionAgeMs: 'positionAgeMs',
|
|
|
|
|
|
|
+ fetchData(
|
|
|
|
|
+ targetPage,
|
|
|
|
|
+ targetPageSize,
|
|
|
|
|
+ selectedPoolAddress,
|
|
|
|
|
+ currentSortField
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (sorter && typeof sorter === 'object' && 'field' in sorter) {
|
|
|
|
|
+ const sorterObj = sorter as {
|
|
|
|
|
+ field?: string
|
|
|
|
|
+ order?: 'ascend' | 'descend' | null
|
|
|
}
|
|
}
|
|
|
- const newSortField = fieldMap[sorterObj.field] || sortField
|
|
|
|
|
- if (newSortField !== sortField) {
|
|
|
|
|
- currentSortField = newSortField
|
|
|
|
|
- shouldResetPage = true
|
|
|
|
|
|
|
+ if (sorterObj.field && sorterObj.order) {
|
|
|
|
|
+ // 映射字段名到 API 的 sortField
|
|
|
|
|
+ const fieldMap: Record<string, string> = {
|
|
|
|
|
+ copies: 'copies',
|
|
|
|
|
+ earnedUsd: 'earnedUsd',
|
|
|
|
|
+ pnlUsd: 'pnlUsd',
|
|
|
|
|
+ liquidityUsd: 'liquidity',
|
|
|
|
|
+ positionAgeMs: 'positionAgeMs',
|
|
|
|
|
+ }
|
|
|
|
|
+ const newSortField = fieldMap[sorterObj.field] || sortField
|
|
|
|
|
+ if (newSortField !== sortField) {
|
|
|
|
|
+ currentSortField = newSortField
|
|
|
|
|
+ shouldResetPage = true
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- setSortField(currentSortField)
|
|
|
|
|
- const targetPage = shouldResetPage
|
|
|
|
|
- ? 1
|
|
|
|
|
- : newPagination.current || pagination.current
|
|
|
|
|
- const targetPageSize = newPagination.pageSize || pagination.pageSize
|
|
|
|
|
- setPagination({
|
|
|
|
|
- ...pagination,
|
|
|
|
|
- current: targetPage,
|
|
|
|
|
- pageSize: targetPageSize,
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- fetchData(targetPage, targetPageSize, selectedPoolAddress, currentSortField)
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handlePoolChange = (value: string) => {
|
|
const handlePoolChange = (value: string) => {
|