Skip to content

Commit 738292e

Browse files
committed
fix: hide manage contract button when foreign wallet
1 parent c661a48 commit 738292e

File tree

1 file changed

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

1 file changed

+26
-21
lines changed

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

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { YoutubeIcon } from "@/icons/brand-icons/YoutubeIcon";
2424
import { ChainIconClient } from "@/icons/ChainIcon";
2525
import { cn } from "@/lib/utils";
2626
import { resolveSchemeWithErrorHandler } from "@/utils/resolveSchemeWithErrorHandler";
27+
import { useActiveAccount } from "thirdweb/react";
2728

2829
const platformToIcons: Record<string, React.FC<{ className?: string }>> = {
2930
discord: DiscordIcon,
@@ -64,6 +65,7 @@ export function ContractHeaderUI(props: {
6465

6566
return socialUrlsValue;
6667
}, [props.socialUrls]);
68+
const activeAccount = useActiveAccount();
6769

6870
const cleanedChainName = props.chainMetadata?.name
6971
?.replace("Mainnet", "")
@@ -169,29 +171,32 @@ export function ContractHeaderUI(props: {
169171
variant="outline"
170172
/>
171173

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

196201
{validBlockExplorer && (
197202
<BadgeLink

0 commit comments

Comments
 (0)