From bae1f53877c3447d3ba940f823e5a8a097f5b22c Mon Sep 17 00:00:00 2001 From: Factiven Date: Wed, 9 Aug 2023 15:11:53 +0700 Subject: Update v3.9.0 - Merged Beta to Main (#41) * initial commit * Update_v.3.6.7-beta-v1.2 * Update_v.3.6.7-beta-v1.3 * Update_v.3.6.7-beta-v1.3 > update API * Fixed mediaList won't update * added .env disqus shortname * Update_v3.6.7-beta-v1.4 >Implementing database * Create main.yml * Update v3.6.7-beta-v1.5 small patch * title home page * Update content.js * Delete db-test.js * Update content.js * Update home page card * Update v3.7.0 * Update v3.7.1-beta > migrating backend to main code > fixed schedule component * Update v3.8.0 > Added dub options > Moved schedule backend * Update v.3.8.1 > Fixed episodes on watch page isn't dubbed * Update v3.8.1-patch-1 * Update v3.8.1-patch-2 > Another patch for dub * Update v3.8.2 > Removed prisma configuration for database since it's not stable yet * Update v3.8.3 > Fixed different provider have same id * Update v.3.8.3 > Fixed player bug where the controls won't hide after updating anilist progress * Update v3.8.4-patch-2 * Update v3.8.5 > Update readme.md > Update .env.example * Update next.config.js * small adjusment info page * Update v3.8.6 > Minor update for Android 13 user * Update v3.8.7 > Added prev and next button to mediaSession * Update v3.8.7-beta-v2 * Beta v2 (#37) * Update schema.prisma * Update schema.prisma * Update schema.prisma * Update 3.9.0-beta-v2.1 > Implemented database for storing user Watch List and settings > Added buttons to auto-play next episodes * Update v3.9.0-beta-v2.2 * Update README.md --------- Co-authored-by: Chitraksh Maheshwari <68012660+chitrakshbotwala@users.noreply.github.com> --- components/home/content.js | 269 +++++++++++++++++++++++++++++++-------------- 1 file changed, 184 insertions(+), 85 deletions(-) (limited to 'components/home/content.js') diff --git a/components/home/content.js b/components/home/content.js index 9d41fe9..f13c7a8 100644 --- a/components/home/content.js +++ b/components/home/content.js @@ -10,10 +10,17 @@ import { import { parseCookies } from "nookies"; import { ChevronLeftIcon } from "@heroicons/react/20/solid"; -import { ExclamationCircleIcon } from "@heroicons/react/24/solid"; +import { ExclamationCircleIcon, PlayIcon } from "@heroicons/react/24/solid"; import { useRouter } from "next/router"; -export default function Content({ ids, section, data, og, userName }) { +export default function Content({ + ids, + section, + data, + userData, + og, + userName, +}) { const router = useRouter(); const [startX, setStartX] = useState(null); @@ -115,6 +122,9 @@ export default function Content({ ids, section, data, og, userName }) { filteredData?.length > 15 ? filteredData?.slice(0, 15) : filteredData; const goToPage = () => { + if (section === "Recently Watched") { + router.push(`/${lang}/anime/recently-watched`); + } if (section === "Trending Now") { router.push(`/${lang}/anime/trending`); } @@ -159,95 +169,184 @@ export default function Content({ ids, section, data, og, userName }) { onClick={handleClick} ref={containerRef} > - {slicedData?.map((anime) => { - const progress = og?.find((i) => i.mediaId === anime.id); - - return ( -
- - {ids === "onGoing" && ( -
-
-

- {anime.title.romaji || anime.title.english} -

- {checkProgress(progress) && - !clicked?.hasOwnProperty(anime.id) && ( - - )} - {checkProgress(progress) && ( -
handleAlert(anime.id)} - className="group-hover:visible invisible absolute top-0 bg-black bg-opacity-20 w-full h-full z-20 text-center" - > -

- {checkProgress(progress)} -

-
- )} - {anime.nextAiringEpisode && ( -
-

- Episode {anime.nextAiringEpisode.episode} in + + {ids !== "recentlyWatched" + ? slicedData?.map((anime) => { + const progress = og?.find((i) => i.mediaId === anime.id); + + return ( +
+ + {ids === "onGoing" && ( +
+
+

+ {anime.title.romaji || anime.title.english}

-

- {convertSecondsToTime( - anime?.nextAiringEpisode?.timeUntilAiring + {checkProgress(progress) && + !clicked?.hasOwnProperty(anime.id) && ( + )} -

+ {checkProgress(progress) && ( +
handleAlert(anime.id)} + className="group-hover:visible invisible absolute top-0 bg-black bg-opacity-20 w-full h-full z-20 text-center" + > +

+ {checkProgress(progress)} +

+
+ )} + {anime.nextAiringEpisode && ( +
+

+ Episode {anime.nextAiringEpisode.episode} in +

+

+ {convertSecondsToTime( + anime?.nextAiringEpisode?.timeUntilAiring + )} +

+
+ )}
+
+ )} + { + + {ids !== "onGoing" && ( + +

+ {anime.status === "RELEASING" ? ( + + ) : anime.status === "NOT_YET_RELEASED" ? ( + + ) : null} + {anime.title.romaji} +

+ + )} +
+ ); + }) + : userData + ?.filter((i) => i.title && i.title !== null) + ?.slice(0, 10) + .map((i) => { + const time = i.timeWatched; + const duration = i.duration; + let prog = (time / duration) * 100; + if (prog > 90) prog = 100; + + return ( + +
+
+
+ +

+ {i?.title === i.aniTitle + ? `Episode ${i.episode}` + : i?.title || i.anititle} +

+
+ + {i?.image && ( + Episode Thumbnail )}
-
- )} - { - - {ids !== "onGoing" && ( - -

- {anime.status === "RELEASING" ? ( - - ) : anime.status === "NOT_YET_RELEASED" ? ( - - ) : null} - {anime.title.romaji} -

- - )} + +
+ {/*

{i.title}

*/} +

+ + {i.aniTitle} + {" "} + | Episode {i.episode} +

+
+ + ); + })} + {userData?.length >= 10 && section !== "Recommendations" && ( +
+
+

+ More on {section} +

+
- ); - })} - {filteredData.length >= 10 && section !== "Recommendations" && ( +
+ )} + {filteredData?.length >= 10 && section !== "Recommendations" && (