diff options
| author | Factiven <[email protected]> | 2023-05-01 01:09:33 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-05-01 01:09:33 +0700 |
| commit | c526d560a3e8ed9b2dc9a23825b8979c00a152ba (patch) | |
| tree | 7fa872b8d6dd3cc3c93c7a53f4475ad7b9db7a0a /components/footer.js | |
| parent | Editor List v0.7 (diff) | |
| download | moopa-c526d560a3e8ed9b2dc9a23825b8979c00a152ba.tar.xz moopa-c526d560a3e8ed9b2dc9a23825b8979c00a152ba.zip | |
Update v3.5
> Bug Fixes
> Editor List Update v0.8
> Display adjustment on search page
Diffstat (limited to 'components/footer.js')
| -rw-r--r-- | components/footer.js | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/components/footer.js b/components/footer.js index 90ae982..3494810 100644 --- a/components/footer.js +++ b/components/footer.js @@ -3,9 +3,12 @@ import Instagram from "./media/instagram"; import Link from "next/link"; import Image from "next/image"; import { signIn, useSession } from "next-auth/react"; +import { useState } from "react"; function Footer() { const { data: session, status } = useSession(); + const [year, setYear] = useState(new Date().getFullYear()); + const [season, setSeason] = useState(getCurrentSeason()); return ( <section className="text-[#dbdcdd] z-40 bg-[#0c0d10] md:flex md:h-[12rem] md:items-center md:justify-between"> @@ -39,7 +42,11 @@ function Footer() { <div className="flex flex-col gap-10 font-karla font-bold md:flex-row md:gap-[5.94rem]"> <ul className="flex flex-col gap-y-[0.7rem] "> <li className="cursor-pointer hover:text-action"> - <Link href="/">This Season</Link> + <Link + href={`/search/anime?season=${season}&seasonYear=${year}`} + > + This Season + </Link> </li> <li className="cursor-pointer hover:text-action"> <Link href="/search/anime">Popular Anime</Link> @@ -83,3 +90,29 @@ function Footer() { } export default Footer; + +function getCurrentSeason() { + const now = new Date(); + const month = now.getMonth() + 1; // getMonth() returns 0-based index + + switch (month) { + case 12: + case 1: + case 2: + return "WINTER"; + case 3: + case 4: + case 5: + return "SPRING"; + case 6: + case 7: + case 8: + return "SUMMER"; + case 9: + case 10: + case 11: + return "FALL"; + default: + return "UNKNOWN SEASON"; + } +} |