From 9c7168b7623bf7ee7bc7d2a0998a571595b6dce9 Mon Sep 17 00:00:00 2001 From: Anurag Date: Thu, 24 Mar 2022 13:51:12 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=94=A5=20chore:=20remove=20modal,=20f?= =?UTF-8?q?ix=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/@types/types.ts | 12 +--- web/components/Modals/ChangeNetwork.modal.tsx | 72 ------------------- .../Navigation/Header.component.tsx | 21 +++--- web/components/index.ts | 3 +- web/pages/index.tsx | 2 +- web/pages/mint/index.tsx | 13 +--- 6 files changed, 19 insertions(+), 104 deletions(-) delete mode 100644 web/components/Modals/ChangeNetwork.modal.tsx diff --git a/web/@types/types.ts b/web/@types/types.ts index 49ed6e8..28840ce 100644 --- a/web/@types/types.ts +++ b/web/@types/types.ts @@ -1,13 +1,3 @@ type modes = "development" | "production" | "test"; -interface modalProps { - isOpen: boolean; - onOpen: () => void; - onClose: () => void; -} - -interface headerProps { - onHomePage: boolean; -} - -export type { modes, modalProps, headerProps } \ No newline at end of file +export type { modes } \ No newline at end of file diff --git a/web/components/Modals/ChangeNetwork.modal.tsx b/web/components/Modals/ChangeNetwork.modal.tsx deleted file mode 100644 index 73d0f81..0000000 --- a/web/components/Modals/ChangeNetwork.modal.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import React, { FC } from "react"; -import { useSwitchNetwork } from "@3rdweb/hooks"; - -import { - Modal, - ModalOverlay, - ModalContent, - ModalHeader, - ModalBody, - Button, - Text, - Box, - Image, -} from "@chakra-ui/react"; -import config from "../../lib/config"; - -import type { modalProps } from "../../@types/types"; - -const ChangeNetwork: FC = ({ isOpen, onOpen, onClose }) => { - const { switchNetwork } = useSwitchNetwork(); - - return ( - <> - - - - Change Network - - - polygon bhai - - - you're not connected to the polygon mumbai network - - - - - - - - - - - ); -}; - -export default ChangeNetwork; diff --git a/web/components/Navigation/Header.component.tsx b/web/components/Navigation/Header.component.tsx index bfe1951..5a42bdd 100644 --- a/web/components/Navigation/Header.component.tsx +++ b/web/components/Navigation/Header.component.tsx @@ -1,9 +1,12 @@ import { FC } from "react"; -import { Box, Text, Flex, Link } from "@chakra-ui/react"; -import type { headerProps } from "../../@types/types"; +import { Box, Text, Link } from "@chakra-ui/react"; -const Header: FC = onHomePage => { +import { useRouter } from "next/router"; + +const Header: FC = () => { + const router = useRouter() + return ( <> = onHomePage => { > github. - {onHomePage ? ( - early access. - ) : ( - home. - )} + { + router.pathname === "/" ? ( + early access. + ) : ( + home. + ) + } diff --git a/web/components/index.ts b/web/components/index.ts index 7cd0cb4..0f44d4e 100644 --- a/web/components/index.ts +++ b/web/components/index.ts @@ -1,4 +1,3 @@ export { default as Header } from "./Navigation/Header.component"; export { default as Hero } from "./Sections/Hero.section"; -export { default as Working } from "./Sections/Working"; -export { default as ChangeNetwork } from "./Modals/ChangeNetwork.modal" \ No newline at end of file +export { default as Working } from "./Sections/Working"; \ No newline at end of file diff --git a/web/pages/index.tsx b/web/pages/index.tsx index fdb1792..769bcd6 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -14,7 +14,7 @@ const Home: NextPage = () => { bgImage="https://res.cloudinary.com/didkcszrq/image/upload/v1647222804/background_gradient_mwbieb.svg" backgroundSize="cover" > -
+
diff --git a/web/pages/mint/index.tsx b/web/pages/mint/index.tsx index 0ef8d88..571a0a3 100644 --- a/web/pages/mint/index.tsx +++ b/web/pages/mint/index.tsx @@ -1,17 +1,15 @@ import type { NextPage } from "next"; import { useEffect, useState } from "react"; -import { Box, Text, Button, Badge, useDisclosure } from "@chakra-ui/react"; +import { Box, Text, Button, Badge } from "@chakra-ui/react"; import type { modes } from "../../@types/types"; -import { Header, ChangeNetwork } from "../../components"; +import { Header } from "../../components"; import { useWeb3 } from "@3rdweb/hooks"; import { supabase } from "../../utils/supabaseClient"; const MintPage: NextPage = () => { const { address, connectWallet, error } = useWeb3(); - const { isOpen, onOpen, onClose } = useDisclosure(); - const [env, setEnv] = useState(); useEffect(() => { @@ -22,10 +20,6 @@ const MintPage: NextPage = () => { : setEnv("test"); }, [env, setEnv]); - useEffect(() => { - error?.name === "UnsupportedChainIdError" ? onOpen() : onClose(); - }, [error, onOpen, onClose]); - const loginWithGithub = async () => { const { user, session, error } = await supabase.auth.signIn( { @@ -44,7 +38,6 @@ const MintPage: NextPage = () => { return ( <> - { bgImage="https://res.cloudinary.com/didkcszrq/image/upload/v1647222804/background_gradient_mwbieb.svg" backgroundSize="cover" > -
+
Date: Thu, 24 Mar 2022 13:56:57 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=A7=90=20chore:=20support=20all=20cha?= =?UTF-8?q?in=20ids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/lib/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/lib/config.ts b/web/lib/config.ts index 2caf088..897ee81 100644 --- a/web/lib/config.ts +++ b/web/lib/config.ts @@ -1,5 +1,5 @@ export default { - supportedChainIds: [80001], + supportedChainIds: [1, 3, 4, 5, 137, 80001], connectors: { injected: {}, }, From e83cdaf094305ef62aa249613b4f2652cc75cecc Mon Sep 17 00:00:00 2001 From: Anurag Date: Thu, 24 Mar 2022 14:15:08 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E2=9C=A8=20feat:=20use=20new=20thirdweb=20?= =?UTF-8?q?sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/package.json | 4 +- web/pages/_app.tsx | 12 +- web/pages/mint/index.tsx | 10 +- web/yarn.lock | 908 +++++++++++++++++++++++++++------------ 4 files changed, 646 insertions(+), 288 deletions(-) diff --git a/web/package.json b/web/package.json index ead52e5..e91623c 100644 --- a/web/package.json +++ b/web/package.json @@ -9,7 +9,6 @@ "lint": "next lint" }, "dependencies": { - "@3rdweb/hooks": "^1.9.2", "@chakra-ui/react": "^1.8.6", "@emotion/react": "^11", "@emotion/styled": "^11", @@ -17,6 +16,9 @@ "@fontsource/sen": "^4.5.3", "@fontsource/syncopate": "^4.5.3", "@supabase/supabase-js": "^1.31.1", + "@thirdweb-dev/react": "^2.0.1", + "@thirdweb-dev/sdk": "^2.0.14", + "ethers": "^5.6.1", "framer-motion": "^6", "next": "12.1.0", "next-seo": "^5.1.0", diff --git a/web/pages/_app.tsx b/web/pages/_app.tsx index 8307fd8..1b9f191 100644 --- a/web/pages/_app.tsx +++ b/web/pages/_app.tsx @@ -16,13 +16,17 @@ import "@fontsource/syncopate/700.css"; import "@fontsource/sen/400.css"; import "@fontsource/sen/700.css"; +import { ThirdwebProvider } from "@thirdweb-dev/react"; + import { NextSeo } from "next-seo"; function MyApp({ Component, pageProps }: AppProps) { + + const desiredChainId = 4; + return ( - - + ); } diff --git a/web/pages/mint/index.tsx b/web/pages/mint/index.tsx index 571a0a3..3aa0f21 100644 --- a/web/pages/mint/index.tsx +++ b/web/pages/mint/index.tsx @@ -5,12 +5,16 @@ import { Box, Text, Button, Badge } from "@chakra-ui/react"; import type { modes } from "../../@types/types"; import { Header } from "../../components"; -import { useWeb3 } from "@3rdweb/hooks"; import { supabase } from "../../utils/supabaseClient"; +import { useAddress, useMetamask, useNFTDrop } from "@thirdweb-dev/react"; + const MintPage: NextPage = () => { - const { address, connectWallet, error } = useWeb3(); const [env, setEnv] = useState(); + const connectWithMetamask = useMetamask() + const address = useAddress() + + const nftDrop = useNFTDrop("0x538e45B8149C697d2c3d65441e4f2a6691Be35fC"); useEffect(() => { process.env.NODE_ENV === "development" @@ -109,7 +113,7 @@ const MintPage: NextPage = () => { ) : ( + ) : ( + ) : ( )} - - {user ? ( - - hello, - {user.user_metadata.full_name} - - ) : ( - - )} diff --git a/web/utils/supabaseClient.ts b/web/utils/supabaseClient.ts deleted file mode 100644 index fd04da9..0000000 --- a/web/utils/supabaseClient.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { createClient } from "@supabase/supabase-js"; - -const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!; -const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!; - -export const supabase = createClient(supabaseUrl, supabaseAnonKey); From 51c0988ea267f3cdbf98c228daf07102fcbf22bc Mon Sep 17 00:00:00 2001 From: Anurag Date: Thu, 24 Mar 2022 17:09:59 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20chore:=20remove=20dead?= =?UTF-8?q?=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/@types/types.ts | 3 --- web/pages/mint/index.tsx | 11 ----------- 2 files changed, 14 deletions(-) delete mode 100644 web/@types/types.ts diff --git a/web/@types/types.ts b/web/@types/types.ts deleted file mode 100644 index 28840ce..0000000 --- a/web/@types/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -type modes = "development" | "production" | "test"; - -export type { modes } \ No newline at end of file diff --git a/web/pages/mint/index.tsx b/web/pages/mint/index.tsx index a5a6327..807673e 100644 --- a/web/pages/mint/index.tsx +++ b/web/pages/mint/index.tsx @@ -1,8 +1,6 @@ import type { NextPage } from "next"; -import { useEffect, useState } from "react"; import { Box, Text, Button, Badge } from "@chakra-ui/react"; -import type { modes } from "../../@types/types"; import { Header } from "../../components"; @@ -13,20 +11,11 @@ import { } from "@thirdweb-dev/react"; const MintPage: NextPage = () => { - const [env, setEnv] = useState(); const connectWithMetamask = useMetamask() const address = useAddress() const nftDrop = useNFTDrop("0x968fAE78A3FdF1C3DBfb86F00Ab9590b4B145b8e"); - useEffect(() => { - process.env.NODE_ENV === "development" - ? setEnv("development") - : process.env.NODE_ENV === "production" - ? setEnv("production") - : setEnv("test"); - }, [env, setEnv]); - return ( <>