-
Notifications
You must be signed in to change notification settings - Fork 3
Next.js Initial Migration #1505
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
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
cd5b970
Next.js scaffold
jonkafton 061c6e2
Supply env vars on process.env.NEXT_PUBLIC_
jonkafton 7d52948
Replace react-router hook with next/navigation
jonkafton cce398f
MUI theme provider for Next.js
jonkafton 9d0b321
Styled elements
jonkafton 2aeb458
Restructuring to bring pages and components into ssr project
jonkafton 0f4e311
Images and link fixes
jonkafton e55fd33
Set up prerendering with React Query and fetch Featured Courses carou…
jonkafton b607247
Head meta tags
jonkafton 73d87fa
Main entrypoint. Include in yarn workspaces. API URL for local
jonkafton c35ec3e
Add remaining homepage sections
jonkafton 1c5d744
Move into frontends
jonkafton 0959297
Lint fixes
jonkafton 27b5e57
Routed drawer and updates for homepage resource drawer search triggers
jonkafton a5457da
Move pages (conflict with Next.js Pages Router)
jonkafton ce8a5b1
Webpack configs for babel loader (import type) and ignore test files …
jonkafton 9a09083
Typescript config, move common/urls
jonkafton ce8afec
Updates towards successful build
jonkafton 043537b
Suspense boudary for header useSearchParam
jonkafton 5cd5c35
Provide origin on environment (cannot reference window)
jonkafton 33f5621
Update drawer hooks for next/navigation
jonkafton fc31579
Unit listing page and dependencies
jonkafton 3bfb641
Image fixes. ol-component compatibility updates
jonkafton f59fd7d
Logo image fixes and footer image
jonkafton f7dec20
Search page
jonkafton 7dab50a
Remove temp course-serach-utils
jonkafton 98d5e74
Remove temp course-serach-utils
jonkafton d9e8023
Channel Page. Rewrite for image paths
jonkafton 33e2772
Merge branch 'jk/evaluate-nextjs' of https://github.com/mitodl/mit-op…
jonkafton edadc7c
Move @mui/material-nextjs into ol-components
jonkafton a99bf81
Department listing page
jonkafton 3067ac2
Topic listing page
jonkafton e0b314d
Terms page
jonkafton 8b5e8c2
Privacy page
jonkafton 9922294
Image paths
jonkafton 97c82db
Lockfile
jonkafton dcd7237
Merge branch 'main' into jk/evaluate-nextjs
jonkafton 3bef5c7
Migrates the dashboard pages
jonkafton 369b119
Migrate learning path listing page
jonkafton 45726ab
Migrate learning path details page
jonkafton 471f800
Prettier fixes
jonkafton 31bffb3
Migrate test utils. Fixes for passing typechecks on test files (exclu…
jonkafton b11d0ab
Migrate the onboarding page
jonkafton c0e13c1
Migrate program letter page
jonkafton a5612fd
Migrate error page
jonkafton ea20ce5
Resolves issue with Server Components treated as Client Components (t…
jonkafton 76b6478
Metadata utility
jonkafton 52a6dc9
Fetch learning resource for metadata when drawer is open
jonkafton ecae36f
Async and sync metadata utilities
jonkafton 2b5d3b7
Merge branch 'main' into jk/evaluate-nextjs
jonkafton 7c02133
.env example file
jonkafton d386300
Merge branch 'main' into nextjs
jonkafton fcd31b0
Merge branch 'main' into nextjs
jonkafton 1d683df
Merge branch 'main' into nextjs
jonkafton 7f4d689
Preserve hero image aspect
jonkafton 03e8cc9
Put back SliderInput
jonkafton 6b70bde
Merge branch 'main' into jk/5244-nextjs-initial-migration
jonkafton 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 hidden or 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 hidden or 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,2 +1,3 @@ | ||
| openapi/specs/* | ||
| .yarn/ | ||
| .next/ |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
| export { | ||
| isServer, | ||
| Hydrate, | ||
| QueryClient, | ||
| QueryClientProvider, | ||
| dehydrate, | ||
| useQueries, | ||
| } from "@tanstack/react-query" | ||
|
|
||
| export type { UseQueryResult, UseQueryOptions } from "@tanstack/react-query" |
This file contains hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
| NEXT_PUBLIC_ORIGIN=http://open.odl.local:8062 | ||
| NEXT_PUBLIC_MITOL_API_BASE_URL=http://open.odl.local:8063 | ||
| MITOL_API_BASE_URL=http://open.odl.local:8063 | ||
|
|
||
| NEXT_PUBLIC_PUBLIC_URL=/ | ||
| NEXT_PUBLIC_SITE_NAME=MIT Learn | ||
| NEXT_PUBLIC_MITOL_SUPPORT_EMAIL=mitlearn-support@mit.edu | ||
| NEXT_PUBLIC_EMBEDLY_KEY= | ||
| NEXT_PUBLIC_MITOL_AXIOS_WITH_CREDENTIALS=true | ||
| NEXT_PUBLIC_CSRF_COOKIE_NAME=csrftoken-local # Must match CSRF_COOKIE_NAME on the backend's environment |
This file contains hidden or 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,36 @@ | ||
| # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
|
||
| # dependencies | ||
| /node_modules | ||
| /.pnp | ||
| .pnp.js | ||
| .yarn/install-state.gz | ||
|
|
||
| # testing | ||
| /coverage | ||
|
|
||
| # next.js | ||
| /.next/ | ||
| /out/ | ||
|
|
||
| # production | ||
| /build | ||
|
|
||
| # misc | ||
| .DS_Store | ||
| *.pem | ||
|
|
||
| # debug | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # local env files | ||
| .env*.local | ||
|
|
||
| # vercel | ||
| .vercel | ||
|
|
||
| # typescript | ||
| *.tsbuildinfo | ||
| next-env.d.ts |
This file contains hidden or 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,36 @@ | ||
| This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). | ||
|
|
||
| ## Getting Started | ||
|
|
||
| First, run the development server: | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| # or | ||
| yarn dev | ||
| # or | ||
| pnpm dev | ||
| # or | ||
| bun dev | ||
| ``` | ||
|
|
||
| Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
|
||
| You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
|
|
||
| This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. | ||
|
|
||
| ## Learn More | ||
|
|
||
| To learn more about Next.js, take a look at the following resources: | ||
|
|
||
| - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
| - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
|
||
| You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
|
|
||
| ## Deploy on Vercel | ||
|
|
||
| The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
|
|
||
| Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
This file contains hidden or 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,27 @@ | ||
| import path, { resolve } from "path" | ||
| import type { Config } from "@jest/types" | ||
| import baseConfig from "../jest.jsdom.config" | ||
|
|
||
| const config: Config.InitialOptions = { | ||
| ...baseConfig, | ||
| setupFilesAfterEnv: [ | ||
| ...baseConfig.setupFilesAfterEnv, | ||
| resolve(__dirname, "./test-utils/setupJest.ts"), | ||
| ], | ||
| moduleNameMapper: { | ||
| "^@/(.*)$": resolve(__dirname, "src/$1"), | ||
| "^@/test-utils$": resolve(__dirname, "test-utils"), | ||
| ...baseConfig.moduleNameMapper, | ||
| }, | ||
| transformIgnorePatterns: ["/node_modules/(?!(" + "yaml", ")/)"], | ||
| globals: { | ||
| APP_SETTINGS: { | ||
| EMBEDLY_KEY: "embedly_key", | ||
| MITOL_API_BASE_URL: "https://api.test.learn.mit.edu", | ||
| PUBLIC_URL: "", | ||
| SITE_NAME: "MIT Learn", | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| export default config |
This file contains hidden or 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,116 @@ | ||
| // @ts-check | ||
|
|
||
| /** @type {import('next').NextConfig} */ | ||
| const nextConfig = { | ||
| webpack: ( | ||
| config, | ||
| { buildId, dev, isServer, defaultLoaders, nextRuntime, webpack }, | ||
| ) => { | ||
| config.plugins.push( | ||
| new webpack.IgnorePlugin({ | ||
| resourceRegExp: /\.test\.tsx$/, | ||
| }), | ||
| new webpack.IgnorePlugin({ | ||
| resourceRegExp: /mockAxios\.ts/, | ||
| }), | ||
| ) | ||
|
|
||
| // Do not do this. Added to fix "import type", but causes a strage issue where | ||
| // the root page and layout think they're Client Components and "use client" | ||
| // directives not properly respected. | ||
| // https://nextjs.org/docs/app/api-reference/next-config-js/webpack | ||
| // | ||
| // config.module.rules.push({ | ||
| // test: /\.tsx?$/, | ||
| // use: [defaultLoaders.babel], | ||
| // }) | ||
|
|
||
| return config | ||
| }, | ||
|
|
||
| async rewrites() { | ||
| return [ | ||
| /* Images moved from /static, though image paths are sometimes | ||
| * returned on the API, e.g. /api/v0/channels/type/unit/ocw/ | ||
| * TODO update API paths and remove the rewrite. | ||
| */ | ||
| { | ||
| source: "/static/images/:path*", | ||
| destination: "/images/:path*", | ||
| }, | ||
| ] | ||
| }, | ||
|
|
||
| images: { | ||
| remotePatterns: [ | ||
| { | ||
| protocol: "https", | ||
| hostname: "*.mit.edu", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "i.embed.ly", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "ol-xpro-app-production.s3.amazonaws.com", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "*.cloudfront.net", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "*.edx-cdn.org", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "i.ytimg.com", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "i1.sndcdn.com", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "*.medium.com", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "image.simplecastcdn.com", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "megaphone.imgix.net", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| { | ||
| protocol: "https", | ||
| hostname: "artwork.captivate.fm", | ||
| port: "", | ||
| pathname: "**", | ||
| }, | ||
| ], | ||
| }, | ||
| } | ||
|
|
||
| module.exports = nextConfig |
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.
I believe this can just be
const MITOL_API_BASE_URL = NEXT_PUBLIC_MITOL_API_BASE_URL.