Skip to content

Commit 71c201e

Browse files
committed
pass ownerAccount via props
1 parent df4e630 commit 71c201e

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/ContractEditModulesPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const ContractEditModulesPage: React.FC<
9696
installedModules={installedModules}
9797
refetchModules={() => installedModulesQuery.refetch()}
9898
contract={contract}
99-
isOwnerAccount={isOwner}
99+
ownerAccount={isOwner ? account : undefined}
100100
/>
101101
</div>
102102
);

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/InstalledModulesTable.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ScrollShadow } from "@/components/ui/ScrollShadow/ScrollShadow";
44
import { Alert, AlertTitle } from "@/components/ui/alert";
55
import { CircleSlash } from "lucide-react";
66
import type { ContractOptions } from "thirdweb";
7+
import type { Account } from "thirdweb/wallets";
78
import { ModuleCard } from "./module-card";
89

910
export const InstalledModulesTable = (props: {
@@ -13,9 +14,9 @@ export const InstalledModulesTable = (props: {
1314
isPending: boolean;
1415
};
1516
refetchModules: () => void;
16-
isOwnerAccount: boolean;
17+
ownerAccount: Account | undefined;
1718
}) => {
18-
const { installedModules, isOwnerAccount } = props;
19+
const { installedModules, ownerAccount } = props;
1920

2021
const sectionTitle = (
2122
<h2 className="mb-3 font-bold text-2xl tracking-tight">
@@ -48,7 +49,7 @@ export const InstalledModulesTable = (props: {
4849
moduleAddress={moduleAddress}
4950
contract={props.contract}
5051
onRemoveModule={props.refetchModules}
51-
isOwnerAccount={isOwnerAccount}
52+
ownerAccount={ownerAccount}
5253
/>
5354
))}
5455
</div>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/module-card.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,19 @@ import {
2424
waitForReceipt,
2525
} from "thirdweb";
2626
import { uninstallModuleByProxy } from "thirdweb/modules";
27-
import { useActiveAccount } from "thirdweb/react";
2827
import type { Account } from "thirdweb/wallets";
2928
import { useModuleContractInfo } from "./moduleContractInfo";
3029

3130
type ModuleProps = {
3231
moduleAddress: string;
3332
contract: ContractOptions;
3433
onRemoveModule: () => void;
35-
isOwnerAccount: boolean;
34+
ownerAccount: Account | undefined;
3635
};
3736

3837
export function ModuleCard(props: ModuleProps) {
39-
const { contract, moduleAddress } = props;
38+
const { contract, moduleAddress, ownerAccount } = props;
4039
const [isUninstallModalOpen, setIsUninstallModalOpen] = useState(false);
41-
const account = useActiveAccount();
4240

4341
const contractInfo = useModuleContractInfo(
4442
getContract({
@@ -76,12 +74,12 @@ export function ModuleCard(props: ModuleProps) {
7674
});
7775

7876
const handleRemove = async () => {
79-
if (!account) {
77+
if (!ownerAccount) {
8078
toast.error("Wallet is not connected");
8179
return;
8280
}
8381

84-
uninstallMutation.mutate(account);
82+
uninstallMutation.mutate(ownerAccount);
8583
};
8684

8785
if (!contractInfo) {
@@ -97,7 +95,7 @@ export function ModuleCard(props: ModuleProps) {
9795
publisher: contractInfo.publisher,
9896
version: contractInfo.version,
9997
}}
100-
isOwnerAccount={props.isOwnerAccount}
98+
isOwnerAccount={!!ownerAccount}
10199
uninstallButton={{
102100
onClick: () => {
103101
setIsUninstallModalOpen(true);

0 commit comments

Comments
 (0)