Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

Commit d238123

Browse files
authored
Merge pull request #23 from nftlabs/am/loading
add switch network
2 parents ab72092 + 3d64ada commit d238123

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎parcel-build.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
</head>
2121
<body>
2222
<div id="root"></div>
23-
<script type="module" src="./src/widgets/drop.tsx"></script>
23+
<script type="module" src="./src/widgets/marketplace.tsx"></script>
2424
</body>
2525
</html>

‎src/widgets/marketplace.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,17 @@ const BuyPage: React.FC<BuyPageProps> = ({
663663
expectedChainId,
664664
listing,
665665
}) => {
666+
const [{ data: network }] = useNetwork();
667+
const chainId = useMemo(() => network?.chain?.id, [network]);
668+
669+
if (chainId !== expectedChainId) {
670+
return (
671+
<Center w="100%">
672+
<ConnectWalletButton expectedChainId={expectedChainId} />
673+
</Center>
674+
)
675+
}
676+
666677
if (!listing) {
667678
return (
668679
<Center w="100%" h="100%">
@@ -768,6 +779,7 @@ const MarketplaceWidget: React.FC<MarketplaceWidgetProps> = ({
768779
{ enabled: !!marketplaceModule && !!listingId },
769780
);
770781

782+
771783
return (
772784
<Flex
773785
position="fixed"

0 commit comments

Comments
 (0)