Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";

import { Button } from "@/components/ui/button";
import { DownloadIcon, PlusIcon } from "lucide-react";
import Link from "next/link";
import { useState } from "react";
import { Button } from "../../../../../@/components/ui/button";
import { ImportModal } from "../../../../../components/contract-components/import-contract/modal";

export function DeployedContractsPageHeader() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Badge } from "@/components/ui/badge";
import { SkeletonContainer } from "@/components/ui/skeleton";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { cn } from "@/lib/utils";
import { useDashboardContractMetadata } from "@3rdweb-sdk/react/hooks/useDashboardContractMetadata";
import type { BasicContract } from "contract-ui/types/types";
import { useChainSlug } from "hooks/chains/chainSlug";
Expand All @@ -16,13 +17,14 @@ import { usePublishedContractsFromDeploy } from "../hooks";

interface AsyncContractNameCellProps {
cell: BasicContract;
linkOverlay?: boolean;
}

// The row components for the contract table, in the <Your contracts> page
// url: /dashboard/contracts/deploy

export const AsyncContractNameCell = memo(
({ cell }: AsyncContractNameCellProps) => {
({ cell, linkOverlay }: AsyncContractNameCellProps) => {
const chainSlug = useChainSlug(cell.chainId);
const chain = useV5DashboardChain(cell.chainId);
const client = useThirdwebClient();
Expand All @@ -46,7 +48,10 @@ export const AsyncContractNameCell = memo(
<Link
href={`/${chainSlug}/${cell.address}`}
passHref
className="text-foreground"
className={cn(
"text-foreground",
linkOverlay && "before:absolute before:inset-0",
)}
>
{v || shortenIfAddress(cell.address)}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import {
type useAllContractList,
useRemoveContractMutation,
Expand All @@ -38,7 +37,6 @@ import {
useTable,
} from "react-table";
import { useAllChainsData } from "../../../hooks/chains/allChains";
import { useChainSlug } from "../../../hooks/chains/chainSlug";
import { AsyncContractNameCell, AsyncContractTypeCell } from "./cells";
import { ShowMoreButton } from "./show-more-button";

Expand Down Expand Up @@ -174,7 +172,7 @@ const ContractTable: React.FC<ContractTableProps> = ({
accessor: (row) => row.address,
// biome-ignore lint/suspicious/noExplicitAny: FIXME
Cell: (cell: any) => {
return <AsyncContractNameCell cell={cell.row.original} />;
return <AsyncContractNameCell cell={cell.row.original} linkOverlay />;
},
},
{
Expand Down Expand Up @@ -231,6 +229,7 @@ const ContractTable: React.FC<ContractTableProps> = ({
copyIconPosition="left"
address={cell.row.original.address}
variant="ghost"
className="relative z-10"
/>
);
},
Expand All @@ -245,6 +244,7 @@ const ContractTable: React.FC<ContractTableProps> = ({
<Button
size="icon"
variant="ghost"
className="relative z-10"
onClick={(e) => e.stopPropagation()}
>
<EllipsisVerticalIcon className="size-4" />
Expand Down Expand Up @@ -367,20 +367,14 @@ const ContractTable: React.FC<ContractTableProps> = ({
};

const ContractTableRow = memo(({ row }: { row: Row<BasicContract> }) => {
const chainSlug = useChainSlug(row.original.chainId);
const router = useDashboardRouter();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { key, ...rowProps } = row.getRowProps();

return (
<TableRow
{...rowProps}
role="group"
className="cursor-pointer hover:bg-muted/50"
// TODO - replace this with before:absolute thing
onClick={() => {
router.push(`/${chainSlug}/${row.original.address}`);
}}
className="relative cursor-pointer hover:bg-muted/50"
>
{row.cells.map((cell, cellIndex) => {
return (
Expand Down
Loading