diff --git a/src/components/Pagination/styled.tsx b/src/components/Pagination/styled.tsx index 11f204aca..e08de2274 100644 --- a/src/components/Pagination/styled.tsx +++ b/src/components/Pagination/styled.tsx @@ -9,10 +9,6 @@ export const PaginationPanel = styled.div` justify-content: center; border-radius: 0 0 6px 6px; box-shadow: 0 2px 6px 0 rgb(0 0 0 / 12%); - - @media (max-width: 750px) { - margin-bottom: 30px; - } ` export const PaginationLeftItem = styled.div` @@ -205,6 +201,7 @@ export const PaginationRightItem = styled.div` @media (max-width: 750px) { margin-left: 10px; + margin-right: 10px; font-size: 12px; } } diff --git a/src/pages/Script/ScriptsComp.tsx b/src/pages/Script/ScriptsComp.tsx index ae363dd2c..da26e5e9a 100644 --- a/src/pages/Script/ScriptsComp.tsx +++ b/src/pages/Script/ScriptsComp.tsx @@ -15,7 +15,7 @@ import TransactionCellScript from '../Transaction/TransactionCellScript' import { shannonToCkb, toCamelcase } from '../../utils/util' import { localeNumberString } from '../../utils/number' import DecimalCapacity from '../../components/DecimalCapacity' -import { CellInScript, CkbTransactionInScript } from './types' +import { CellInScript, CkbTransactionInScript, PageInfo } from './types' import styles from './styles.module.scss' import { QueryResult } from '../../components/QueryResult' import AddressText from '../../components/AddressText' @@ -28,7 +28,7 @@ export const ScriptTransactions = ({ page, size }: { page: number; size: number const { codeHash, hashType } = useParams<{ codeHash: string; hashType: string }>() const transactionsQuery = useQuery(['scripts_ckb_transactions', codeHash, hashType, page, size], async () => { - const { data, meta } = await explorerService.api.requesterV2 + const { data } = await explorerService.api.requesterV2 .get(`scripts/ckb_transactions`, { params: { code_hash: codeHash, @@ -38,14 +38,14 @@ export const ScriptTransactions = ({ page, size }: { page: number; size: number }, }) .then((res: AxiosResponse) => - toCamelcase>(res.data), + toCamelcase>(res.data), ) if (data == null || data.ckbTransactions == null || data.ckbTransactions.length === 0) { throw new Error('Transactions empty') } return { - total: meta?.total ?? 0, + total: data.meta.total, ckbTransactions: data.ckbTransactions, } }) @@ -124,7 +124,7 @@ export const ScriptCells = ({ const { codeHash, hashType } = useParams<{ codeHash: string; hashType: string }>() const cellsQuery = useQuery([`scripts_${cellType}`, codeHash, hashType, page, size], async () => { - const { data, meta } = await explorerService.api.requesterV2 + const { data } = await explorerService.api.requesterV2 .get(`scripts/${cellType}`, { params: { code_hash: codeHash, @@ -134,7 +134,9 @@ export const ScriptCells = ({ }, }) .then((res: AxiosResponse) => - toCamelcase>(res.data), + toCamelcase< + Response.Response<{ deployedCells?: CellInScript[]; referringCells?: CellInScript[]; meta: PageInfo }> + >(res.data), ) const camelCellType = camelcase(cellType) as 'deployedCells' | 'referringCells' if (data == null) { @@ -145,7 +147,7 @@ export const ScriptCells = ({ throw new Error('Cells empty') } return { - total: meta?.total ?? 0, + total: data.meta.total ?? 0, cells, } }) diff --git a/src/pages/Script/styles.module.scss b/src/pages/Script/styles.module.scss index cc4404cee..19940b69a 100644 --- a/src/pages/Script/styles.module.scss +++ b/src/pages/Script/styles.module.scss @@ -34,7 +34,7 @@ /* stylelint-disable-next-line selector-class-pattern */ .ant-tabs-nav-list { - margin-left: 40px; + padding-left: 40px; } /* stylelint-disable-next-line selector-class-pattern */ @@ -168,7 +168,7 @@ @media screen and (width <= 750px) { .codeHash { - width: 600px; + width: 270px; } } } diff --git a/src/pages/Script/types.ts b/src/pages/Script/types.ts index e3bcee0f4..178ef53b0 100644 --- a/src/pages/Script/types.ts +++ b/src/pages/Script/types.ts @@ -13,6 +13,11 @@ export interface ScriptInfo { export type ScriptTabType = 'transactions' | 'deployed_cells' | 'referring_cells' | undefined +export type PageInfo = { + total: number + pageSize: number +} + export interface CkbTransactionInScript { id: number txHash: string