From e6346b1d7d788754d0c2d11fc18724627ec5bf15 Mon Sep 17 00:00:00 2001 From: Factiven Date: Sat, 29 Apr 2023 14:30:08 +0700 Subject: Editor List v0.6 --- components/listEditor.js | 125 +++++++++++++++++++++++++++-------------------- components/modal.js | 4 +- pages/anime/[...id].js | 7 ++- 3 files changed, 78 insertions(+), 58 deletions(-) diff --git a/components/listEditor.js b/components/listEditor.js index 41a3172..64ca632 100644 --- a/components/listEditor.js +++ b/components/listEditor.js @@ -1,8 +1,9 @@ import { useState } from "react"; import useAlert from "./useAlert"; import { motion as m } from "framer-motion"; +import Image from "next/image"; -const ListEditor = ({ animeId, session, stats, prg, max }) => { +const ListEditor = ({ animeId, session, stats, prg, max, image = null }) => { const { message, type, showAlert } = useAlert(); const [status, setStatus] = useState(stats ?? ""); const [progress, setProgress] = useState(prg ?? 0); @@ -50,7 +51,7 @@ const ListEditor = ({ animeId, session, stats, prg, max }) => { }; return ( -
+
{message && ( { {message} )} -
+
List Editor
-
-
-
- - -
-
- - setProgress(e.target.value)} - className="rounded-sm px-2 py-1 bg-[#363642] w-[50%] sm:w-[150px] text-sm sm:text-base" - min="0" +
+ {image && ( +
+ image + image
-
- - +
+
+ + +
+
+ + setProgress(e.target.value)} + className="rounded-sm px-2 py-1 bg-[#363642] w-[50%] sm:w-[150px] text-sm sm:text-base" + min="0" + /> +
+
+ + +
); }; diff --git a/components/modal.js b/components/modal.js index 0a9d349..f237d77 100644 --- a/components/modal.js +++ b/components/modal.js @@ -3,13 +3,13 @@ export default function Modal({ open, onClose, children }) {
e.stopPropagation()} className={`shadow rounded-xl p-6 transition-all ${ - open ? "scale-125 opacity-100" : "scale-100 opacity-0" + open ? "scale-100 opacity-100" : "scale-75 opacity-0" }`} > {children} diff --git a/pages/anime/[...id].js b/pages/anime/[...id].js index 63849bc..3b1cf91 100644 --- a/pages/anime/[...id].js +++ b/pages/anime/[...id].js @@ -278,11 +278,9 @@ export default function Info() { const gat = prog.lists.map((item) => item.entries); const git = gat.map((item) => - item.find((item) => item.media.id === parseInt(data?.id)) - ); - const gut = git?.find( - (item) => item?.media.id === parseInt(data?.id) + item.find((item) => item.mediaId === parseInt(id[0])) ); + const gut = git?.find((item) => item?.mediaId === parseInt(id[0])); if (gut) { setProgress(gut?.progress); @@ -367,6 +365,7 @@ export default function Info() { stats={statuses} prg={progress} max={info?.episodes} + image={info} /> )}
-- cgit v1.2.3