Skip to content

Commit

Permalink
Changed buttons color to match marketplace style
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Sep 18, 2024
1 parent 5de18cb commit 0005bb3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
38 changes: 28 additions & 10 deletions packages/nextjs/app/simpleMint/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,20 @@ const SimpleMint: NextPage = () => {

const handleMPaidMint = async () => {
const notificationId = notification.loading("Uploading to IPFS");

try {
const uploadedItem = await addToIPFS(yourJSON);

notification.remove(notificationId);
notification.success("Metadata uploaded to IPFS");

// Log IPFS path before sending to contract
console.log("IPFS Path:", uploadedItem.path);

// Mint the NFT
await writeContractAsync({
if (!connectedAddress) {
throw new Error("No connected address found.");
}

const contractResponse = await writeContractAsync({
functionName: "startCollection",
args: [
collectionName,
Expand All @@ -100,13 +103,28 @@ const SimpleMint: NextPage = () => {
],
});

if (!contractResponse) {
throw new Error("Contract response is null or undefined.");
}

console.log("Contract Response:", contractResponse);
notification.success("Collection started successfully!");
} catch (error) {
notification.remove(notificationId);
console.error("Error during minting:", error);

// Log the error and notify the user
notification.error("Minting failed, please try again.");
// Type guard to narrow the type of 'error'
if (error instanceof Error) {
console.error("Error during minting:", error);

if (error.message.includes("gasLimit")) {
notification.error("Minting failed due to gas limit issue, please check your network and wallet setup.");
} else {
notification.error("Minting failed, please try again.");
}
} else {
console.error("An unknown error occurred:", error);
notification.error("An unknown error occurred.");
}
}
};

Expand Down Expand Up @@ -398,15 +416,15 @@ const SimpleMint: NextPage = () => {
<div className="flex justify-center items-center mt-6 gap-3">
{isGaslessMinting ? (
<button
className={`btn btn-primary hover:bg-green-500 py-3 px-6 bg-green-600 ${loading ? "loading" : ""}`}
className={`btn btn-primary hover:bg-yellow-500 py-3 px-6 bg-yellow-600 ${loading ? "loading" : ""}`}
disabled={loading}
onClick={handleSimpleMint}
>
Propose NFT collection
</button>
) : (
<button
className={`btn btn-primary hover:bg-yellow-500 py-3 px-6 bg-yellow-600 ${loading ? "loading" : ""}`}
className={`btn btn-primary hover:bg-green-500 py-3 px-6 bg-green-600 ${loading ? "loading" : ""}`}
disabled={loading}
onClick={handleMPaidMint}
>
Expand All @@ -419,13 +437,13 @@ const SimpleMint: NextPage = () => {
<input
type="checkbox"
className={`toggle toggle-primary ${
isGaslessMinting ? "checked:bg-green-600 hover:bg-yellow-600" : "bg-yellow-600 hover:bg-green-600"
isGaslessMinting ? "checked:bg-yellow-600 hover:bg-green-600" : "bg-green-600 hover:bg-yellow-600"
}`}
// className="toggle toggle-primary bg-red-500"
checked={isGaslessMinting}
onChange={handleToggle}
/>
<span className={`ml-2 ${isGaslessMinting ? "text-green-600" : "text-yellow-600"}`}>
<span className={`ml-2 ${isGaslessMinting ? "text-yellow-600" : "text-green-600"}`}>
{isGaslessMinting ? "Gasless Minting" : "Paid Minting"}
</span>
</label>
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
ArrowUpTrayIcon,
Bars3Icon,
BugAntIcon,
PhotoIcon,
StarIcon,
PhotoIcon, // StarIcon,
} from "@heroicons/react/24/outline";
import { FaucetButton, RainbowKitCustomConnectButton } from "~~/components/scaffold-eth";
import { useOutsideClick } from "~~/hooks/scaffold-eth";
Expand All @@ -24,7 +23,7 @@ type HeaderMenuLink = {

export const menuLinks: HeaderMenuLink[] = [
{
label: "See collection",
label: "My NFTs",
href: "/",
icon: <PhotoIcon className="h-4 w-4" />,
},
Expand Down
8 changes: 4 additions & 4 deletions packages/nextjs/contracts/deployedContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract";
const deployedContracts = {
31337: {
SimpleMint: {
address: "0x68b1d87f95878fe05b998f19b66f4baba5de1aed",
address: "0x5fbdb2315678afecb367f032d93f642f64180aa3",
abi: [
{
type: "constructor",
Expand Down Expand Up @@ -320,7 +320,7 @@ const deployedContracts = {
},
},
MockNFT: {
address: "0x3aa5ebb10dc797cac828524e59a333d0a371443c",
address: "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512",
abi: [
{
type: "constructor",
Expand Down Expand Up @@ -940,7 +940,7 @@ const deployedContracts = {
},
},
MockUSDC: {
address: "0xc6e7df5e7b4f2a278906862b61205850344d4e7d",
address: "0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0",
abi: [
{
type: "constructor",
Expand Down Expand Up @@ -1397,7 +1397,7 @@ const deployedContracts = {
},
},
Marketplace: {
address: "0x59b670e9fa9d0a427751af201d676719a970857b",
address: "0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9",
abi: [
{
type: "constructor",
Expand Down

0 comments on commit 0005bb3

Please sign in to comment.