From 35bbb0a757c8f71150b4031dcd83ec5fb01088f2 Mon Sep 17 00:00:00 2001 From: Corantin Date: Fri, 7 Jun 2024 11:50:19 -0400 Subject: [PATCH] OpenSea --- .../nextjs/components/ProfilComponent.tsx | 21 ++++++- .../nextjs/components/PropertyListBuy.tsx | 6 +- packages/nextjs/components/SidePanel.tsx | 2 +- .../contracts/deed-nft/useDeedMint.hook.ts | 62 +++++++++++++++++-- .../contracts/deed-nft/useDeedUpdate.hook.ts | 5 +- packages/nextjs/models/deed-info.model.ts | 1 + packages/nextjs/pages/_app.tsx | 2 +- packages/nextjs/public/OpenSea.svg | 17 +++++ .../nextjs/public/images/opensea-logo.svg | 23 +++++++ 9 files changed, 125 insertions(+), 14 deletions(-) create mode 100644 packages/nextjs/public/OpenSea.svg create mode 100644 packages/nextjs/public/images/opensea-logo.svg diff --git a/packages/nextjs/components/ProfilComponent.tsx b/packages/nextjs/components/ProfilComponent.tsx index cd3312b3..e640b0e6 100644 --- a/packages/nextjs/components/ProfilComponent.tsx +++ b/packages/nextjs/components/ProfilComponent.tsx @@ -1,3 +1,4 @@ +import Image from "next/image"; import Link from "next/link"; import { Address } from "./scaffold-eth"; import { @@ -6,9 +7,10 @@ import { ShareIcon, } from "@heroicons/react/24/outline"; import useIsValidator from "~~/hooks/contracts/access-manager/useIsValidator.hook"; +import useContractAddress from "~~/hooks/useContractAddress"; import useIsOwner from "~~/hooks/useIsOwner.hook"; import { DeedInfoModel } from "~~/models/deed-info.model"; -import { notification } from "~~/utils/scaffold-eth"; +import { getTargetNetwork, notification } from "~~/utils/scaffold-eth"; interface Props { onRefresh: () => void; @@ -25,6 +27,9 @@ export default function ProfileComponent({ }: Props) { const isOwner = useIsOwner(deedData); const isValidator = useIsValidator(); + const { id: chainId } = getTargetNetwork(); + const deedNFTAddresss = useContractAddress("DeedNFT"); + const handleChatClick = () => { if (isOwner) { const subject = encodeURIComponent( @@ -94,6 +99,20 @@ export default function ProfileComponent({ Refresh +
diff --git a/packages/nextjs/components/PropertyListBuy.tsx b/packages/nextjs/components/PropertyListBuy.tsx index 1d0cbb17..44d95f0a 100644 --- a/packages/nextjs/components/PropertyListBuy.tsx +++ b/packages/nextjs/components/PropertyListBuy.tsx @@ -76,11 +76,7 @@ const BidOffers = ({ deedData }: Props) => { notification.success("Property listed"); }} onGoToToken={() => { - window.open( - chainId === 137 - ? `https://opensea.io/assets/matic/${deedNFTAddresss}/${deedData.mintedId}` - : `https://testnets.opensea.io/assets/sepolia/${deedNFTAddresss}/${deedData.mintedId}`, - ); + window.open(`/overview/${deedData.id}`); }} onClose={() => { listings.mutate(); diff --git a/packages/nextjs/components/SidePanel.tsx b/packages/nextjs/components/SidePanel.tsx index dbff3b0a..0356188a 100644 --- a/packages/nextjs/components/SidePanel.tsx +++ b/packages/nextjs/components/SidePanel.tsx @@ -385,7 +385,7 @@ const SidePanel = ({ deedData, initialData, stableCoin, refetchDeedInfo, router ))}
- {deedData.id && ( + {deedData.id && !deedData.paymentInformation.receipt && ( <>