Skip to content
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

Upgrade next.js #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
extends: ["next", "next/core-web-vitals"],
rules: {
"@next/next/no-img-element": 0, // TODO: Remove when Image component is updated
"react/display-name": 0,
"no-unused-vars": 1,
"react/no-unknown-property": 0,
},
};

module.exports = {
extends: ["next", "next/core-web-vitals"],
rules: {
"@next/next/no-img-element": 0, // TODO: Remove when Image component is updated
"react/display-name": 0,
"no-unused-vars": 1,
"react/no-unknown-property": 0,
},
};
File renamed without changes.
File renamed without changes.
10 changes: 4 additions & 6 deletions pages/genre/index.js → app/genre/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { useEffect, useState } from 'react';
import Head from 'next/head';
import Router, { useRouter } from 'next/router';
import { useRouter } from 'next/router';
import { useDispatch, useSelector } from 'react-redux';
import { animateScroll as scroll } from 'react-scroll';

Expand Down Expand Up @@ -84,9 +84,7 @@ const Genre = () => {
return (
<PageWrapper>
<PaddingWrapper>
<Head>
<title>{`${general.selectedMenuItemName} Movies`}</title>
</Head>
<Metadata title={`${general.selectedMenuItemName} Movies`} />
<Header
title={general.selectedMenuItemName}
subtitle='movies' />
Expand All @@ -101,4 +99,4 @@ const Genre = () => {
);
};

export default Genre;
export default Genre;
16 changes: 16 additions & 0 deletions app/layout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Inter } from "next/font/google";

const inter = Inter({ subsets: ["latin"] });

export const metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use client'


import { useState, useEffect } from 'react';
import Router, { useRouter } from 'next/router';
import Head from 'next/head';
import { Metadata } from 'next/head';

import Header from 'parts/Header';
import NotFound from 'parts/NotFound';
Expand Down Expand Up @@ -171,9 +172,9 @@ const AddOrEdit = ({
if (editStatus === STATUSES.RESOLVED) {
return (
<>
<Head>
<Metadata>
<title>{listId ? listName : 'Create New List: Step1'}</title>
</Head>
</Metadata>
<PageWrapper>
<PaddingWrapper>
<Header
Expand Down Expand Up @@ -218,4 +219,4 @@ const AddOrEdit = ({
}
};

export default withAuth(AddOrEdit);
export default withAuth(AddOrEdit);
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use client'


import { useState, useEffect } from 'react';
import Router, { useRouter } from 'next/router';
import Head from 'next/head';
import { Metadata } from 'next/head';

import Header from 'parts/Header';
import NotFound from 'parts/NotFound';
Expand Down Expand Up @@ -204,9 +205,9 @@ const AddOrRemoveItems = ({
if (status === STATUSES.RESOLVED) {
return (
<>
<Head>
<Metadata>
<title>{movies.name}</title>
</Head>
</Metadata>
<PageWrapper>
<PaddingWrapper>
<Header
Expand Down Expand Up @@ -256,4 +257,4 @@ const AddOrRemoveItems = ({
}
};

export default withAuth(AddOrRemoveItems);
export default withAuth(AddOrRemoveItems);
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client'


import {
Expand All @@ -6,7 +7,7 @@ import {
useCallback
} from 'react';
import { useRouter } from 'next/router';
import Head from 'next/head';
import { Metadata } from 'next/head';
import { animateScroll as scroll } from 'react-scroll';

import Header from 'parts/Header';
Expand All @@ -23,7 +24,7 @@ import withAuth from 'utils/hocs/withAuth';
import QUERY_PARAMS from 'utils/constants/query-params';
import STATUSES from 'utils/constants/statuses';
import { TMDB_API_NEW_VERSION, TMDB_IMAGE_BASE_URL } from 'config/tmdb';
import tmdbAPI from 'services/tmdbAPI';
import tmdbAPI from 'services/tmdb';

const BACKDROP_STATUSES = {
SELECTED: 'SELECTED',
Expand Down Expand Up @@ -135,9 +136,9 @@ const ChooseImage = ({
if (status === STATUSES.RESOLVED) {
return (
<>
<Head>
<Metadata>
<title>{movies.name}</title>
</Head>
</Metadata>
<PageWrapper>
<PaddingWrapper>
<Header
Expand Down Expand Up @@ -190,4 +191,4 @@ const ChooseImage = ({
}
};

export default withAuth(withTheme(ChooseImage));
export default withAuth(withTheme(ChooseImage));
8 changes: 3 additions & 5 deletions pages/list/index.js → app/list/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { useEffect, useState } from 'react';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { animateScroll as scroll } from 'react-scroll';

Expand Down Expand Up @@ -82,9 +82,7 @@ const List = () => {
if (status === STATUSES.RESOLVED) {
return (
<>
<Head>
<title>{movies.name ?? 'List'}</title>
</Head>
<Metadata title={movies.name ?? 'List'} />
<PageWrapper>
<PaddingWrapper>
<Header
Expand All @@ -111,4 +109,4 @@ const List = () => {
}
};

export default List;
export default List;
9 changes: 5 additions & 4 deletions pages/list/remove/index.js → app/list/remove/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use client'

import { useState, useEffect } from 'react';
import Router, { useRouter } from 'next/router';
import Head from 'next/head';
import { Metadata } from 'next/head';

import Header from 'parts/Header';
import NotFound from 'parts/NotFound';
Expand Down Expand Up @@ -114,9 +115,9 @@ const Remove = ({
if (status === STATUSES.RESOLVED) {
return (
<>
<Head>
<Metadata>
<title>Delete List</title>
</Head>
</Metadata>
<PageWrapper>
<PaddingWrapper>
<Header
Expand Down Expand Up @@ -156,4 +157,4 @@ const Remove = ({
}
};

export default withAuth(Remove);
export default withAuth(Remove);
9 changes: 5 additions & 4 deletions pages/movie/index.js → app/movie/page.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use client'


import { useEffect } from 'react';
import Router, { useRouter } from 'next/router';
import Head from 'next/head';
import { Metadata } from 'next/head';
import { useDispatch, useSelector } from 'react-redux';
import { animateScroll as scroll } from 'react-scroll';

Expand Down Expand Up @@ -76,9 +77,9 @@ const Movie = () => {

return (
<PageWrapper>
<Head>
<Metadata>
<title>{`${movie.title} - Movie Library`}</title>
</Head>
</Metadata>
<MovieSummary
baseUrl={baseUrl}
movie={movie} />
Expand All @@ -89,4 +90,4 @@ const Movie = () => {
);
};

export default Movie;
export default Movie;
8 changes: 3 additions & 5 deletions pages/my-lists/index.js → app/my-lists/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'


import { useEffect, useState } from 'react';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { animateScroll as scroll } from 'react-scroll';

Expand Down Expand Up @@ -81,9 +81,7 @@ const MyLists = ({
if (status === STATUSES.RESOLVED) {
return (
<>
<Head>
<title>My Lists</title>
</Head>
<Metadata title="My Lists" />
<PageWrapper>
<PaddingWrapper>
<Header
Expand All @@ -99,4 +97,4 @@ const MyLists = ({
}
};

export default withAuth(MyLists);
export default withAuth(MyLists);
File renamed without changes.
11 changes: 11 additions & 0 deletions app/not-found.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Link from 'next/link';

export default function NotFound() {
return (
<div>
<h2>Not Found</h2>
<p>Could not find requested resource</p>
<Link href="/">Return Home</Link>
</div>
);
}
15 changes: 3 additions & 12 deletions pages/index.js → app/page.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client'
/**
* TODO:
* https://nextjs.org/blog/next-9#automatic-partial-static-export RE: https://github.com/vercel/next.js/discussions/10874
Expand All @@ -7,8 +8,7 @@
*/

import { useEffect } from 'react';
import Head from 'next/head';
import Router, { useRouter } from 'next/router';
import { useRouter } from 'next/router';
import { useDispatch, useSelector } from 'react-redux';
import { animateScroll as scroll } from 'react-scroll';

Expand Down Expand Up @@ -99,16 +99,7 @@ const Home = () => {

return (
<>
<Head>
{/* MEMO: inspired by https://addyosmani.com/blog/preload-hero-images/ */}
<link
rel='preload'
as='fetch'
// TODO: page is hardcoded
href={`${TMDB_API_BASE_URL}/${TMDB_API_VERSION}/movie/popular?api_key=${TMDB_API_KEY}&page=1`}
crossOrigin='true' />
<title>{`${general.selectedMenuItemName} Movies`}</title>
</Head>
<Metadata title={`${general.selectedMenuItemName} Movies`} />
{movies.loading ? (
<Loader />
) : (
Expand Down
9 changes: 5 additions & 4 deletions pages/person/index.js → app/person/page.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use client'


import { useState, useEffect } from 'react';
import Router, { useRouter } from 'next/router';
import Head from 'next/head';
import { Metadata } from 'next/head';
import { useDispatch, useSelector } from 'react-redux';
import { animateScroll as scroll } from 'react-scroll';

Expand Down Expand Up @@ -85,9 +86,9 @@ const Person = () => {

return (
<PageWrapper>
<Head>
<Metadata>
<title>{`${person.name} - Person Library`}</title>
</Head>
</Metadata>
<PersonSummary
baseUrl={baseUrl}
person={person} />
Expand All @@ -100,4 +101,4 @@ const Person = () => {
);
};

export default Person;
export default Person;
10 changes: 4 additions & 6 deletions pages/search/index.js → app/search/page.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client'


import { useEffect } from 'react';
import Head from 'next/head';
import Router, { useRouter } from 'next/router';
import { useRouter } from 'next/router';
import { useDispatch, useSelector } from 'react-redux';
import { animateScroll as scroll } from 'react-scroll';

Expand Down Expand Up @@ -79,9 +79,7 @@ const Search = () => {
return (
<PageWrapper>
<PaddingWrapper>
<Head>
<title>{`${searchTerm} - Search Results`}</title>
</Head>
<Metadata title={`${searchTerm} - Search Results`} />
<Header
title={searchTerm}
subtitle='search results' />
Expand All @@ -94,4 +92,4 @@ const Search = () => {
}
};

export default Search;
export default Search;
2 changes: 2 additions & 0 deletions components/AnchorButton/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@


import React from "react";

import Button from 'components/UI/Button';

const AnchorButton = React.forwardRef(({
Expand Down
Loading