Skip to content

Commit 380f7b4

Browse files
committed
feat: fixed some ts erros and the getCsrfToken fetch issue
1 parent 62acb27 commit 380f7b4

File tree

10 files changed

+91
-82
lines changed

10 files changed

+91
-82
lines changed

src/components/ActionButton.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import { Button, useColorModeValue } from '@chakra-ui/react'
1+
import { Button, useColorModeValue } from "@chakra-ui/react";
22

33
export const ActionButton = ({
44
label,
55
href,
66
}: {
7-
label: string
8-
href: string
7+
label: string;
8+
href: string;
99
}) => {
1010
return (
1111
<Button
12-
bg={useColorModeValue('blackAlpha.100', 'whiteAlpha.100')}
12+
bg={useColorModeValue("blackAlpha.100", "whiteAlpha.100")}
1313
border="0.5px solid gray"
14-
cursor={'pointer'}
15-
as={'a'}
14+
cursor={"pointer"}
15+
as={"a"}
1616
p="2"
1717
href={href}
18-
display={'inline-flex'}
19-
transition={'background 0.3s ease'}
18+
display={"inline-flex"}
19+
transition={"background 0.3s ease"}
2020
_hover={{
21-
bg: useColorModeValue('blackAlpha.200', 'whiteAlpha.200'),
21+
bg: useColorModeValue("blackAlpha.200", "whiteAlpha.200"),
2222
}}
2323
>
2424
{label}
2525
</Button>
26-
)
27-
}
26+
);
27+
};

src/components/Topbar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export default function WithSubnavigation() {
6161
const { disconnect } = useDisconnect();
6262
const { chain } = useNetwork();
6363

64+
console.log({ address, isConnected });
65+
6466
// Functions
6567
/**
6668
* Attempts SIWE and establish session

src/components/footer/Footer.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ import {
55
Text,
66
Link,
77
useColorModeValue,
8-
} from '@chakra-ui/react'
9-
import NextLink from 'next/link'
10-
import { FaTwitter, FaGithub } from 'react-icons/fa'
11-
import { SocialButton } from '@components/footer/SocialButton'
8+
} from "@chakra-ui/react";
9+
import NextLink from "next/link";
10+
import { FaTwitter, FaGithub } from "react-icons/fa";
11+
import { SocialButton } from "@/components/footer/SocialButton";
1212

1313
export default function Footer() {
1414
return (
1515
<Box
1616
// bg={useColorModeValue('#00000f', '#1d1e20')}
17-
color={useColorModeValue('gray.700', 'gray.200')}
17+
color={useColorModeValue("gray.700", "gray.200")}
1818
>
1919
<Container
2020
as={Stack}
21-
maxW={'2xl'}
21+
maxW={"2xl"}
2222
py={4}
23-
direction={{ base: 'column', md: 'row' }}
23+
direction={{ base: "column", md: "row" }}
2424
spacing={4}
25-
justify={{ base: 'center', md: 'space-between' }}
26-
align={{ base: 'center', md: 'center' }}
25+
justify={{ base: "center", md: "space-between" }}
26+
align={{ base: "center", md: "center" }}
2727
>
28-
<Stack direction={'row'} spacing={3}>
28+
<Stack direction={"row"} spacing={3}>
2929
<Link
3030
as={NextLink}
3131
href={
32-
'https://github.com/Developer-DAO/academy/issues/new?assignees=&labels=needs+triage%2C+bug&template=bug_report.md&title='
32+
"https://github.com/Developer-DAO/academy/issues/new?assignees=&labels=needs+triage%2C+bug&template=bug_report.md&title="
3333
}
3434
passHref
3535
isExternal
@@ -38,37 +38,37 @@ export default function Footer() {
3838
Feedback
3939
</Link>
4040
<Link
41-
href={'/docs'}
41+
href={"/docs"}
4242
passHref
4343
as={NextLink}
4444
textDecoration="underline"
4545
>
4646
Contribute
4747
</Link>
4848
</Stack>
49-
<Stack direction={'row'} spacing={6}>
49+
<Stack direction={"row"} spacing={6}>
5050
<SocialButton
51-
label={'Twitter'}
52-
href={'https://twitter.com/devdao_academy'}
51+
label={"Twitter"}
52+
href={"https://twitter.com/devdao_academy"}
5353
>
5454
<FaTwitter />
5555
</SocialButton>
5656
<SocialButton
57-
label={'Github'}
58-
href={'https://github.com/developer-dao/academy'}
57+
label={"Github"}
58+
href={"https://github.com/developer-dao/academy"}
5959
>
6060
<FaGithub />
6161
</SocialButton>
6262
</Stack>
6363
</Container>
6464

65-
<Container maxW={'6xl'} py={4} centerContent>
65+
<Container maxW={"6xl"} py={4} centerContent>
6666
<Text>Developer DAO Foundation © {new Date().getFullYear()}</Text>
6767
<Text align="center">
68-
Website content licensed under{' '}
68+
Website content licensed under{" "}
6969
<Link
7070
as={NextLink}
71-
href={'http://creativecommons.org/licenses/by-nc/4.0/'}
71+
href={"http://creativecommons.org/licenses/by-nc/4.0/"}
7272
passHref
7373
isExternal
7474
textDecoration="underline"
@@ -78,10 +78,10 @@ export default function Footer() {
7878
.
7979
</Text>
8080
<Text>
81-
Website code is licensed under{' '}
81+
Website code is licensed under{" "}
8282
<Link
8383
as={NextLink}
84-
href={'https://github.com/Developer-DAO/academy/blob/main/LICENSE'}
84+
href={"https://github.com/Developer-DAO/academy/blob/main/LICENSE"}
8585
passHref
8686
isExternal
8787
textDecoration="underline"
@@ -93,7 +93,7 @@ export default function Footer() {
9393
<Text>
9494
<Link
9595
as={NextLink}
96-
href={'https://www.developerdao.com/privacy-policy'}
96+
href={"https://www.developerdao.com/privacy-policy"}
9797
passHref
9898
isExternal
9999
textDecoration="underline"
@@ -103,5 +103,5 @@ export default function Footer() {
103103
</Text>
104104
</Container>
105105
</Box>
106-
)
106+
);
107107
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import { ReactNode } from 'react'
2-
import { Button, VisuallyHidden, useColorModeValue } from '@chakra-ui/react'
1+
import { type ReactNode } from "react";
2+
import { Button, VisuallyHidden, useColorModeValue } from "@chakra-ui/react";
33

44
export const SocialButton = ({
55
children,
66
label,
77
href,
88
}: {
9-
children: ReactNode
10-
label: string
11-
href: string
9+
children: ReactNode;
10+
label: string;
11+
href: string;
1212
}) => {
1313
return (
1414
<Button
15-
bg={useColorModeValue('blackAlpha.100', 'whiteAlpha.100')}
16-
rounded={'full'}
15+
bg={useColorModeValue("blackAlpha.100", "whiteAlpha.100")}
16+
rounded={"full"}
1717
border="0.5px solid gray"
18-
cursor={'pointer'}
19-
as={'a'}
18+
cursor={"pointer"}
19+
as={"a"}
2020
p="2"
2121
href={href}
22-
display={'inline-flex'}
23-
transition={'background 0.3s ease'}
22+
display={"inline-flex"}
23+
transition={"background 0.3s ease"}
2424
target="_blank"
2525
_hover={{
26-
bg: useColorModeValue('blackAlpha.200', 'whiteAlpha.200'),
26+
bg: useColorModeValue("blackAlpha.200", "whiteAlpha.200"),
2727
}}
2828
>
2929
<VisuallyHidden>{label}</VisuallyHidden>
3030
{children}
3131
</Button>
32-
)
33-
}
32+
);
33+
};

src/components/mdx/Callout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Box, HStack, useStyleConfig } from "@chakra-ui/react";
2-
import React, { type FC } from "react";
2+
import React from "react";
33

44
interface CalloutProps {
55
size?: string;
Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Box, Text, VStack } from '@chakra-ui/react'
2-
import { Contributor } from '@/components/mdx/Contributor'
1+
import { Box, Text, VStack } from "@chakra-ui/react";
2+
import { Contributor } from "@/components/mdx/Contributor";
33

44
interface ContributorFooterProps {
5-
authors?: string[]
6-
reviewers?: string[]
7-
contributors?: string[]
5+
authors?: string[];
6+
reviewers?: string[];
7+
contributors?: string[];
88
}
99

1010
export function ContributorFooter({
@@ -23,11 +23,13 @@ export function ContributorFooter({
2323
{authors && Array.isArray(authors) && authors.length > 0 && (
2424
<Box>
2525
<Text fontSize={26} marginTop={8} marginBottom={4}>
26-
{authors.length > 1 ? 'Authors' : 'Author'}
26+
{authors.length > 1 ? "Authors" : "Author"}
2727
</Text>
2828
<VStack spacing={4} alignItems="left">
29-
{authors.map((contrib) => {
30-
return <Contributor handle={contrib} avatarSize="2xl" />
29+
{authors.map((contrib, idx) => {
30+
return (
31+
<Contributor key={idx} handle={contrib} avatarSize="2xl" />
32+
);
3133
})}
3234
</VStack>
3335
</Box>
@@ -36,11 +38,11 @@ export function ContributorFooter({
3638
{reviewers && Array.isArray(reviewers) && reviewers.length > 0 && (
3739
<Box>
3840
<Text fontSize={20} marginTop={8} marginBottom={4}>
39-
{reviewers.length > 1 ? 'Reviewers' : 'Reviewer'}
41+
{reviewers.length > 1 ? "Reviewers" : "Reviewer"}
4042
</Text>
4143
<VStack spacing={4} alignItems="left">
42-
{reviewers.map((contrib) => {
43-
return <Contributor handle={contrib} avatarSize="lg" />
44+
{reviewers.map((contrib, idx) => {
45+
return <Contributor key={idx} handle={contrib} avatarSize="lg" />;
4446
})}
4547
</VStack>
4648
</Box>
@@ -52,16 +54,18 @@ export function ContributorFooter({
5254
<Box>
5355
<Text fontSize={20} marginTop={8} marginBottom={4}>
5456
{contributors.length > 1
55-
? 'Additional Contributors'
56-
: 'Additional Contributor'}
57+
? "Additional Contributors"
58+
: "Additional Contributor"}
5759
</Text>
5860
<VStack spacing={4} alignItems="left">
59-
{contributors.map((contrib) => {
60-
return <Contributor handle={contrib} avatarSize="lg" />
61+
{contributors.map((contrib, idx) => {
62+
return (
63+
<Contributor key={idx} handle={contrib} avatarSize="lg" />
64+
);
6165
})}
6266
</VStack>
6367
</Box>
6468
)}
6569
</Box>
66-
)
70+
);
6771
}

src/components/mdx/LessonHeader.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { Box, Text, Link, HStack } from '@chakra-ui/react'
2-
import NextLink from 'next/link'
3-
import { QuestionIcon } from '@chakra-ui/icons'
1+
import { Box, Text, Link, HStack } from "@chakra-ui/react";
2+
import NextLink from "next/link";
3+
import { QuestionIcon } from "@chakra-ui/icons";
44

55
interface LessonHeaderProps {
6-
title: string
7-
discussionUrl?: string
6+
title: string;
7+
discussionUrl?: string;
88
}
99

10-
const DEFAULT_DISCUSSION_URL = 'https://developerdao.peeranha.io/'
10+
const DEFAULT_DISCUSSION_URL = "https://developerdao.peeranha.io/";
1111

1212
export function LessonHeader({ title, discussionUrl }: LessonHeaderProps) {
13-
let forumLink = discussionUrl || DEFAULT_DISCUSSION_URL
13+
const forumLink = discussionUrl || DEFAULT_DISCUSSION_URL;
1414

1515
return (
1616
<Box>
@@ -31,7 +31,7 @@ export function LessonHeader({ title, discussionUrl }: LessonHeaderProps) {
3131
<QuestionIcon w={8} h={8} />
3232
</Box>
3333
<Box>
34-
If you get stuck or have questions please visit our{' '}
34+
If you get stuck or have questions please visit our{" "}
3535
<Link
3636
as={NextLink}
3737
href={forumLink}
@@ -46,5 +46,5 @@ export function LessonHeader({ title, discussionUrl }: LessonHeaderProps) {
4646
</HStack>
4747
)}
4848
</Box>
49-
)
49+
);
5050
}

src/pages/_app.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ const MyApp: AppType<{ session: Session | null }> = ({
6565
}) => {
6666
return (
6767
<ChakraProvider theme={theme}>
68-
<WagmiConfig config={config}>
69-
<SessionProvider session={session} refetchInterval={0}>
68+
<SessionProvider session={session} refetchInterval={0}>
69+
<WagmiConfig config={config}>
7070
<RainbowKitSiweNextAuthProvider
7171
getSiweMessageOptions={getSiweMessageOptions}
7272
>
@@ -83,8 +83,8 @@ const MyApp: AppType<{ session: Session | null }> = ({
8383
</Box>
8484
</RainbowKitProvider>
8585
</RainbowKitSiweNextAuthProvider>
86-
</SessionProvider>
87-
</WagmiConfig>
86+
</WagmiConfig>
87+
</SessionProvider>
8888
</ChakraProvider>
8989
);
9090
};

src/pages/lessons/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ const Lessons: React.FC<LessonProps> = ({ lessons }: { lessons: Lesson[] }) => {
2525
// initial an array of lessons for a given track
2626
acc[curr.path] = [];
2727
}
28-
acc[curr.path].push(curr);
28+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
29+
acc[curr.path]!.push(curr);
2930
return acc;
3031
}, {});
3132

@@ -61,7 +62,7 @@ const Lessons: React.FC<LessonProps> = ({ lessons }: { lessons: Lesson[] }) => {
6162

6263
export default Lessons;
6364

64-
export const getStaticProps = async () => {
65+
export const getStaticProps = () => {
6566
const contentDir = path.join(CONTENT_PATH);
6667
const directories = fs.readdirSync(path.join(contentDir));
6768
const lessons: Lesson[] = [];

src/server/auth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ export const authOptions: (ctxReq: CtxOrReq) => NextAuthOptions = ({
160160
(credentials?.message as string) ?? "{}"
161161
) as Partial<SiweMessage>
162162
);
163-
const nonce = await getCsrfToken({ req });
163+
164+
const nonce = await getCsrfToken({ req: { headers: req?.headers } });
165+
// const nonce = await getCsrfToken({ req });
164166

165167
const verified = await siwe.verify({
166168
signature: credentials?.signature || "",

0 commit comments

Comments
 (0)