From 9b619ced2af16d0a5678a2ab920c832bb48d0e09 Mon Sep 17 00:00:00 2001 From: Lulox Date: Thu, 26 Sep 2024 10:37:34 -0300 Subject: [PATCH] Changes to header and readme --- README.md | 6 +- .../_components/ProfilePictureUpload.tsx | 2 +- packages/nextjs/components/Header.tsx | 87 +------------------ .../AddressInfoDropdown.tsx | 5 +- .../nextjs/contracts/deployedContracts.ts | 12 +-- packages/nextjs/scaffold.config.ts | 3 +- 6 files changed, 19 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index 8382652..f42a500 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -🫂 SocialBunny is an social dapp that empowers users to monetize their posts. +🐰 SocialBunny is an social dapp 🫂 that empowers users to monetize 💰 their posts. - Posts tokenization on mainnet is optional. - Creators get royalties for sales of their tokenized posts @@ -94,7 +94,9 @@ yarn deploy This command deploys a test smart contract to the local network. The contract is located in `packages/foundry/contracts` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/foundry/script/Deploy.s.sol` to deploy the contract to the network. You can also customize the deploy script. -5. Open a third terminal, navigate to `SocialBunny` and run this command to start your NextJS app: +5. Go to `packages/nextjs/scaffold.config.ts` and comment out `targetNetworks: [chains.sepolia]` and uncomment `targetNetworks: [chains.foundry]` + +6. Open a third terminal, navigate to `SocialBunny` and run this command to start your NextJS app: ``` yarn start diff --git a/packages/nextjs/app/myProfile/_components/ProfilePictureUpload.tsx b/packages/nextjs/app/myProfile/_components/ProfilePictureUpload.tsx index 051cccd..88215f0 100644 --- a/packages/nextjs/app/myProfile/_components/ProfilePictureUpload.tsx +++ b/packages/nextjs/app/myProfile/_components/ProfilePictureUpload.tsx @@ -22,7 +22,7 @@ export const ProfilePictureUpload: React.FC = ({ // File size validation (5MB) const MAX_FILE_SIZE_MB = 5 * 1024 * 1024; // 5 MB in bytes - const defaultProfilePicture = "https://ipfs.io/ipfs/QmVCvzEQHFKzAYSsou8jEJtWdFj31n2XgPpbLjbZqui4YY"; + const defaultProfilePicture = "/guest-profile.png"; // Handle file drop or selection const handleFileUpload = async (file: File) => { diff --git a/packages/nextjs/components/Header.tsx b/packages/nextjs/components/Header.tsx index 5f3d29e..584d9d9 100644 --- a/packages/nextjs/components/Header.tsx +++ b/packages/nextjs/components/Header.tsx @@ -1,76 +1,23 @@ "use client"; import React, { useRef, useState } from "react"; -// import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { SwitchTheme } from "./SwitchTheme"; import { faHome, faPlus } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { hardhat } from "viem/chains"; -// import Image from "next/image"; import { useAccount } from "wagmi"; -// import { PlusIcon } from "@heroicons/react/24/solid"; -// import { Bars3Icon } from "@heroicons/react/24/outline"; import { FaucetButton, RainbowKitCustomConnectButton } from "~~/components/scaffold-eth"; import { useOutsideClick, useScaffoldReadContract, useTargetNetwork } from "~~/hooks/scaffold-eth"; -// import { notification } from "~~/utils/scaffold-eth"; - -type HeaderMenuLink = { - label: string; - href: string; - icon?: React.ReactNode; -}; - -export const menuLinks: HeaderMenuLink[] = [ - { - label: "Explore", - href: "/", - }, - { - label: "Create", - href: "/create", - }, -]; - -export const HeaderMenuLinks = () => { - const pathname = usePathname(); - - return ( - <> - {menuLinks.map(({ label, href, icon }) => { - const isActive = pathname === href; - return ( -
  • - - {icon} - {label} - -
  • - ); - })} - - ); -}; - /** * Site header */ export const Header = () => { - // const [isDrawerOpen, setIsDrawerOpen] = useState(false); const [isMenuOpen, setIsMenuOpen] = useState(false); - // const pathname = usePathname(); // Add this line to track the active route - const { address: connectedAddress, isConnected } = useAccount(); - // const { writeContractAsync: usdcWriteAsync } = useScaffoldWriteContract("MockUSDC"); const { data: profileInfo } = useScaffoldReadContract({ contractName: "ProfileInfo", @@ -79,39 +26,10 @@ export const Header = () => { watch: true, }); - // const { data: usdcBalance } = useScaffoldReadContract({ - // contractName: "MockUSDC", - // functionName: "balanceOf", - // args: [connectedAddress], - // watch: true, - // }); - - // const handleMintUSDC = async () => { - // try { - // await usdcWriteAsync({ - // functionName: "mint", - // args: [connectedAddress, BigInt(100e6)], // Mint 1 USDC - // }); - - // notification.success("USDC Minted Successfully"); - // } catch (error) { - // console.error("Error during minting:", error); - - // // Log the error and notify the user - // notification.error("Minting failed, please try again."); - // } - // }; - const defaultProfilePicture = "/guest-profile.png"; const profilePicture = profileInfo && profileInfo[2] ? profileInfo[2] : defaultProfilePicture; - // const burgerMenuRef = useRef(null); - // useOutsideClick( - // burgerMenuRef, - // useCallback(() => setIsDrawerOpen(false), []), - // ); - const menuRef = useRef(null); const pathname = usePathname(); @@ -177,7 +95,7 @@ export const Header = () => { {isConnected ? ( <>
    { ) : ( <> - {/* */} )} @@ -200,7 +117,7 @@ export const Header = () => {
    - + My Profile diff --git a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx index a9e3125..b9095b2 100644 --- a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx +++ b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx @@ -48,7 +48,10 @@ export const AddressInfoDropdown = ({ return ( <>
    - + {isENS(displayName) ? displayName : checkSumAddress?.slice(0, 6) + "..." + checkSumAddress?.slice(-4)} diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index d026a32..a6145d6 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -7,7 +7,7 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; const deployedContracts = { 31337: { SimpleMintNFT: { - address: "0x5fbdb2315678afecb367f032d93f642f64180aa3", + address: "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", abi: [ { type: "constructor", @@ -685,7 +685,7 @@ const deployedContracts = { }, }, ProfileInfo: { - address: "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + address: "0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0", abi: [ { type: "function", @@ -753,7 +753,7 @@ const deployedContracts = { inheritedFunctions: {}, }, SimpleMint: { - address: "0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0", + address: "0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9", abi: [ { type: "constructor", @@ -1066,7 +1066,7 @@ const deployedContracts = { }, }, MockNFT: { - address: "0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9", + address: "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9", abi: [ { type: "constructor", @@ -1686,7 +1686,7 @@ const deployedContracts = { }, }, MockUSDC: { - address: "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9", + address: "0x5fc8d32690cc91d4c39d9d3abcbd16989f875707", abi: [ { type: "constructor", @@ -2143,7 +2143,7 @@ const deployedContracts = { }, }, Marketplace: { - address: "0x5fc8d32690cc91d4c39d9d3abcbd16989f875707", + address: "0x0165878a594ca255338adfa4d48449f69242eb8f", abi: [ { type: "constructor", diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index c5c5798..38b74bd 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -10,7 +10,8 @@ export type ScaffoldConfig = { const scaffoldConfig = { // The networks on which your DApp is live - targetNetworks: [chains.sepolia, chains.foundry], + // For working locally, comment out chains.sepolia and uncomment chains.foundry + targetNetworks: [chains.sepolia], // targetNetworks: [chains.foundry], // The interval at which your front-end polls the RPC servers for new data