From 0fd635d7b299b4417c4b70b94caebe2e4a5c1fbe Mon Sep 17 00:00:00 2001 From: root Date: Sun, 27 Aug 2023 09:03:44 +0000 Subject: [PATCH] Second[Agent] upgrade next.js --- .eslintrc.js | 20 +-- {pages => app}/_error.js | 0 pages/error.js => app/error/page.js | 0 pages/genre/index.js => app/genre/page.js | 10 +- app/layout.jsx | 16 ++ .../index.js => app/list/add-or-edit/page.js | 9 +- .../list/add-or-remove-items/page.js | 9 +- .../index.js => app/list/choose-image/page.js | 11 +- pages/list/index.js => app/list/page.js | 8 +- .../index.js => app/list/remove/page.js | 9 +- pages/movie/index.js => app/movie/page.js | 9 +- .../my-lists/index.js => app/my-lists/page.js | 8 +- pages/404.js => app/not-found.js | 0 app/not-found.jsx | 11 ++ pages/index.js => app/page.js | 15 +- pages/person/index.js => app/person/page.js | 9 +- pages/search/index.js => app/search/page.js | 10 +- components/AnchorButton/index.js | 2 + components/LinkButton/index.js | 11 +- components/Logo/index.js | 3 +- components/Menu/MenuItemLink/index.js | 6 +- .../TheCastSection/Cast/PersonLink/index.js | 3 +- .../TheGenresSection/GenreLink/index.js | 3 +- components/MyHead/index.js | 43 +++-- components/PosterLink/index.js | 6 +- components/UI/TheSelectSearch/index.js | 2 + containers/DarkModeToggle/index.js | 94 ++--------- containers/ListActions/index.js | 84 +++++----- containers/ListNavigation/index.js | 2 +- containers/SearchBar/Form/index.js | 2 + containers/SearchBar/Input/index.js | 1 + containers/TheUser/index.js | 94 ++++++----- jsconfig.json | 19 +-- package.json | 40 ++--- pages/_app.js | 32 ---- pages/_document.js | 151 ------------------ parts/ErrorBox/index.js | 9 +- public/analytics/base.min.js | 2 +- store.js | 4 +- utils/hocs/withAuth/index.js | 2 + utils/hocs/withTheme/index.js | 3 +- utils/hooks/useClickAway.js | 66 ++++---- utils/hooks/useMedia.js | 64 ++++---- 43 files changed, 332 insertions(+), 570 deletions(-) rename {pages => app}/_error.js (100%) rename pages/error.js => app/error/page.js (100%) rename pages/genre/index.js => app/genre/page.js (93%) create mode 100644 app/layout.jsx rename pages/list/add-or-edit/index.js => app/list/add-or-edit/page.js (98%) rename pages/list/add-or-remove-items/index.js => app/list/add-or-remove-items/page.js (98%) rename pages/list/choose-image/index.js => app/list/choose-image/page.js (97%) rename pages/list/index.js => app/list/page.js (95%) rename pages/list/remove/index.js => app/list/remove/page.js (97%) rename pages/movie/index.js => app/movie/page.js (96%) rename pages/my-lists/index.js => app/my-lists/page.js (95%) rename pages/404.js => app/not-found.js (100%) create mode 100644 app/not-found.jsx rename pages/index.js => app/page.js (89%) rename pages/person/index.js => app/person/page.js (96%) rename pages/search/index.js => app/search/page.js (92%) delete mode 100644 pages/_app.js delete mode 100644 pages/_document.js diff --git a/.eslintrc.js b/.eslintrc.js index e37cfd6..3e135b5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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, + }, +}; diff --git a/pages/_error.js b/app/_error.js similarity index 100% rename from pages/_error.js rename to app/_error.js diff --git a/pages/error.js b/app/error/page.js similarity index 100% rename from pages/error.js rename to app/error/page.js diff --git a/pages/genre/index.js b/app/genre/page.js similarity index 93% rename from pages/genre/index.js rename to app/genre/page.js index a57201f..1239dee 100644 --- a/pages/genre/index.js +++ b/app/genre/page.js @@ -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'; @@ -84,9 +84,7 @@ const Genre = () => { return ( - - {`${general.selectedMenuItemName} Movies`} - +
@@ -101,4 +99,4 @@ const Genre = () => { ); }; -export default Genre; +export default Genre; \ No newline at end of file diff --git a/app/layout.jsx b/app/layout.jsx new file mode 100644 index 0000000..eaee83a --- /dev/null +++ b/app/layout.jsx @@ -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 ( + + {children} + + ); +} diff --git a/pages/list/add-or-edit/index.js b/app/list/add-or-edit/page.js similarity index 98% rename from pages/list/add-or-edit/index.js rename to app/list/add-or-edit/page.js index f0db959..ee6b37d 100644 --- a/pages/list/add-or-edit/index.js +++ b/app/list/add-or-edit/page.js @@ -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'; @@ -171,9 +172,9 @@ const AddOrEdit = ({ if (editStatus === STATUSES.RESOLVED) { return ( <> - + {listId ? listName : 'Create New List: Step1'} - +
- + {movies.name} - +
- + {movies.name} - +
{ if (status === STATUSES.RESOLVED) { return ( <> - - {movies.name ?? 'List'} - +
{ } }; -export default List; +export default List; \ No newline at end of file diff --git a/pages/list/remove/index.js b/app/list/remove/page.js similarity index 97% rename from pages/list/remove/index.js rename to app/list/remove/page.js index 048d604..2d5e0d1 100644 --- a/pages/list/remove/index.js +++ b/app/list/remove/page.js @@ -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'; @@ -114,9 +115,9 @@ const Remove = ({ if (status === STATUSES.RESOLVED) { return ( <> - + Delete List - +
{ return ( - + {`${movie.title} - Movie Library`} - + @@ -89,4 +90,4 @@ const Movie = () => { ); }; -export default Movie; +export default Movie; \ No newline at end of file diff --git a/pages/my-lists/index.js b/app/my-lists/page.js similarity index 95% rename from pages/my-lists/index.js rename to app/my-lists/page.js index 02c9cb8..65a1205 100644 --- a/pages/my-lists/index.js +++ b/app/my-lists/page.js @@ -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'; @@ -81,9 +81,7 @@ const MyLists = ({ if (status === STATUSES.RESOLVED) { return ( <> - - My Lists - +
+

Not Found

+

Could not find requested resource

+ Return Home + + ); +} diff --git a/pages/index.js b/app/page.js similarity index 89% rename from pages/index.js rename to app/page.js index c5af8c1..0f4f771 100644 --- a/pages/index.js +++ b/app/page.js @@ -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 @@ -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'; @@ -99,16 +99,7 @@ const Home = () => { return ( <> - - {/* MEMO: inspired by https://addyosmani.com/blog/preload-hero-images/ */} - - {`${general.selectedMenuItemName} Movies`} - + {movies.loading ? ( ) : ( diff --git a/pages/person/index.js b/app/person/page.js similarity index 96% rename from pages/person/index.js rename to app/person/page.js index 38c8bc2..47f3cc2 100644 --- a/pages/person/index.js +++ b/app/person/page.js @@ -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'; @@ -85,9 +86,9 @@ const Person = () => { return ( - + {`${person.name} - Person Library`} - + @@ -100,4 +101,4 @@ const Person = () => { ); }; -export default Person; +export default Person; \ No newline at end of file diff --git a/pages/search/index.js b/app/search/page.js similarity index 92% rename from pages/search/index.js rename to app/search/page.js index 0a3e598..12e7006 100644 --- a/pages/search/index.js +++ b/app/search/page.js @@ -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'; @@ -79,9 +79,7 @@ const Search = () => { return ( - - {`${searchTerm} - Search Results`} - +
@@ -94,4 +92,4 @@ const Search = () => { } }; -export default Search; +export default Search; \ No newline at end of file diff --git a/components/AnchorButton/index.js b/components/AnchorButton/index.js index 39cb57d..0b9cf7c 100644 --- a/components/AnchorButton/index.js +++ b/components/AnchorButton/index.js @@ -1,5 +1,7 @@ +import React from "react"; + import Button from 'components/UI/Button'; const AnchorButton = React.forwardRef(({ diff --git a/components/LinkButton/index.js b/components/LinkButton/index.js index a6aa5db..d068855 100644 --- a/components/LinkButton/index.js +++ b/components/LinkButton/index.js @@ -11,13 +11,10 @@ const LinkButton = ({ buttonProps = {} }) => ( <> - - -