Skip to content

Commit 409ae17

Browse files
authored
Fix: Hide manage contract button when foreign wallet (#7832)
1 parent be28b0c commit 409ae17

File tree

1 file changed

+27
-21
lines changed
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components

1 file changed

+27
-21
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use client";
12
import {
23
ExternalLinkIcon,
34
GlobeIcon,
@@ -8,6 +9,7 @@ import Link from "next/link";
89
import { useMemo } from "react";
910
import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb";
1011
import type { ChainMetadata } from "thirdweb/chains";
12+
import { useActiveAccount } from "thirdweb/react";
1113
import { Img } from "@/components/blocks/Img";
1214
import { Button } from "@/components/ui/button";
1315
import { CopyAddressButton } from "@/components/ui/CopyAddressButton";
@@ -64,6 +66,7 @@ export function ContractHeaderUI(props: {
6466

6567
return socialUrlsValue;
6668
}, [props.socialUrls]);
69+
const activeAccount = useActiveAccount();
6770

6871
const cleanedChainName = props.chainMetadata?.name
6972
?.replace("Mainnet", "")
@@ -169,29 +172,32 @@ export function ContractHeaderUI(props: {
169172
variant="outline"
170173
/>
171174

172-
<ToolTipLabel
173-
contentClassName="max-w-[300px]"
174-
label={
175-
<>
176-
View this contract in thirdweb dashboard to view contract
177-
management interface
178-
</>
179-
}
180-
>
181-
<Button
182-
asChild
183-
className="rounded-full bg-card gap-1.5 text-xs py-1.5 px-2.5 h-auto"
184-
size="sm"
185-
variant="outline"
175+
{props.contractCreator?.toLowerCase() ===
176+
activeAccount?.address?.toLowerCase() && (
177+
<ToolTipLabel
178+
contentClassName="max-w-[300px]"
179+
label={
180+
<>
181+
View this contract in thirdweb dashboard to view contract
182+
management interface
183+
</>
184+
}
186185
>
187-
<Link
188-
href={`/team/~/~/contract/${props.chainMetadata.slug}/${props.clientContract.address}`}
186+
<Button
187+
asChild
188+
className="rounded-full bg-card gap-1.5 text-xs py-1.5 px-2.5 h-auto"
189+
size="sm"
190+
variant="outline"
189191
>
190-
<Settings2Icon className="size-3.5 text-muted-foreground" />
191-
Manage Contract
192-
</Link>
193-
</Button>
194-
</ToolTipLabel>
192+
<Link
193+
href={`/team/~/~/contract/${props.chainMetadata.slug}/${props.clientContract.address}`}
194+
>
195+
<Settings2Icon className="size-3.5 text-muted-foreground" />
196+
Manage Contract
197+
</Link>
198+
</Button>
199+
</ToolTipLabel>
200+
)}
195201

196202
{validBlockExplorer && (
197203
<BadgeLink

0 commit comments

Comments
 (0)