diff options
| author | zephex <[email protected]> | 2024-04-20 13:34:53 +0530 |
|---|---|---|
| committer | zephex <[email protected]> | 2024-04-20 13:34:53 +0530 |
| commit | d6780cf3dad729c69a102ba2940188cf1e6bcbf4 (patch) | |
| tree | d10a2aefef6664c42439f165c73722c514b032bc /src/app/anime/history | |
| parent | feature added: tracker for mangas (diff) | |
| download | dramalama-d6780cf3dad729c69a102ba2940188cf1e6bcbf4.tar.xz dramalama-d6780cf3dad729c69a102ba2940188cf1e6bcbf4.zip | |
idk whats happening
Diffstat (limited to 'src/app/anime/history')
| -rw-r--r-- | src/app/anime/history/continueWatching/cw.module.css | 116 | ||||
| -rw-r--r-- | src/app/anime/history/continueWatching/page.jsx | 130 | ||||
| -rw-r--r-- | src/app/anime/history/storeData.js | 52 |
3 files changed, 149 insertions, 149 deletions
diff --git a/src/app/anime/history/continueWatching/cw.module.css b/src/app/anime/history/continueWatching/cw.module.css index d8062ac..2b2c6b0 100644 --- a/src/app/anime/history/continueWatching/cw.module.css +++ b/src/app/anime/history/continueWatching/cw.module.css @@ -1,59 +1,59 @@ -.main { - width: 99%; - margin: 80px auto; -} - -.mainText { - color: var(--light-green); - font-family: "Poppins", serif; - font-size: 24px; -} - -.animeContainer { - font-family: "Poppins", serif; - font-size: 18px; - margin: 0px; -} - -.animeEntry { - display: flex; - align-items: center; - justify-content: space-between; - padding: 5px; - margin-bottom: 0.5rem; - border-radius: 1rem; - background-color: #1f1f1f; -} - -.animeEntry img { - width: auto; - height: auto; - max-height: 40dvh; - border-radius: 0.8rem; -} - -.titleContainer { - color: white; - margin-left: 0.2rem; -} - -.titleContainer h3 { - margin: 0px; -} - -.EpisodeCount { - color: var(--soft-purple); - margin: 0px; -} - -.date { - color: var(--neon-yellow); - margin: 0px; -} - -@media screen and (max-width: 768px) { - .animeContainer { - font-size: 14px; - - } +.main {
+ width: 99%;
+ margin: 80px auto;
+}
+
+.mainText {
+ color: var(--light-green);
+ font-family: "Poppins", serif;
+ font-size: 24px;
+}
+
+.animeContainer {
+ font-family: "Poppins", serif;
+ font-size: 18px;
+ margin: 0px;
+}
+
+.animeEntry {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 5px;
+ margin-bottom: 0.5rem;
+ border-radius: 1rem;
+ background-color: #1f1f1f;
+}
+
+.animeEntry img {
+ width: auto;
+ height: auto;
+ max-height: 40dvh;
+ border-radius: 0.8rem;
+}
+
+.titleContainer {
+ color: white;
+ margin-left: 0.2rem;
+}
+
+.titleContainer h3 {
+ margin: 0px;
+}
+
+.EpisodeCount {
+ color: var(--soft-purple);
+ margin: 0px;
+}
+
+.date {
+ color: var(--neon-yellow);
+ margin: 0px;
+}
+
+@media screen and (max-width: 768px) {
+ .animeContainer {
+ font-size: 14px;
+
+ }
}
\ No newline at end of file diff --git a/src/app/anime/history/continueWatching/page.jsx b/src/app/anime/history/continueWatching/page.jsx index cab834c..d9bc6d1 100644 --- a/src/app/anime/history/continueWatching/page.jsx +++ b/src/app/anime/history/continueWatching/page.jsx @@ -1,65 +1,65 @@ -"use client"; - -import React, { useState, useEffect } from "react"; -import Image from "next/image"; -import styles from "./cw.module.css"; -import Link from "next/link"; - -const ContinueWatching = () => { - const [localItems, setLocalItems] = useState(null); - - useEffect(() => { - const newData = get_local(); - setLocalItems(newData); - }, []); // Empty dependency array means this effect runs only once after the initial render - - function get_local() { - try { - const data = localStorage.getItem("data"); - return JSON.parse(data); - } catch (error) { - console.log("error", error); - return false; - } - } - - return ( - <main className={styles.main}> - <p className={styles.mainText}>Continue Watching</p> - {localItems && ( - <div className={styles.animeContainer}> - {localItems.watchHis && - localItems.watchHis.map((item, index) => ( - <Link - href={`/${item.type}/${item.id}`} - style={{ textDecoration: "none" }} - key={index} - > - <div className={styles.animeEntry}> - <div className={styles.titleContainer}> - <h3>{item.name}</h3> - <p className={styles.EpisodeCount}> - Episode watching: {item.episode} - </p> - <p className={styles.date}> - Last watched on: {item.date} at{" "} - {item.time} - </p> - </div> - <Image - src={item.image} - width={140} - height={210} - alt="Continue anime poster" - priority - /> - </div> - </Link> - ))} - </div> - )} - </main> - ); -}; - -export default ContinueWatching; +"use client";
+
+import React, { useState, useEffect } from "react";
+import Image from "next/image";
+import styles from "./cw.module.css";
+import Link from "next/link";
+
+const ContinueWatching = () => {
+ const [localItems, setLocalItems] = useState(null);
+
+ useEffect(() => {
+ const newData = get_local();
+ setLocalItems(newData);
+ }, []); // Empty dependency array means this effect runs only once after the initial render
+
+ function get_local() {
+ try {
+ const data = localStorage.getItem("data");
+ return JSON.parse(data);
+ } catch (error) {
+ console.log("error", error);
+ return false;
+ }
+ }
+
+ return (
+ <main className={styles.main}>
+ <p className={styles.mainText}>Continue Watching</p>
+ {localItems && (
+ <div className={styles.animeContainer}>
+ {localItems.watchHis &&
+ localItems.watchHis.map((item, index) => (
+ <Link
+ href={`/${item.type}/${item.id}`}
+ style={{ textDecoration: "none" }}
+ key={index}
+ >
+ <div className={styles.animeEntry}>
+ <div className={styles.titleContainer}>
+ <h3>{item.name}</h3>
+ <p className={styles.EpisodeCount}>
+ Episode watching: {item.episode}
+ </p>
+ <p className={styles.date}>
+ Last watched on: {item.date} at{" "}
+ {item.time}
+ </p>
+ </div>
+ <Image
+ src={item.image}
+ width={140}
+ height={210}
+ alt="Continue anime poster"
+ priority
+ />
+ </div>
+ </Link>
+ ))}
+ </div>
+ )}
+ </main>
+ );
+};
+
+export default ContinueWatching;
diff --git a/src/app/anime/history/storeData.js b/src/app/anime/history/storeData.js index ae5f9d4..b748d3b 100644 --- a/src/app/anime/history/storeData.js +++ b/src/app/anime/history/storeData.js @@ -1,26 +1,26 @@ -"use client"; - -export function storeLocal(watchData) { - const jsonData = localStorage.getItem("data"); - const dataObject = jsonData ? JSON.parse(jsonData) : {}; - - if (!dataObject.watchHis) { - dataObject.watchHis = []; - } - - let found = false; - dataObject.watchHis.forEach((element) => { - if (element.name === watchData.name) { - let episode = watchData.episode; - element.episode = episode; - found = true; - } - }); - - if (!found) { - dataObject.watchHis.push(watchData); - } - - let updatedData = JSON.stringify(dataObject); - localStorage.setItem("data", updatedData); -} +"use client";
+
+export function storeLocal(watchData) {
+ const jsonData = localStorage.getItem("data");
+ const dataObject = jsonData ? JSON.parse(jsonData) : {};
+
+ if (!dataObject.watchHis) {
+ dataObject.watchHis = [];
+ }
+
+ let found = false;
+ dataObject.watchHis.forEach((element) => {
+ if (element.name === watchData.name) {
+ let episode = watchData.episode;
+ element.episode = episode;
+ found = true;
+ }
+ });
+
+ if (!found) {
+ dataObject.watchHis.push(watchData);
+ }
+
+ let updatedData = JSON.stringify(dataObject);
+ localStorage.setItem("data", updatedData);
+}
|