From b44b8dc9183589f87a9838fccc1346e7b0aa40a7 Mon Sep 17 00:00:00 2001 From: Artrix Date: Fri, 12 Jan 2024 23:23:25 -0800 Subject: [PATCH] redesign: Redesign schedules page (#112) * Remove trailing commas * Polish schedules page & Remove unneeded styles * Add scroll animations * Add scrolling animation to time view * Refactor schedule page layout and styling --------- Co-authored-by: Factiven --- .prettierrc.json | 3 +- pages/en/schedule/index.tsx | 77 +++++++++++++++++++++++++------------ 2 files changed, 55 insertions(+), 25 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 08df606e..08f9b578 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,4 +1,5 @@ { "bracketSpacing": true, - "printWidth": 80 + "printWidth": 80, + "trailingComma": "none" } diff --git a/pages/en/schedule/index.tsx b/pages/en/schedule/index.tsx index 42a28c67..f116b7ce 100644 --- a/pages/en/schedule/index.tsx +++ b/pages/en/schedule/index.tsx @@ -1,6 +1,7 @@ // @ts-nocheck import Image from "next/image"; +import { cubicBezier, motion } from "framer-motion"; import { useEffect, useRef, useState } from "react"; import Link from "next/link"; import { CalendarIcon } from "@heroicons/react/24/solid"; @@ -11,7 +12,7 @@ import { filterFormattedSchedule, filterScheduleByDay, sortScheduleByDay, - transformSchedule, + transformSchedule } from "@/utils/schedulesUtils"; import { scheduleQuery } from "@/lib/graphql/query"; @@ -28,7 +29,7 @@ const day = [ "Wednesday", "Thursday", "Friday", - "Saturday", + "Saturday" ]; const isAired = (timestamp: number | null) => { @@ -68,9 +69,9 @@ export async function getServerSideProps() { return { props: { - schedule: scheduleByDay, + schedule: scheduleByDay // today: todaySchedule, - }, + } }; } else { now.setHours(0, 0, 0, 0); // Set the time to 00:00:00.000 @@ -88,16 +89,16 @@ export async function getServerSideProps() { method: "POST", headers: { "Content-Type": "application/json", - Accept: "application/json", + Accept: "application/json" }, body: JSON.stringify({ query: scheduleQuery, variables: { weekStart, weekEnd, - page, - }, - }), + page + } + }) }); const json = await res.json(); @@ -113,7 +114,7 @@ export async function getServerSideProps() { const timestampToDay = (timestamp: number) => { return new Date(timestamp * 1000).toLocaleDateString(undefined, { - weekday: "long", + weekday: "long" }); }; @@ -137,9 +138,9 @@ export async function getServerSideProps() { return { props: { - schedule: scheduleByDay, + schedule: scheduleByDay // today: todaySchedule, - }, + } }; } // setSchedule(scheduleByDay); @@ -267,11 +268,11 @@ export default function Schedule({ schedule }: any) {
- -
- -
-
+ {/* +
+ */} +
+
    -

    +

    {day}

    {Object.entries(timeSlots).map(([time, animeList]) => ( -
    -
    + ))}
)) @@ -402,7 +417,7 @@ export default function Schedule({ schedule }: any) {

{day}

-
+ {schedules.map((s) => { const m = s.media; @@ -470,7 +499,7 @@ export default function Schedule({ schedule }: any) { ); })} -
+
) )