Skip to content

Commit 12365f4

Browse files
authored
Merge pull request #152 from ropats16/content/lesson-5
Lesson 5 content fixes and minor UI fixes
2 parents ae84562 + 0ae4ca9 commit 12365f4

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

components/ContentCallout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ const ComponentCallout: FC = (props: any) => {
88
return (
99
<Box __css={styles} {...rest}>
1010
<HStack spacing={4}>
11-
<Box fontSize={26}>{emoji}</Box>
11+
<Box fontSize={26} mt="0.75em">
12+
{emoji}
13+
</Box>
1214
<Box maxWidth="90%">{children}</Box>
1315
</HStack>
1416
</Box>

lessons/projects/5.mdx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ airtight using tests in lesson 4. Now we're going use all of this knowledge and
4242
connect it to a frontend for users to see and interact with.
4343

4444
We're going to start where we left off in lesson 4. Open your code editor and
45-
`cd` into the `**TierNFT**` project directory.
45+
`cd` into the **`TierNFT`** project directory.
4646

4747
For all things related to our frontend we are going to create a new sub-directory
4848
within our project's root directory to maintain good practice, keep our code clean,
@@ -151,7 +151,8 @@ of our choice along with some other customisations.
151151
- `import { alchemyProvider } from 'wagmi/providers/alchemy';` and
152152
`import { publicProvider } from 'wagmi/providers/public';` give us the provider configs
153153
for the providers we will be using. In our app we are using an `alchemyProvider` along
154-
with a fall back `publicProvider`.
154+
with a fall back `publicProvider`. A provider allows our application to communicate with
155+
a blockchain.
155156
- `useEffect` and `useState` are react hooks that help us perform side effects and
156157
capture the state, respectively. More on [state](https://www.freecodecamp.org/news/what-is-state-in-react-explained-with-examples/)
157158
and the [useEffect](https://www.freecodecamp.org/news/react-useeffect-absolute-beginners/) hook.
@@ -169,7 +170,7 @@ After importing, we create the configurations we need, and create a new instance
169170
const { chains, provider } = configureChains(
170171
[chain.polygonMumbai],
171172
[
172-
alchemyProvider({ apiKey: process.env.ALCHEMY_ID }),
173+
alchemyProvider({ apiKey: process.env.API_KEY }),
173174
publicProvider()
174175
]
175176
);
@@ -191,7 +192,14 @@ const wagmiClient = createClient({
191192
For this application we will continue using the `mumbai` testnet. Other chains can
192193
be added simply using the following syntax: `chain.chain_name`.
193194
For custom providers, like the `alchemyProvider` we can pass in our private
194-
`apiKey` as well.
195+
`apiKey` as well.
196+
197+
Set your API Key in a new file named `.env` inside our `frontend` directory
198+
as follows:
199+
200+
```dotenv
201+
API_KEY='YOUR-API-KEY-FROM-PROVIDER'
202+
```
195203

196204
Now we can wrap our application in the `RainbowKitProvider` and `WagmiConfig`
197205
so that have access to their features throughout our application. Our code should
@@ -360,7 +368,7 @@ import { useEffect, useState } from 'react';
360368
```
361369

362370
- RainbowKit provides us a ready-made `ConnectButton`.
363-
- We need to the `useAccount` hook from WAGMI to check account connection
371+
- We need to use the `useAccount` hook from WAGMI to check account connection
364372
and `useContractRead` and `useContractWrite` to interact with our smart
365373
contract. We will look into WAGMI and these hooks a little down the line.
366374
- `TierABI` is our contract's Application Binary Interface (ABI). The ABI
@@ -513,11 +521,11 @@ const mintToken = async (e) => {
513521
```
514522

515523
- We pass in `e` as an argument so that we can pick the amount of ETH
516-
associated with a particular Tier. This is
517-
- We want to wait for our minting transaction to complete before moving
518-
on to other pieces of code.This is passed to the mint function using the
524+
associated with a particular Tier. This is passed to the mint function using the
519525
`recklesslySetUnpreparedOverrides` override config. Read more about it
520-
[here](https://wagmi.sh/docs/hooks/useContractWrite#override-config).
526+
[here](https://wagmi.sh/docs/hooks/useContractWrite#override-config).
527+
- We want to wait for our minting transaction to complete before moving
528+
on to other pieces of code so we use `wait()`.
521529
- After minting is processed we log the returned data to ensure the
522530
success of our transaction.
523531
- Using `try...catch` statements makes our error handling more robust. The

pages/lessons/[lesson]/[slug].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const components = {
5656
<Heading as="h4" apply="mdx.h4" fontSize="xl" {...props} />
5757
),
5858
p: (props: any) => <Text as="p" apply="mdx.p" fontSize="xl" {...props} />,
59-
a: (props: any) => <Text as="a" apply="mdx.a" {...props} />,
59+
a: (props: any) => <Text as="a" apply="mdx.a" {...props} target="_blank" />,
6060
ul: (props: any) => <Text as="ul" apply="mdx.ul" fontSize="xl" {...props} />,
6161
img: (props: any) => (
6262
<Image as="img" apply="mdx.image" m="0 auto" alt="" {...props} />

theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const components = {
5454
bg: colors.soc.eerieBlack,
5555
borderRadius: '1em',
5656
px: '1em',
57-
pb: '1em',
57+
pb: '0.75em',
5858
m: '1em',
5959
},
6060
variants: {

0 commit comments

Comments
 (0)