Skip to content

Commit

Permalink
fix: refactored data #4832
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony committed Oct 23, 2024
1 parent 59863ac commit 39a222d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand All @@ -15,7 +14,6 @@ function Item({ label = "", value }) {
}

export default function CoretimeSaleSummary({ data }) {
const { renewalCount, purchaseCount } = usePageProps();
const { decimals, symbol } = useChainSettings();

return (
Expand Down Expand Up @@ -92,8 +90,8 @@ export default function CoretimeSaleSummary({ data }) {
<SummaryItem>
<div className="space-y-1 text12Medium text-textTertiary">
<Item label="System Reserved" value="[0]" />
<Item label="Renewal" value={renewalCount} />
<Item label="Sale" value={purchaseCount} />
<Item label="Renewal" value={data?.renewalCount} />
<Item label="Sale" value={data?.purchaseCount} />
</div>
</SummaryItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -22,12 +22,12 @@ export default function CoretimeSalesHistorySection() {
tabs={[
{
label: "Renewals",
activeCount: renewalCount,
activeCount: coretimeSale?.renewalCount,
content: <SalesHistoryRenewals />,
},
{
label: "Purchases",
activeCount: purchaseCount,
activeCount: coretimeSale?.purchaseCount,
content: <SalesHistoryPurchases />,
},
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ 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);

const pageSize = defaultPageSize;

const { data, loading } = useCoretimeQuery(GET_CORETIME_SALE_PURCHASES, {
variables: {
saleId: id,
saleId: coretimeSale?.id,
offset: (page - 1) * pageSize,
limit: pageSize,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ 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);

const pageSize = defaultPageSize;

const { data, loading } = useCoretimeQuery(GET_CORETIME_SALE_RENEWALS, {
variables: {
saleId: id,
saleId: coretimeSale?.id,
offset: (page - 1) * pageSize,
limit: pageSize,
},
Expand Down

0 comments on commit 39a222d

Please sign in to comment.