From 864994459724bc6cb3ec39adc60c22f5f7d46e04 Mon Sep 17 00:00:00 2001 From: Erick Lima Date: Sat, 23 Mar 2024 21:27:57 -0300 Subject: [PATCH 1/9] feat: User Settings Shows Up after SignUp Instead of default values, user can now make changes just after signing up. --- .../UserLoginModal/component.module.css | 1 + app/components/UserLoginModal/index.tsx | 41 +++++++---- .../UserSettingsModal/component.module.css | 17 ++++- .../components/UserSettingsModal/index.tsx | 70 +++++++++++-------- .../UserSideMenu/component.module.css | 6 ++ .../header/components/UserSideMenu/index.tsx | 45 ++++++------ 6 files changed, 112 insertions(+), 68 deletions(-) diff --git a/app/components/UserLoginModal/component.module.css b/app/components/UserLoginModal/component.module.css index 45fa17cf..2ba53ac0 100644 --- a/app/components/UserLoginModal/component.module.css +++ b/app/components/UserLoginModal/component.module.css @@ -109,6 +109,7 @@ flex-direction: column; align-items: center; justify-content: center; + gap: 8px 0; } diff --git a/app/components/UserLoginModal/index.tsx b/app/components/UserLoginModal/index.tsx index 9dc14327..8499c7ae 100644 --- a/app/components/UserLoginModal/index.tsx +++ b/app/components/UserLoginModal/index.tsx @@ -17,15 +17,25 @@ import { import { collection, doc, getDoc, getFirestore, setDoc } from 'firebase/firestore' import { initFirebase } from '@/firebase/firebaseApp' import ProfileFallbackImg from "@/public/profile_fallback.jpg" +import { useAuthState } from 'react-firebase-hooks/auth' +import UserSettingsModal from '@/app/layout/header/components/UserSettingsModal' -function UserModal({ onClick, auth, }: { onClick?: MouseEventHandler, auth: Auth }) { +type ModalTypes = { + onClick?: MouseEventHandler, + auth: Auth +} + +function UserModal({ onClick, auth, }: ModalTypes) { const googleProvider = new GoogleAuthProvider() const githubProvider = new GithubAuthProvider() - const db = getFirestore(initFirebase()); + const db = getFirestore(initFirebase()) + + const [user] = useAuthState(auth) const [isLoading, setIsLoading] = useState(false) + const [showSettingsMenu, setShowSettingsMenu] = useState(false) const [alternativeForm, setAlternativeForm] = useState(false) const [loginError, setLoginError] = useState<{ code: string, message: string } | null>(null) @@ -55,10 +65,13 @@ function UserModal({ onClick, auth, }: { onClick?: MouseEventHandler res.data()) + if (userHasDoc) return + // shows settings to new user + setShowSettingsMenu(true) + await setDoc(doc(collection(db, "users"), user.uid), { bookmarks: [], keepWatching: [], @@ -85,7 +98,6 @@ function UserModal({ onClick, auth, }: { onClick?: MouseEventHandler { @@ -133,15 +145,15 @@ function UserModal({ onClick, auth, }: { onClick?: MouseEventHandler + } + + return !user && ( - e.stopPropagation()} id={styles.modal} variants={dropIn} @@ -354,9 +371,9 @@ function UserModal({ onClick, auth, }: { onClick?: MouseEventHandler - - ) + + ) } export default UserModal \ No newline at end of file diff --git a/app/layout/header/components/UserSettingsModal/component.module.css b/app/layout/header/components/UserSettingsModal/component.module.css index a90f3c5b..8805c9ef 100644 --- a/app/layout/header/components/UserSettingsModal/component.module.css +++ b/app/layout/header/components/UserSettingsModal/component.module.css @@ -63,10 +63,25 @@ border-radius: 6px; } +#modal .settings_heading { + + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + +} + +#modal .settings_heading h2 { + + font-size: var(--font-size--p); + font-weight: 600; + +} + #modal #close_menu_btn { display: flex; - margin-left: auto; padding: 16px; background: transparent; border: 0; diff --git a/app/layout/header/components/UserSettingsModal/index.tsx b/app/layout/header/components/UserSettingsModal/index.tsx index f630b68b..d18403fc 100644 --- a/app/layout/header/components/UserSettingsModal/index.tsx +++ b/app/layout/header/components/UserSettingsModal/index.tsx @@ -14,7 +14,13 @@ import { initFirebase } from '@/firebase/firebaseApp' import { Auth, deleteUser, updateProfile } from 'firebase/auth' import Image from 'next/image' -function UserSettingsModal({ onClick, auth, }: { onClick?: MouseEventHandler, auth: Auth }) { +type SettingsTypes = { + onClick?: MouseEventHandler | MouseEventHandler | ((value: void) => void | PromiseLike) | null | undefined, + auth: Auth, + newUser?: boolean +} + +function UserSettingsModal({ onClick, auth, newUser }: SettingsTypes) { const dropIn = { @@ -140,11 +146,11 @@ function UserSettingsModal({ onClick, auth, }: { onClick?: MouseEventHandler void | PromiseLike) | null | undefined) + setIsLoading(false) setWasSuccessfull(true) @@ -259,7 +265,7 @@ function UserSettingsModal({ onClick, auth, }: { onClick?: MouseEventHandler) : undefined} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} @@ -272,21 +278,26 @@ function UserSettingsModal({ onClick, auth, }: { onClick?: MouseEventHandler - - - - +
+

Configure Your Account

+ + {!newUser && ( + } + id={styles.close_menu_btn} + variants={btnVariants} + whileTap={"tap"} + > + + + )} +
changeSettings(e)}>
-
User Account
+
User
@@ -300,7 +311,6 @@ function UserSettingsModal({ onClick, auth, }: { onClick?: MouseEventHandler diff --git a/app/layout/header/components/UserSideMenu/component.module.css b/app/layout/header/components/UserSideMenu/component.module.css index 15c527a3..022fe285 100644 --- a/app/layout/header/components/UserSideMenu/component.module.css +++ b/app/layout/header/components/UserSideMenu/component.module.css @@ -72,6 +72,12 @@ } +#user_container #user_btn.active svg{ + + fill: var(--brand-color); + +} + #user_container #user_btn>span { display: flex; } diff --git a/app/layout/header/components/UserSideMenu/index.tsx b/app/layout/header/components/UserSideMenu/index.tsx index e9040315..5ac75ffc 100644 --- a/app/layout/header/components/UserSideMenu/index.tsx +++ b/app/layout/header/components/UserSideMenu/index.tsx @@ -1,5 +1,5 @@ "use client" -import React, { useEffect, useState } from 'react' +import React, { useState } from 'react' import styles from './component.module.css' import PersonIcon from '@/public/assets/person-circle.svg' import ChevronDownSvg from '@/public/assets/chevron-down.svg' @@ -10,7 +10,6 @@ import HistorySvg from '@/public/assets/clock-history.svg' import BookmarkSvg from '@/public/assets/bookmark-check-fill.svg' import LoadingSvg from '@/public/assets/Eclipse-1s-200px.svg' import { getAuth } from 'firebase/auth' -import { initFirebase } from "@/firebase/firebaseApp"; import { useAuthState } from "react-firebase-hooks/auth" import Image from 'next/image' import Link from 'next/link' @@ -22,10 +21,9 @@ import ProfileFallbackImg from "@/public/profile_fallback.jpg" function UserSideMenu() { const [isUserMenuOpen, setIsUserMenuOpen] = useState(false) + const [isUserLoginOpen, setIsUserLoginOpen] = useState(false) const [isUserSettingsOpen, setIsUserSettingsOpen] = useState(false) - // FIREBASE LOGIN - const app = initFirebase() const auth = getAuth() const [user, loading] = useAuthState(auth) @@ -53,17 +51,29 @@ function UserSideMenu() { } - useEffect(() => { - setIsUserMenuOpen(false) - }, [user]) - return (
+ + {(isUserLoginOpen) && ( + + setIsUserLoginOpen(!isUserLoginOpen)} + auth={auth} + aria-expanded={isUserMenuOpen} + /> + + )} + + + {!user ? ( <> - - {isUserMenuOpen && ( - - setIsUserMenuOpen(!isUserMenuOpen)} - auth={auth} - aria-expanded={isUserMenuOpen} - /> - - )} - - ) : ( <> @@ -105,7 +100,7 @@ function UserSideMenu() { onClick={() => setIsUserMenuOpen(!isUserMenuOpen)} aria-controls={styles.user_menu_list} aria-label={isUserMenuOpen ? 'Click to Hide User Menu' : 'Click to Show User Menu'} - className={`display_flex_row align_items_center ${styles.heading_btn}`} + className={`display_flex_row align_items_center ${styles.heading_btn} ${isUserMenuOpen ? `${styles.active}` : ""}`} id={styles.user_btn} data-useractive={true} > From ccc72d115b5fbf8b8a17e4e941aa2ac32400b0e1 Mon Sep 17 00:00:00 2001 From: Erick Lima Date: Sat, 23 Mar 2024 21:40:06 -0300 Subject: [PATCH 2/9] fix: Home Hero Section Bcg Trailer Height Increased --- .../carouselComponent.module.css | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/components/HomePage/HeroCarouselHomePage/carouselComponent.module.css b/app/components/HomePage/HeroCarouselHomePage/carouselComponent.module.css index 802376f2..ada47fc2 100644 --- a/app/components/HomePage/HeroCarouselHomePage/carouselComponent.module.css +++ b/app/components/HomePage/HeroCarouselHomePage/carouselComponent.module.css @@ -63,7 +63,8 @@ li.carousel_item iframe { top: 50%; left: 50%; width: 100vw; - height: 100vh; + /* height: 100vh; */ + height: 114vh; /* transform: translate(-50%, -50%); */ transform: translate(-50%, -25%); pointer-events: none; @@ -87,11 +88,16 @@ li.carousel_item iframe::-webkit-scrollbar { transform: translate(-50%, -25%); } } */ +@media (min-aspect-ratio: 16/9) { + .video-container iframe { + height: 56.25vw; + } +} @media (max-aspect-ratio: 16/9) { li.carousel_item iframe { - /* width: 177.78vh; */ - width: 134.78vh; + width: 177.78vh; + /* width: 134.78vh; */ } } From 18f8a54b6d06b67b8ed694f342d1bd0a0b07cc69 Mon Sep 17 00:00:00 2001 From: Erick Lima Date: Sat, 23 Mar 2024 21:47:03 -0300 Subject: [PATCH 3/9] fix: Home Page Hero Trailer Not Looping --- app/components/HomePage/HeroCarouselHomePage/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/HomePage/HeroCarouselHomePage/index.tsx b/app/components/HomePage/HeroCarouselHomePage/index.tsx index f6d55435..753c1535 100644 --- a/app/components/HomePage/HeroCarouselHomePage/index.tsx +++ b/app/components/HomePage/HeroCarouselHomePage/index.tsx @@ -128,7 +128,7 @@ function HeroCarousel({ data, isMobile }: { data: ApiDefaultResult[], isMobile: initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: 3 }} - src={`https://www.youtube.com/embed/${data[imageIndex].trailer.id}?controls=0&autoplay=1&mute=1&playsinline=1&loop=1&showinfo=0`} + src={`https://www.youtube.com/embed/${data[imageIndex].trailer.id}?controls=0&autoplay=1&mute=1&playsinline=1&loop=1&showinfo=0&playlist=${data[imageIndex].trailer.id}`} frameBorder={0} title={data[imageIndex].title.romaji + " Trailer"} /> From 5756ce33bfd640e13b7619741c02546665add28e Mon Sep 17 00:00:00 2001 From: Erick Lima Date: Sun, 24 Mar 2024 15:29:31 -0300 Subject: [PATCH 4/9] fix: Use Cache as Work Around to API limits --- app/components/HomePage/MediaRankingSection/index.tsx | 2 ++ app/components/HomePage/NavThoughMedias/index.tsx | 3 +-- app/components/HomePage/NewestMediaSection/index.tsx | 2 ++ app/media/[id]/page.tsx | 2 ++ app/news/page.tsx | 4 ++-- app/page.tsx | 4 ++-- app/watch/[id]/page.tsx | 2 ++ 7 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/components/HomePage/MediaRankingSection/index.tsx b/app/components/HomePage/MediaRankingSection/index.tsx index a991a2af..3eaea960 100644 --- a/app/components/HomePage/MediaRankingSection/index.tsx +++ b/app/components/HomePage/MediaRankingSection/index.tsx @@ -17,6 +17,8 @@ type PropsTypes = { } +export const revalidate = 1800 // revalidate cached data every 30 min + function MediaRankingSection(props: PropsTypes) { const [mediaList, setMediaList] = useState(null) diff --git a/app/components/HomePage/NavThoughMedias/index.tsx b/app/components/HomePage/NavThoughMedias/index.tsx index 8854988e..2ee2c437 100644 --- a/app/components/HomePage/NavThoughMedias/index.tsx +++ b/app/components/HomePage/NavThoughMedias/index.tsx @@ -21,7 +21,6 @@ import { getAuth } from 'firebase/auth' import { initFirebase } from '@/firebase/firebaseApp' import { doc, getDoc, getFirestore } from 'firebase/firestore' - type Component = { title: string, @@ -33,7 +32,7 @@ type Component = { } -export const revalidate = 1800 // revalidate the data every 30 min +export const revalidate = 1800 // revalidate cached data every 30 min function NavThoughMedias({ title, route, dateOptions, sort, darkBackground, layoutInverted }: Component) { diff --git a/app/components/HomePage/NewestMediaSection/index.tsx b/app/components/HomePage/NewestMediaSection/index.tsx index f4e2df6c..c34abb7d 100644 --- a/app/components/HomePage/NewestMediaSection/index.tsx +++ b/app/components/HomePage/NewestMediaSection/index.tsx @@ -18,6 +18,8 @@ type PropsTypes = { } +export const revalidate = 1800 // revalidate the data every 30 min + function NewestMediaSection(props: PropsTypes) { const [mediaList, setMediaList] = useState([]) diff --git a/app/media/[id]/page.tsx b/app/media/[id]/page.tsx index ddb1778b..00247365 100644 --- a/app/media/[id]/page.tsx +++ b/app/media/[id]/page.tsx @@ -26,6 +26,8 @@ import CommentSectionContainer from '../../components/CommentSectionContainer' import { getMediaInfo } from '@/api/imdb' import { ImdbEpisode, ImdbMediaInfo } from '@/app/ts/interfaces/apiImdbInterface' +export const revalidate = 43200 // revalidate cached data every 12 hours + export async function generateMetadata({ params }: { params: { id: number } }) { const mediaData = await anilist.getMediaInfo(params.id) as ApiMediaResults diff --git a/app/news/page.tsx b/app/news/page.tsx index c3fd91c6..4a7b776a 100644 --- a/app/news/page.tsx +++ b/app/news/page.tsx @@ -9,13 +9,13 @@ import SvgCalendar from "@/public/assets/calendar3.svg" import { News } from '../ts/interfaces/newsInterface' import NewsCard1 from './components/NewsCard1' +export const revalidate = 1800 // revalidate cached data every 30 min + export const metadata: Metadata = { title: 'News | AniProject', description: 'See the latest news about a variety of animes, mangas and movies.', } -export const revalidate = 1800 // revalidate the data every 30 min - async function NewsHomePage() { const news = await newsApi.getNews() as News[] diff --git a/app/page.tsx b/app/page.tsx index e8045fb1..ac2bd2c4 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -17,13 +17,13 @@ import { checkDeviceIsMobile } from "./lib/checkMobileOrDesktop"; import { headers } from "next/headers"; import KeepWatchingSection from "./components/HomePage/KeepWatchingSection"; +export const revalidate = 21600 // revalidate cached data every 6 hours + export const metadata: Metadata = { title: 'Home | AniProject', description: 'A website which shows a variety of info about animes, mangas and movies.', } -export const revalidate = 1800 // revalidate the data every 30 min - export default async function Home() { const isMobileScreen = checkDeviceIsMobile(headers()) diff --git a/app/watch/[id]/page.tsx b/app/watch/[id]/page.tsx index 9947ee2c..4e24f6ea 100644 --- a/app/watch/[id]/page.tsx +++ b/app/watch/[id]/page.tsx @@ -14,6 +14,8 @@ import { fetchWithGoGoAnime } from '@/app/lib/fetchAnimeOnApi' import { ImdbEpisode, ImdbMediaInfo } from '@/app/ts/interfaces/apiImdbInterface' import { getMediaInfo } from '@/api/imdb' +export const revalidate = 900 // revalidate cached data every 15 minutes + export async function generateMetadata({ params, searchParams }: { params: { id: number }, // ANILIST ANIME ID searchParams: { episode: string, source: string, q: string } // EPISODE NUMBER, SOURCE, EPISODE ID From f443217447e9c085bbdbfa6a50eeff26cb9ea3bb Mon Sep 17 00:00:00 2001 From: Erick Lima Date: Sun, 24 Mar 2024 16:08:01 -0300 Subject: [PATCH 5/9] fix: Media Page Exceptions Errors; API on error return null --- api/anilist.ts | 28 +++++++++--- api/aniwatch.ts | 12 +++-- api/gogoanime.ts | 14 +++++- api/imdb.ts | 5 +-- app/error.tsx | 18 ++++++-- app/loading.tsx | 6 +-- .../AnimeEpisodesContainer/index.tsx | 45 +++++++++++-------- app/media/[id]/page.tsx | 18 +++++--- app/not-found.tsx | 1 - 9 files changed, 97 insertions(+), 50 deletions(-) diff --git a/api/anilist.ts b/api/anilist.ts index f7e3b3cf..7541de22 100644 --- a/api/anilist.ts +++ b/api/anilist.ts @@ -81,7 +81,9 @@ export default { } catch (error) { - return console.log((error as ErrorTypes).response.data.errors) + console.log((error as ErrorTypes).response.data.errors) + + return null } }), @@ -114,8 +116,9 @@ export default { } catch (error) { + console.log((error as ErrorTypes).response.data.errors) - return console.log((error as ErrorTypes).response.data.errors) + return null } }), @@ -152,7 +155,9 @@ export default { } catch (error) { - return console.log((error as ErrorTypes).response.data.errors) + console.log((error as ErrorTypes).response.data.errors) + + return null } @@ -194,7 +199,9 @@ export default { } catch (error) { - return console.log((error as ErrorTypes).response.data.errors) + console.log((error as ErrorTypes).response.data.errors) + + return null } @@ -231,7 +238,9 @@ export default { } catch (error) { - return console.log((error as ErrorTypes).response.data.errors) + console.log((error as ErrorTypes).response.data.errors) + + return null } @@ -266,7 +275,10 @@ export default { } catch (error) { - return console.log((error as ErrorTypes).response.data.errors) + console.log((error as ErrorTypes).response.data.errors) + + return null + } }), @@ -295,7 +307,9 @@ export default { } catch (error) { - return console.log((error as ErrorTypes).response.data.errors) + console.log((error as ErrorTypes).response.data.errors) + + return null } }), diff --git a/api/aniwatch.ts b/api/aniwatch.ts index d9c398a4..9dd8d605 100644 --- a/api/aniwatch.ts +++ b/api/aniwatch.ts @@ -21,7 +21,9 @@ export default { } catch (error: any) { - return console.log(error?.response.data.errors) + console.log(error?.response.data.errors) + + return null } }), @@ -40,7 +42,9 @@ export default { } catch (error: any) { - return console.log(error?.response.data.errors) + console.log(error?.response.data.errors) + + return null } }), @@ -59,7 +63,9 @@ export default { } catch (error: any) { - return console.log(error?.response.data.errors) + console.log(error?.response.data.errors) + + return null } }), diff --git a/api/gogoanime.ts b/api/gogoanime.ts index 9856f1fa..bda2ff5e 100644 --- a/api/gogoanime.ts +++ b/api/gogoanime.ts @@ -25,6 +25,8 @@ export default { console.log(error) + return null + } }, @@ -47,6 +49,8 @@ export default { console.log(error) + return null + } }, @@ -66,6 +70,8 @@ export default { console.log(error) + return null + } }, @@ -83,7 +89,9 @@ export default { } catch (error) { - return error + console.log(error) + + return null } @@ -102,7 +110,9 @@ export default { } catch (error) { - return error + console.log(error) + + return null } diff --git a/api/imdb.ts b/api/imdb.ts index bf1c74cd..91cfa80b 100644 --- a/api/imdb.ts +++ b/api/imdb.ts @@ -22,8 +22,7 @@ export async function searchMedia(mediaTitle: string) { console.log(err) - return err - + return null } } @@ -59,7 +58,7 @@ export async function getMediaInfo(search: boolean, mediaId?: string, type?: "TV console.log(err) - return err + return null } diff --git a/app/error.tsx b/app/error.tsx index 124cd3ea..2afa65ff 100644 --- a/app/error.tsx +++ b/app/error.tsx @@ -3,6 +3,7 @@ import Link from 'next/link' import React, { DetailedHTMLProps, HTMLAttributes, useEffect } from 'react' import ErrorImg from "@/public/error-img-4.png" import Image from 'next/image' +import { motion } from 'framer-motion' function ErrorPage({ error, reset }: { error: Error & { digest?: string } @@ -104,16 +105,25 @@ function ErrorPage({ error, reset }: {

Something went wrong!

{error.name}: {error.message}

+ + {error.stack}
- + - + Return to Home Page - +
diff --git a/app/loading.tsx b/app/loading.tsx index 7968a68e..fbeee596 100644 --- a/app/loading.tsx +++ b/app/loading.tsx @@ -16,13 +16,11 @@ function LoadingPlaceholder() {
-
+
Logo
- +

Loading... diff --git a/app/media/[id]/components/AnimeEpisodesContainer/index.tsx b/app/media/[id]/components/AnimeEpisodesContainer/index.tsx index 5b398e4d..c9f8e0c3 100644 --- a/app/media/[id]/components/AnimeEpisodesContainer/index.tsx +++ b/app/media/[id]/components/AnimeEpisodesContainer/index.tsx @@ -247,27 +247,34 @@ function EpisodesContainer(props: EpisodesContainerTypes) { sepateWithSpan={true} /> - {episodeSource == "aniwatch" && ( -

+ + {episodeSource == "aniwatch" && ( + - Wrong Episodes? Select bellow! + Wrong Episodes? Select bellow! + + - - -
- )} + + )} +
diff --git a/app/media/[id]/page.tsx b/app/media/[id]/page.tsx index 00247365..f0c0a172 100644 --- a/app/media/[id]/page.tsx +++ b/app/media/[id]/page.tsx @@ -45,7 +45,7 @@ async function MediaPage({ params }: { params: { id: number } }) { const isMobileScreen = checkDeviceIsMobile(headers()) || false // sort ASC episodes number - const episodesFromCrunchyroll = mediaData.streamingEpisodes.sort((a, b) => { + const episodesFromCrunchyroll = mediaData?.streamingEpisodes?.sort((a, b) => { const numA = Number(a.title.slice(a.title?.search(/\b \b/), a.title?.search(/\b - \b/))) const numB = Number(b.title.slice(b.title?.search(/\b \b/), b.title?.search(/\b - \b/))) @@ -53,12 +53,16 @@ async function MediaPage({ params }: { params: { id: number } }) { }) + let imdbEpisodes: ImdbEpisode[] = [] + // get media info on imdb const imdbMediaInfo: ImdbMediaInfo = await getMediaInfo(true, undefined, undefined, mediaData.title.romaji, mediaData.startDate.year) as ImdbMediaInfo // get episodes on imdb - let imdbEpisodes: ImdbEpisode[] = [] - imdbMediaInfo.seasons?.map(itemA => itemA.episodes.map(itemB => imdbEpisodes.push(itemB))) + imdbMediaInfo?.seasons?.map( + itemA => itemA.episodes?.map( + itemB => imdbEpisodes.push(itemB)) + ) return (
@@ -73,22 +77,22 @@ async function MediaPage({ params }: { params: { id: number } }) { `linear-gradient(rgba(0, 0, 0, 0.05), #181818 100%), url(${mediaData.format == "MANGA" ? mediaData.bannerImage : - imdbMediaInfo.cover || mediaData.bannerImage})` + imdbMediaInfo?.cover || mediaData.bannerImage})` }} >
{/* MEDIA INFO */} -
+
- {imdbMediaInfo.logos ? ( + {imdbMediaInfo?.logos ? (

{(mediaData.title?.romaji).toUpperCase() || mediaData.title.native}

) : ( {mediaData.title.native} )} - {imdbMediaInfo.logos ? ( + {imdbMediaInfo?.logos ? (
Date: Sun, 24 Mar 2024 16:12:04 -0300 Subject: [PATCH 6/9] fix: Wrong Type on API --- api/gogoanime.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/gogoanime.ts b/api/gogoanime.ts index bda2ff5e..444ef5a9 100644 --- a/api/gogoanime.ts +++ b/api/gogoanime.ts @@ -106,7 +106,7 @@ export default { method: 'GET' }) - return data as EpisodeLinksGoGoAnime[]; + return data as EpisodeLinksGoGoAnime; } catch (error) { From 288f00591e1597b7c201eb252b5f6e85013483a5 Mon Sep 17 00:00:00 2001 From: Erick Lima Date: Sun, 24 Mar 2024 16:19:04 -0300 Subject: [PATCH 7/9] fix: Wrong Type on Home Component --- app/components/HomePage/MediaRankingSection/index.tsx | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/components/HomePage/MediaRankingSection/index.tsx b/app/components/HomePage/MediaRankingSection/index.tsx index 3eaea960..c5bf9bc5 100644 --- a/app/components/HomePage/MediaRankingSection/index.tsx +++ b/app/components/HomePage/MediaRankingSection/index.tsx @@ -4,7 +4,7 @@ import styles from "./component.module.css" import MediaListCoverInfo from '../../MediaItemCoverInfo2' import NavButtons from '../../NavButtons' import { ApiDefaultResult } from '@/app/ts/interfaces/apiAnilistDataInterface' -import API from "@/api/anilist" +import anilist from "@/api/anilist" import { useAuthState } from 'react-firebase-hooks/auth' import { getAuth } from 'firebase/auth' import { initFirebase } from '@/firebase/firebaseApp' @@ -46,7 +46,7 @@ function MediaRankingSection(props: PropsTypes) { } - const response: ApiDefaultResult[] | void = await API.getMediaForThisFormat(parameter, undefined, undefined, undefined, showAdultContent) + const response = await anilist.getMediaForThisFormat(parameter, undefined, undefined, undefined, showAdultContent) as ApiDefaultResult[] currentQueryValue = parameter diff --git a/package-lock.json b/package-lock.json index 5a0ce661..66525199 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "aniproject", - "version": "2.4.2", + "version": "2.5.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aniproject", - "version": "2.4.2", + "version": "2.5.5", "dependencies": { "@vidstack/react": "^1.10.9", "axios": "^1.6.6", diff --git a/package.json b/package.json index c24c0c73..97c9bf1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aniproject", - "version": "2.4.2", + "version": "2.5.5", "private": true, "scripts": { "dev": "next dev", From babbb98f152c729abec287e2266649a0092aec12 Mon Sep 17 00:00:00 2001 From: Erick Lima Date: Sun, 24 Mar 2024 19:45:38 -0300 Subject: [PATCH 8/9] fix: fix: Wrong Type on Home Component --- app/components/HomePage/NavThoughMedias/index.tsx | 8 ++++---- app/components/HomePage/NewestMediaSection/index.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/components/HomePage/NavThoughMedias/index.tsx b/app/components/HomePage/NavThoughMedias/index.tsx index 2ee2c437..47b01358 100644 --- a/app/components/HomePage/NavThoughMedias/index.tsx +++ b/app/components/HomePage/NavThoughMedias/index.tsx @@ -3,7 +3,7 @@ import React, { SetStateAction, useEffect, useState } from 'react' import styles from './component.module.css' import Link from 'next/link' import { ApiAiringMidiaResults, ApiDefaultResult } from '@/app/ts/interfaces/apiAnilistDataInterface' -import API from '@/api/anilist' +import anilist from '@/api/anilist' import ChevronLeftIcon from '@/public/assets/chevron-left.svg' import ChevronRightIcon from '@/public/assets/chevron-right.svg' import CloseSvg from '@/public/assets/x.svg' @@ -86,13 +86,13 @@ function NavThoughMedias({ title, route, dateOptions, sort, darkBackground, layo if (sort == "RELEASE") { // gets the range of days than parse it to unix and get any media releasing in the selected range - response = await API.getReleasingByDaysRange( + response = await anilist.getReleasingByDaysRange( "ANIME", days!, newPageResults ? (previous ? pageIndex - 1 : pageIndex + 1) : undefined, undefined, showAdultContent - ) + ) as ApiAiringMidiaResults[] const responseMap = (response as ApiAiringMidiaResults[]).map((item) => item.media) response = responseMap @@ -102,7 +102,7 @@ function NavThoughMedias({ title, route, dateOptions, sort, darkBackground, layo } else { - response = await API.getMediaForThisFormat( + response = await anilist.getMediaForThisFormat( "ANIME", sort, newPageResults ? (previous ? pageIndex - 1 : pageIndex + 1) : undefined, diff --git a/app/components/HomePage/NewestMediaSection/index.tsx b/app/components/HomePage/NewestMediaSection/index.tsx index c34abb7d..f216a03c 100644 --- a/app/components/HomePage/NewestMediaSection/index.tsx +++ b/app/components/HomePage/NewestMediaSection/index.tsx @@ -5,7 +5,7 @@ import MediaListCoverInfo from '../../MediaItemCoverInfo2' import CardMediaCoverAndDescription from '../../CardMediaCoverAndDescription' import NavButtons from '../../NavButtons' import { ApiAiringMidiaResults, ApiDefaultResult } from '@/app/ts/interfaces/apiAnilistDataInterface' -import API from "@/api/anilist" +import anilist from "@/api/anilist" import { useAuthState } from 'react-firebase-hooks/auth' import { getAuth } from 'firebase/auth' import { initFirebase } from '@/firebase/firebaseApp' @@ -56,7 +56,7 @@ function NewestMediaSection(props: PropsTypes) { setIsLoading(true) - const response = await API.getReleasingByDaysRange("ANIME", days, undefined, 11, showAdultContent).then( + const response = await anilist.getReleasingByDaysRange("ANIME", days, undefined, 11, showAdultContent).then( res => ((res as ApiAiringMidiaResults[]).sort((a, b) => a.media.popularity - b.media.popularity).reverse()) ).then(res => res.map((item) => item.media)) From fb361d28be8941c12d56d8a90df8f672ee656514 Mon Sep 17 00:00:00 2001 From: Erick Lima Date: Sun, 24 Mar 2024 19:51:51 -0300 Subject: [PATCH 9/9] fix: fix: Wrong Types --- app/lib/fetchAnimeOnApi.ts | 2 +- app/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/fetchAnimeOnApi.ts b/app/lib/fetchAnimeOnApi.ts index 1b250b61..d38ad248 100644 --- a/app/lib/fetchAnimeOnApi.ts +++ b/app/lib/fetchAnimeOnApi.ts @@ -50,7 +50,7 @@ export async function fetchWithAniWatch(textSearch: string, only?: "episodes", f const regexMediaTitle = regexOnlyAlphabetic(checkApiMisspellingMedias(textSearch)).toLowerCase() - let searchResultsForMedia = await aniwatch.searchMedia(regexMediaTitle).then((res: void | MediaInfoFetchedAnimeWatch) => res!.animes) as MediaInfoAniwatch[] + let searchResultsForMedia = await aniwatch.searchMedia(regexMediaTitle).then((res) => res!.animes) as MediaInfoAniwatch[] if (format) { searchResultsForMedia = searchResultsForMedia.filter(item => item.type.toLowerCase() == format.toLowerCase()) diff --git a/app/page.tsx b/app/page.tsx index ac2bd2c4..46447e2d 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -44,7 +44,7 @@ export default async function Home() { ) // section 4 - const mediaRankingData = await anilist.getMediaForThisFormat("ANIME") + const mediaRankingData = await anilist.getMediaForThisFormat("ANIME") as ApiDefaultResult[] const newestMediaData = await anilist.getReleasingByDaysRange("ANIME", 1, undefined, 11).then( res => ((res as ApiAiringMidiaResults[]).sort((a, b) => a.media.popularity - b.media.popularity).reverse()) ).then(res => res.map((item) => item.media))