Skip to content

Commit 2405456

Browse files
committed
replaced block with explorer link
1 parent 4015dff commit 2405456

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/app/reports/page.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
1414
import FilterListIcon from "@mui/icons-material/FilterList";
1515
import EmojiEventsIcon from "@mui/icons-material/EmojiEvents";
1616
import CachedIcon from "@mui/icons-material/Cached";
17+
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
1718
import { parseUnits } from "viem";
18-
import { useReadContract } from "wagmi";
19+
import { useReadContract, useChainId, useChains } from "wagmi";
1920
import { CONTRACTS, REWARDS_PROGRAM_ABI } from "@/config/contracts";
2021
import { useRewardTypes, useProgramCodeToId } from "@/hooks/useRewardsProgram";
2122
import { useChunkedEventLogs, type TimeRange } from "@/hooks/useChunkedEventLogs";
@@ -188,6 +189,10 @@ export default function ReportsPage() {
188189
return new Date(ts * 1000).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
189190
};
190191

192+
const chainId = useChainId();
193+
const chains = useChains();
194+
const explorerUrl = chains.find(c => c.id === chainId)?.blockExplorers?.default?.url || "https://basescan.org";
195+
191196
const handleGenerate = () => {
192197
if (loading) {
193198
cancel();
@@ -507,7 +512,7 @@ export default function ReportsPage() {
507512
<TableCell sx={{ whiteSpace: "nowrap" }}>Amount / Detail</TableCell>
508513
{!isMobile && <TableCell sx={{ whiteSpace: "nowrap" }}>Reward Type</TableCell>}
509514
{!isMobile && <TableCell sx={{ whiteSpace: "nowrap" }}>Note</TableCell>}
510-
{!isMobile && <TableCell sx={{ whiteSpace: "nowrap" }}>Block</TableCell>}
515+
{!isMobile && <TableCell sx={{ whiteSpace: "nowrap" }} align="center">Tx</TableCell>}
511516
</TableRow>
512517
</TableHead>
513518
<TableBody>
@@ -552,7 +557,21 @@ export default function ReportsPage() {
552557
{row.note || "-"}
553558
</TableCell>
554559
)}
555-
{!isMobile && <TableCell>{row.blockNumber.toString()}</TableCell>}
560+
{!isMobile && (
561+
<TableCell align="center">
562+
<Tooltip title="View on explorer" arrow>
563+
<IconButton
564+
size="small"
565+
component="a"
566+
href={`${explorerUrl}/tx/${row.txHash}`}
567+
target="_blank"
568+
rel="noopener noreferrer"
569+
>
570+
<OpenInNewIcon fontSize="small" />
571+
</IconButton>
572+
</Tooltip>
573+
</TableCell>
574+
)}
556575
</TableRow>
557576
))}
558577
</TableBody>

0 commit comments

Comments
 (0)