-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TICKET 2] 🚀 update project to nextjs13 #5
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// / <reference types="next" /> | ||
// / <reference types="next/types/global" /> | ||
// / <reference types="next/image-types/global" /> | ||
// / <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,10 @@ | |
"postinstall": "husky install" | ||
}, | ||
"dependencies": { | ||
"@chakra-ui/icons": "^1.0.15", | ||
"@chakra-ui/react": "^1.6.7", | ||
"@chakra-ui/theme-tools": "^1.2.0", | ||
"@chakra-ui/icons": "^2.0.19", | ||
"@chakra-ui/next-js": "^2.1.3", | ||
"@chakra-ui/react": "^2.0.0", | ||
"@chakra-ui/theme-tools": "^2.0.16", | ||
"@emotion/react": "^11.4.1", | ||
"@emotion/styled": "^11.3.0", | ||
"@fontsource/inter": "^4.5.14", | ||
|
@@ -21,25 +22,26 @@ | |
"graphql-tag": "^2.12.5", | ||
"jsonwebtoken": "^8.5.1", | ||
"mongodb": "^4.1.2", | ||
"next": "latest", | ||
"next-auth": "^3.29.0", | ||
"next": "13.4.2", | ||
"next-auth": "^4.22.1", | ||
"react": "^18.1.0", | ||
"react-dom": "^17.0.2", | ||
"react-dom": "^18.1.0", | ||
"react-hook-form": "^7.15.3", | ||
"react-query": "^3.23.2", | ||
"react-query": "^3.39.3", | ||
"react-table": "^7.7.0" | ||
}, | ||
"devDependencies": { | ||
"@next/eslint-plugin-next": "^11.1.2", | ||
"@next/eslint-plugin-next": "^13.4.3", | ||
"@types/jsonwebtoken": "^8.5.5", | ||
"@types/node": "14.14.35", | ||
"@types/react": "^17.0.21", | ||
"@types/react-dom": "^17.0.9", | ||
"@types/react": "^18.1.0", | ||
"@types/react-dom": "^18.1.0", | ||
"@types/react-table": "^7.7.3", | ||
"@typescript-eslint/eslint-plugin": "^4.31.1", | ||
"@typescript-eslint/parser": "^4.31.1", | ||
"encoding": "^0.1.13", | ||
"eslint": "^7.32.0", | ||
"eslint-config-next": "^11.1.2", | ||
"eslint-config-next": "^13.4.2", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-config-rokket-labs": "^0.4.5", | ||
"eslint-plugin-import": "^2.24.2", | ||
|
@@ -48,7 +50,7 @@ | |
"husky": "^7.0.2", | ||
"lint-staged": "^11.1.2", | ||
"prettier": "^2.4.1", | ||
"typescript": "^4.4.3" | ||
"typescript": "^5.0.4" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔥 |
||
}, | ||
"lint-staged": { | ||
"*.{ts,tsx,js,jsx}": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use client' | ||
import { Flex } from '@chakra-ui/react' | ||
|
||
import RenderCards from 'screens/apiexample/RenderCards' | ||
|
||
const ApiExample = () => { | ||
return ( | ||
<Flex w="100%" flexDir="column"> | ||
<RenderCards /> | ||
</Flex> | ||
) | ||
} | ||
|
||
export default ApiExample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// import AuthContext from 'context/AuthContext' | ||
import { ChakraCustomContextProvider } from 'context/ChakraCustomContext' | ||
import { ReactQueryCustomContextProvider } from 'context/ReactQueryCustomContext' | ||
import { LayoutComponent } from 'layoutcomponent' | ||
|
||
// import { headers } from 'next/dist/client/components/headers' | ||
// import getSession from 'lib/getSessionAuth' | ||
import './global.css' | ||
|
||
const RootLayout = async ({ children }: { children: React.ReactNode }) => { | ||
// const session = await getSession(headers().get('cookie') ?? '') | ||
|
||
return ( | ||
<html lang="en"> | ||
<body> | ||
<ChakraCustomContextProvider> | ||
{/* <AuthContext session={session}> */} | ||
<ReactQueryCustomContextProvider> | ||
<LayoutComponent>{children}</LayoutComponent> | ||
</ReactQueryCustomContextProvider> | ||
{/* </AuthContext> */} | ||
</ChakraCustomContextProvider> | ||
</body> | ||
</html> | ||
) | ||
} | ||
|
||
export default RootLayout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use client' | ||
import { Flex } from '@chakra-ui/react' | ||
|
||
// import { useSession } from 'next-auth/client' | ||
import RenderCards from 'screens/home/RenderCards' | ||
// import RenderFooter from 'screens/home/RenderFooter' | ||
|
||
const Index = () => { | ||
// const [session] = useSession() | ||
|
||
return ( | ||
<Flex w="100%" flexDir="column"> | ||
<RenderCards /> | ||
<br /> | ||
{/* <RenderFooter session={session} /> */} | ||
</Flex> | ||
) | ||
} | ||
|
||
export default Index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use client' | ||
|
||
import { Session } from 'next-auth' | ||
import { SessionProvider } from 'next-auth/react' | ||
|
||
export interface AuthContextProps { | ||
children: React.ReactNode | ||
session: Session | ||
} | ||
|
||
export default function AuthContext({ children }: AuthContextProps) { | ||
return <SessionProvider>{children}</SessionProvider> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use client' | ||
|
||
import { CacheProvider } from '@chakra-ui/next-js' | ||
import { ChakraProvider } from '@chakra-ui/react' | ||
import theme from 'theme/theme' | ||
|
||
export const ChakraCustomContextProvider: React.FC<{ | ||
children: React.ReactNode | ||
}> = ({ children }) => { | ||
return ( | ||
<CacheProvider> | ||
<ChakraProvider resetCSS theme={theme}> | ||
{children} | ||
</ChakraProvider> | ||
</CacheProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
'use client' | ||
|
||
import { useState } from 'react' | ||
import { QueryCache, QueryClient, QueryClientProvider } from 'react-query' | ||
import { useToast } from '@chakra-ui/react' | ||
|
||
import { queryClient } from 'lib/queryClient' | ||
|
||
export const ReactQueryCustomContextProvider = ({ | ||
children, | ||
}: { | ||
children: any | ||
}) => { | ||
const toast = useToast() | ||
const [client] = useState( | ||
new QueryClient({ | ||
...queryClient, | ||
queryCache: new QueryCache({ | ||
onError: (error, query) => { | ||
if (query.state.data !== undefined) | ||
toast({ | ||
title: `${(error as any).message} toast`, | ||
status: 'error', | ||
}) | ||
}, | ||
}), | ||
}), | ||
) | ||
|
||
return <QueryClientProvider client={client}>{children}</QueryClientProvider> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/layout/NavigationLogo.tsx → src/layoutcomponent/NavigationLogo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const getSession = async (cookie: string) => { | ||
const response = await fetch( | ||
`${process.env.LOCAL_AUTH_URL ?? 'http://localhost:3000'}/api/auth/session`, | ||
{ | ||
headers: { | ||
cookie, | ||
}, | ||
}, | ||
) | ||
|
||
const session = await response.json() | ||
|
||
return Object.keys(session).length > 0 ? session : null | ||
} | ||
|
||
export default getSession |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GITHUB ISSUE