Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielaDelPilarR committed Apr 19, 2024
1 parent 071259d commit 0fff75d
Show file tree
Hide file tree
Showing 14 changed files with 2,597 additions and 2,584 deletions.
48 changes: 25 additions & 23 deletions packages/nextjs/app/ipfsDownload/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,44 @@ const IpfsDownload: NextPage = () => {
setMounted(true);
}, []);

// const handleIpfsDownload = async () => {
// setLoading(true);
// const notificationId = notification.loading("Getting data from IPFS");
// try {
// const metaData = await getMetadataFromIPFS(ipfsPath);
// notification.remove(notificationId);
// notification.success("Downloaded from IPFS");
// const handleIpfsDownload = async () => {
// setLoading(true);
// const notificationId = notification.loading("Getting data from IPFS");
// try {
// const metaData = await getMetadataFromIPFS(ipfsPath);
// notification.remove(notificationId);
// notification.success("Downloaded from IPFS");

// setYourJSON(metaData);
// } catch (error) {
// notification.remove(notificationId);
// notification.error("Error downloading from IPFS");
// console.log(error);
// } finally {
// setLoading(false);
// }
// };
// setYourJSON(metaData);
// } catch (error) {
// notification.remove(notificationId);
// notification.error("Error downloading from IPFS");
// console.log(error);
// } finally {
// setLoading(false);
// }
// };

return (
<>
<div className="flex items-center flex-col flex-grow pt-10">
<h1 className="text-center mb-4">
<span className="block text-4xl font-bold">Download from IPFS</span>
</h1>
<div className={`flex border-2 border-accent/95 bg-base-200 rounded-full text-accent w-96`}>
<div
className={`flex border-2 border-accent/95 bg-base-200 rounded-full text-accent w-96`}
>
<input
className="input input-ghost focus:outline-none focus:bg-transparent focus:text-secondary-content h-[2.2rem] min-h-[2.2rem] px-4 border w-full font-medium placeholder:text-accent/50 text-secondary-content/75"
placeholder="IPFS CID"
value={ipfsPath}
onChange={e => setIpfsPath(e.target.value)}
onChange={(e) => setIpfsPath(e.target.value)}
autoComplete="off"
/>
</div>
<ButtonStyle
// className={`btn btn-secondary my-6 ${loading ? "loading" : ""}`}
// disabled={loading}
// className={`btn btn-secondary my-6 ${loading ? "loading" : ""}`}
// disabled={loading}
// onClick={handleIpfsDownload}
>
Download from IPFS
Expand All @@ -64,13 +66,13 @@ const IpfsDownload: NextPage = () => {
src={yourJSON}
theme="solarized"
enableClipboard={false}
onEdit={edit => {
onEdit={(edit) => {
setYourJSON(edit.updated_src);
}}
onAdd={add => {
onAdd={(add) => {
setYourJSON(add.updated_src);
}}
onDelete={del => {
onDelete={(del) => {
setYourJSON(del.updated_src);
}}
/>
Expand Down
38 changes: 19 additions & 19 deletions packages/nextjs/app/ipfsUpload/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ const IpfsUpload: NextPage = () => {
setMounted(true);
}, []);

// const handleIpfsUpload = async () => {
// setLoading(true);
// const notificationId = notification.loading("Uploading to IPFS...");
// try {
// const uploadedItem = await addToIPFS(yourJSON);
// notification.remove(notificationId);
// notification.success("Uploaded to IPFS");
// const handleIpfsUpload = async () => {
// setLoading(true);
// const notificationId = notification.loading("Uploading to IPFS...");
// try {
// const uploadedItem = await addToIPFS(yourJSON);
// notification.remove(notificationId);
// notification.success("Uploaded to IPFS");

// setUploadedIpfsPath(uploadedItem.path);
// } catch (error) {
// notification.remove(notificationId);
// notification.error("Error uploading to IPFS");
// console.log(error);
// } finally {
// setLoading(false);
// }
// };
// setUploadedIpfsPath(uploadedItem.path);
// } catch (error) {
// notification.remove(notificationId);
// notification.error("Error uploading to IPFS");
// console.log(error);
// } finally {
// setLoading(false);
// }
// };

return (
<>
Expand All @@ -49,13 +49,13 @@ const IpfsUpload: NextPage = () => {
src={yourJSON}
theme="solarized"
enableClipboard={false}
onEdit={edit => {
onEdit={(edit) => {
setYourJSON(edit.updated_src);
}}
onAdd={add => {
onAdd={(add) => {
setYourJSON(add.updated_src);
}}
onDelete={del => {
onDelete={(del) => {
setYourJSON(del.updated_src);
}}
/>
Expand Down
24 changes: 12 additions & 12 deletions packages/nextjs/app/myNFTs/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import ButtonStyle from "~~/components/ButtonStyle/ButtonStyle"
import { MyHoldings } from "~~/components/SimpleNFT/MyHoldings"
import ButtonStyle from "~~/components/ButtonStyle/ButtonStyle";
import { MyHoldings } from "~~/components/SimpleNFT/MyHoldings";

function Page() {
return (
<main className="flex flex-col flex-1">
<div className="flex flex-col items-center p-10">
<h1 className="text-4xl font-bold text-center mb-4">My NFTs</h1>
<ButtonStyle>Mint NFT</ButtonStyle>
<MyHoldings></MyHoldings>
</div>
</main>
)
return (
<main className="flex flex-col flex-1">
<div className="flex flex-col items-center p-10">
<h1 className="text-4xl font-bold text-center mb-4">My NFTs</h1>
<ButtonStyle>Mint NFT</ButtonStyle>
<MyHoldings></MyHoldings>
</div>
</main>
);
}

export default Page
export default Page;
79 changes: 47 additions & 32 deletions packages/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,56 @@ const Home: NextPage = () => {
return (
<>
<div className="flex items-center flex-col flex-grow pt-10">
<div className="px-5 w-[90%] md:w-[75%]">
<h1 className="text-center mb-6">
<span className="block text-2xl mb-2">SpeedRunEthereum</span>
<span className="block text-4xl font-bold">Challenge #0: Simple NFT</span>
</h1>
<div className="flex flex-col items-center justify-center">
<Image
src="/hero.png"
width="727"
height="231"
alt="challenge banner"
className="rounded-xl border-4 border-primary"
/>
<div className="max-w-3xl">
<p className="text-center text-lg mt-8">
🎫 Create a simple NFT to learn basics of 🏗️ Scaffold-ETH 2. You&apos;ll use 👷‍♀️
<a href="https://hardhat.org/getting-started/" target="_blank" rel="noreferrer" className="underline">
HardHat
</a>{" "}
to compile and deploy smart contracts. Then, you&apos;ll use a template React app full of important
Ethereum components and hooks. Finally, you&apos;ll deploy an NFT to a public network to share with
friends! 🚀
</p>
<p className="text-center text-lg">
🌟 The final deliverable is an app that lets users purchase and transfer NFTs. Deploy your contracts to a
testnet then build and upload your app to a public web server. Submit the url on{" "}
<a href="https://speedrunethereum.com/" target="_blank" rel="noreferrer" className="underline">
SpeedRunEthereum.com
</a>{" "}
!
</p>
<div className="px-5 w-[90%] md:w-[75%]">
<h1 className="text-center mb-6">
<span className="block text-2xl mb-2">SpeedRunEthereum</span>
<span className="block text-4xl font-bold">
Challenge #0: Simple NFT
</span>
</h1>
<div className="flex flex-col items-center justify-center">
<Image
src="/hero.png"
width="727"
height="231"
alt="challenge banner"
className="rounded-xl border-4 border-primary"
/>
<div className="max-w-3xl">
<p className="text-center text-lg mt-8">
🎫 Create a simple NFT to learn basics of 🏗️ Scaffold-ETH 2.
You&apos;ll use 👷‍♀️
<a
href="https://hardhat.org/getting-started/"
target="_blank"
rel="noreferrer"
className="underline"
>
HardHat
</a>{" "}
to compile and deploy smart contracts. Then, you&apos;ll use a
template React app full of important Ethereum components and
hooks. Finally, you&apos;ll deploy an NFT to a public network to
share with friends! 🚀
</p>
<p className="text-center text-lg">
🌟 The final deliverable is an app that lets users purchase and
transfer NFTs. Deploy your contracts to a testnet then build and
upload your app to a public web server. Submit the url on{" "}
<a
href="https://speedrunethereum.com/"
target="_blank"
rel="noreferrer"
className="underline"
>
SpeedRunEthereum.com
</a>{" "}
!
</p>
</div>
</div>
</div>
</div>
</div>
</>
);
};
Expand Down
44 changes: 21 additions & 23 deletions packages/nextjs/app/transfers/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,34 @@ import { Address } from "~~/components/scaffold-stark";
// import { useScaffoldEventHistory } from "~~/hooks/scaffold-stark";

const Transfers: NextPage = () => {
// const { data: transferEvents, isLoading } = useScaffoldEventHistory({
// contractName: "YourCollectible",
// eventName: "Transfer",
// // Specify the starting block number from which to read events, this is a bigint.
// fromBlock: 0n,
// });
// const { data: transferEvents, isLoading } = useScaffoldEventHistory({
// contractName: "YourCollectible",
// eventName: "Transfer",
// // Specify the starting block number from which to read events, this is a bigint.
// fromBlock: 0n,
// });

// if (isLoading)
// return (
// <div className="flex justify-center items-center mt-10">
// <span className="loading loading-spinner loading-xl"></span>
// </div>
// );
// if (isLoading)
// return (
// <div className="flex justify-center items-center mt-10">
// <span className="loading loading-spinner loading-xl"></span>
// </div>
// );

const transferEvents=[
const transferEvents = [
{
address:"0x7f982E4f614167DfC7950fdA06e920b9E2514748",
}
]
address: "0x7f982E4f614167DfC7950fdA06e920b9E2514748",
},
];

return (
<>
<div className="flex items-center flex-col flex-grow pt-10">
<div className="px-5">
<h1 className="text-center mb-8">
<span className="block text-4xl font-bold">All Transfers Events</span>
<span className="block text-4xl font-bold">
All Transfers Events
</span>
</h1>
</div>
<div className="overflow-x-auto shadow-lg">
Expand All @@ -54,12 +56,8 @@ const transferEvents=[
return (
<tr key={index}>
{/* <th className="text-center">{event.args.tokenId?.toString()}</th> */}
<td>
{/* <Address address={event.args.from} /> */}
</td>
<td>
{/* <Address address={event.args.to} /> */}
</td>
<td>{/* <Address address={event.args.from} /> */}</td>
<td>{/* <Address address={event.args.to} /> */}</td>
</tr>
);
})
Expand Down
16 changes: 8 additions & 8 deletions packages/nextjs/components/ButtonStyle/ButtonStyle.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.base_button__small {
padding-block: 14px;
padding-inline: 24px;
border-radius: 7px;
padding-block: 14px;
padding-inline: 24px;
border-radius: 7px;
}

.base_button__large {
width: 490px;
padding: 16px 33px;
border: none;
border-radius: 8px;
}
width: 490px;
padding: 16px 33px;
border: none;
border-radius: 8px;
}
35 changes: 17 additions & 18 deletions packages/nextjs/components/ButtonStyle/ButtonStyle.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@

interface ButtonProps {
children: string;
size?: "small" | "large";
onClick?: () => void;
}
const ButtonStyle = ({ children, size = "small", onClick }: ButtonProps) => {
const isSmall = size === "small";
return (
<button
onClick={onClick}
className={`btn btn-secondary base_button__${isSmall ? "small" : "large"}`}
>
{children}
</button>
);
};
children: string;
size?: "small" | "large";
onClick?: () => void;
}

const ButtonStyle = ({ children, size = "small", onClick }: ButtonProps) => {
const isSmall = size === "small";
return (
<button
onClick={onClick}
className={`btn btn-secondary base_button__${isSmall ? "small" : "large"}`}
>
{children}
</button>
);
};

export default ButtonStyle
export default ButtonStyle;
Loading

0 comments on commit 0fff75d

Please sign in to comment.