From 39a222d3df46b57c1bb67f97e3e10d7d20caf933 Mon Sep 17 00:00:00 2001 From: 2nthony Date: Wed, 23 Oct 2024 14:33:00 +0800 Subject: [PATCH] fix: refactored data #4832 --- .../next-common/components/coretime/salePanel/summary.jsx | 6 ++---- .../components/coretime/salesHistorySection/index.jsx | 6 +++--- .../components/coretime/salesHistorySection/purchases.jsx | 4 ++-- .../components/coretime/salesHistorySection/renewals.jsx | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/next-common/components/coretime/salePanel/summary.jsx b/packages/next-common/components/coretime/salePanel/summary.jsx index d88733147a..190045d227 100644 --- a/packages/next-common/components/coretime/salePanel/summary.jsx +++ b/packages/next-common/components/coretime/salePanel/summary.jsx @@ -2,7 +2,6 @@ import SummaryItem from "next-common/components/summary/layout/item"; import SummaryLayout from "next-common/components/summary/layout/layout"; import ValueDisplay from "next-common/components/valueDisplay"; import { useChainSettings } from "next-common/context/chain"; -import { usePageProps } from "next-common/context/page"; import { toPrecision } from "next-common/utils"; function Item({ label = "", value }) { @@ -15,7 +14,6 @@ function Item({ label = "", value }) { } export default function CoretimeSaleSummary({ data }) { - const { renewalCount, purchaseCount } = usePageProps(); const { decimals, symbol } = useChainSettings(); return ( @@ -92,8 +90,8 @@ export default function CoretimeSaleSummary({ data }) {
- - + +
diff --git a/packages/next-common/components/coretime/salesHistorySection/index.jsx b/packages/next-common/components/coretime/salesHistorySection/index.jsx index b19c8f9ee3..62bca07f87 100644 --- a/packages/next-common/components/coretime/salesHistorySection/index.jsx +++ b/packages/next-common/components/coretime/salesHistorySection/index.jsx @@ -7,7 +7,7 @@ import { useState } from "react"; import { usePageProps } from "next-common/context/page"; export default function CoretimeSalesHistorySection() { - const { purchaseCount, renewalCount } = usePageProps(); + const { coretimeSale } = usePageProps(); const [activeTabLabel, setActiveTabLabel] = useState("Purchases"); return ( @@ -22,12 +22,12 @@ export default function CoretimeSalesHistorySection() { tabs={[ { label: "Renewals", - activeCount: renewalCount, + activeCount: coretimeSale?.renewalCount, content: , }, { label: "Purchases", - activeCount: purchaseCount, + activeCount: coretimeSale?.purchaseCount, content: , }, ]} diff --git a/packages/next-common/components/coretime/salesHistorySection/purchases.jsx b/packages/next-common/components/coretime/salesHistorySection/purchases.jsx index e4382548e4..7c011957c1 100644 --- a/packages/next-common/components/coretime/salesHistorySection/purchases.jsx +++ b/packages/next-common/components/coretime/salesHistorySection/purchases.jsx @@ -15,7 +15,7 @@ import { useState } from "react"; export default function SalesHistoryPurchases() { const { decimals, symbol } = useChainSettings(); - const { id } = usePageProps(); + const { coretimeSale } = usePageProps(); const [page, setPage] = useState(1); const [isTime, setIsTime] = useState(true); @@ -23,7 +23,7 @@ export default function SalesHistoryPurchases() { const { data, loading } = useCoretimeQuery(GET_CORETIME_SALE_PURCHASES, { variables: { - saleId: id, + saleId: coretimeSale?.id, offset: (page - 1) * pageSize, limit: pageSize, }, diff --git a/packages/next-common/components/coretime/salesHistorySection/renewals.jsx b/packages/next-common/components/coretime/salesHistorySection/renewals.jsx index e4411280a2..de2ac16ba0 100644 --- a/packages/next-common/components/coretime/salesHistorySection/renewals.jsx +++ b/packages/next-common/components/coretime/salesHistorySection/renewals.jsx @@ -15,7 +15,7 @@ import { useState } from "react"; export default function SalesHistoryRenewals() { const { decimals, symbol } = useChainSettings(); - const { id } = usePageProps(); + const { coretimeSale } = usePageProps(); const [page, setPage] = useState(1); const [isTime, setIsTime] = useState(true); @@ -23,7 +23,7 @@ export default function SalesHistoryRenewals() { const { data, loading } = useCoretimeQuery(GET_CORETIME_SALE_RENEWALS, { variables: { - saleId: id, + saleId: coretimeSale?.id, offset: (page - 1) * pageSize, limit: pageSize, },