From 3433eafc68931aedcde734f79e83342561d16d75 Mon Sep 17 00:00:00 2001 From: Matthew Pereira Date: Wed, 17 Jan 2024 20:19:40 -0800 Subject: [PATCH] convert fetch to SWR and use axios instead of fetch on server side route handler --- packages/nextjs/components/Header.tsx | 4 - .../components/only-buildors/Button.tsx | 6 +- .../AddressInfoDropdown.tsx | 4 +- .../pages/api/get-nfts-for-contract.tsx | 31 ++-- packages/nextjs/pages/collection.tsx | 53 +++--- packages/nextjs/pages/index.tsx | 155 +++++++++--------- 6 files changed, 124 insertions(+), 129 deletions(-) diff --git a/packages/nextjs/components/Header.tsx b/packages/nextjs/components/Header.tsx index c6162ed..fe64b0c 100644 --- a/packages/nextjs/components/Header.tsx +++ b/packages/nextjs/components/Header.tsx @@ -1,7 +1,6 @@ import React, { useCallback, useRef, useState } from "react"; // import Image from "next/image"; import Link from "next/link"; -import { useDarkMode } from "usehooks-ts"; // import { useRouter } from "next/router"; import { Bars3Icon, BugAntIcon, BuildingLibraryIcon, PhotoIcon } from "@heroicons/react/24/outline"; import { SwitchTheme } from "~~/components/SwitchTheme"; @@ -62,15 +61,12 @@ export const HeaderMenuLinks = () => { * Site header */ export const Header = () => { - const { isDarkMode } = useDarkMode(); - const [isDrawerOpen, setIsDrawerOpen] = useState(false); const burgerMenuRef = useRef(null); useOutsideClick( burgerMenuRef, useCallback(() => setIsDrawerOpen(false), []), ); - console.log("isDarkMode", isDarkMode); return (
void; // Make onClick optional children: React.ReactNode; // children can be any JSX element @@ -8,6 +10,8 @@ type ButtonProps = { * https://devdojo.com/tailwindcss/buttons */ export const Button = ({ onClick, children, disabled }: ButtonProps) => { + const { isDarkMode } = useDarkMode(); + return ( - - ) : buidlCount && buidlCount > 0n ? ( - - ) : ( - - )} -
+
{step.text}
+ + ))} - ) : ( -
-
- Please connect the wallet associated with your{" "} - - BuidlGuidl profile - {" "} - in order to mint an NFT -
-
- If you are not a member yet, join us by the completing challenges at{" "} - - Speedrun Ethereum - -
+ +
+ {hasMinted ? ( + + + + ) : buidlCount && buidlCount > 0n ? ( + + ) : ( + + )}
- )} -
+ + ) : ( +
+
+ Connect the wallet associated with your{" "} + + BuidlGuidl profile + {" "} + to mint an NFT +
+
+ If you are not a member yet, join us by the completing challenges at{" "} + + Speedrun Ethereum + +
+
+ )}