Skip to content

Commit

Permalink
feat: page links' variables
Browse files Browse the repository at this point in the history
update details' pages
  • Loading branch information
Jennievon committed Sep 28, 2024
1 parent 408faca commit 49f2284
Show file tree
Hide file tree
Showing 29 changed files with 524 additions and 315 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ import {
import { useQuery } from "@tanstack/react-query";
import { useRouter } from "next/router";
import { getOptions } from "../../../src/lib/constants";
import { pathToUrl } from "@/src/routes/router";
import { pageLinks } from "@/src/routes";

export default function BatchTransactions() {
const router = useRouter();
const { fullHash } = router.query;
const { hash } = router.query;
const options = getOptions(router.query);

const { data, isLoading, refetch } = useQuery({
queryKey: ["batchTransactions", { fullHash, options }],
queryFn: () => fetchBatchTransactions(fullHash as string, options),
queryKey: ["batchTransactions", { hash, options }],
queryFn: () => fetchBatchTransactions(hash as string, options),
});

const { TransactionsData, Total } = data?.result || {
Expand All @@ -35,14 +37,20 @@ export default function BatchTransactions() {
<Card className="col-span-3">
<CardHeader>
<CardTitle>Transactions</CardTitle>
<CardDescription className="flex items-center space-x-2">
<p>Overview of all transactions in this batch:</p>
<TruncatedAddress
address={fullHash as string}
showCopy={false}
link={"/batch/" + fullHash}
/>
</CardDescription>
<div className="flex space-x-2 wrap">
<CardDescription className="flex items-center space-x-2">
<span>
Overview of all transactions in this batch:
<TruncatedAddress
address={hash as string}
showCopy={false}
link={pathToUrl(pageLinks.batchByHash, {
hash: hash as string,
})}
/>
</span>
</CardDescription>
</div>
</CardHeader>
<CardContent>
<DataTable
Expand Down
12 changes: 1 addition & 11 deletions tools/tenscan/frontend/pages/batches/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,12 @@ export const metadata: Metadata = {
};

export default function Batches() {
const { batches, refetchBatches, isBatchesLoading, setNoPolling } =
useBatchesService();
const { batches, refetchBatches, isBatchesLoading } = useBatchesService();
const { BatchesData, Total } = batches?.result || {
BatchesData: [],
Total: 0,
};

React.useEffect(() => {
setNoPolling(true);

return () => {
setNoPolling(false);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const firstBatchHeight = Number(getItem(BatchesData, "height"));
const lastBatchHeight = Number(
getItem(BatchesData, "height", ItemPosition.LAST)
Expand Down
9 changes: 1 addition & 8 deletions tools/tenscan/frontend/pages/blocks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@ export const metadata: Metadata = {
};

export default function Blocks() {
const { blocks, setNoPolling, refetchBlocks, isBlocksLoading } =
useBlocksService();
const { blocks, refetchBlocks, isBlocksLoading } = useBlocksService();
const { BlocksData, Total } = blocks?.result || {
BlocksData: [],
Total: 0,
};

React.useEffect(() => {
setNoPolling(true);
return () => setNoPolling(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const firstBlockNumber = Number(getItem(BlocksData, "blockHeader.number"));
const lastBlockNumber = Number(
getItem(BlocksData, "blockHeader.number", ItemPosition.LAST)
Expand Down
12 changes: 1 addition & 11 deletions tools/tenscan/frontend/pages/rollups/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,12 @@ export const metadata: Metadata = {
};

export default function Rollups() {
const { rollups, setNoPolling, isRollupsLoading, refetchRollups } =
useRollupsService();
const { rollups, isRollupsLoading, refetchRollups } = useRollupsService();
const { RollupsData, Total } = rollups?.result || {
RollupsData: [],
Total: 0,
};

React.useEffect(() => {
setNoPolling(true);

return () => {
setNoPolling(false);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const firstRollupID = Number(getItem(RollupsData, "ID"));
const lastRollupID = Number(getItem(RollupsData, "ID", ItemPosition.LAST));

Expand Down
17 changes: 2 additions & 15 deletions tools/tenscan/frontend/pages/transactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,13 @@ export const metadata: Metadata = {
};

export default function Transactions() {
const {
transactions,
refetchTransactions,
setNoPolling,
isTransactionsLoading,
} = useTransactionsService();
const { transactions, refetchTransactions, isTransactionsLoading } =
useTransactionsService();
const { TransactionsData, Total } = transactions?.result || {
TransactionsData: [],
Total: 0,
};

React.useEffect(() => {
setNoPolling(true);

return () => {
setNoPolling(false);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const firstBatchHeight = getItem(TransactionsData, "BatchHeight");
const lastBatchHeight = getItem(
TransactionsData,
Expand Down
2 changes: 1 addition & 1 deletion tools/tenscan/frontend/src/components/health-indicator.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { Badge, badgeVariants } from "@repo/ui/components/shared/badge";
import { useGeneralService } from "../services/useGeneralService";
import { BarChart } from "lucide-react";
import { BarChart } from "@repo/ui/components/shared/react-icons";
import {
TooltipProvider,
TooltipTrigger,
Expand Down
2 changes: 0 additions & 2 deletions tools/tenscan/frontend/src/components/layouts/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ export default function Header() {
width={150}
height={40}
className="cursor-pointer dark:hidden"
fetchPriority="auto"
/>
<Image
src="/assets/images/white_logotype.png"
alt="Logo"
width={150}
height={40}
className="cursor-pointer hidden dark:block"
fetchPriority="auto"
/>
</Link>
<div className="hidden md:flex items-center space-x-2">
Expand Down
Loading

0 comments on commit 49f2284

Please sign in to comment.