diff options
| author | real-zephex <[email protected]> | 2024-05-14 01:02:50 +0530 |
|---|---|---|
| committer | real-zephex <[email protected]> | 2024-05-14 01:02:50 +0530 |
| commit | c0e1e1a5ab734d254392e8bfcc7ace0e0ff3b6fa (patch) | |
| tree | 271228b9cf8ba5bd80a79145216c84ee1144457d /src/app/anime/search | |
| parent | minor changes to the kdrama page (diff) | |
| parent | Merge pull request #27 from real-zephex/improvement-2 (diff) | |
| download | dramalama-c0e1e1a5ab734d254392e8bfcc7ace0e0ff3b6fa.tar.xz dramalama-c0e1e1a5ab734d254392e8bfcc7ace0e0ff3b6fa.zip | |
Merge branch 'master' of https://github.com/real-zephex/Dramalama-Next
Diffstat (limited to 'src/app/anime/search')
| -rw-r--r-- | src/app/anime/search/components/fetchInfo.js | 14 | ||||
| -rw-r--r-- | src/app/anime/search/components/fetchedInfo.js | 45 | ||||
| -rw-r--r-- | src/app/anime/search/page.jsx | 69 | ||||
| -rw-r--r-- | src/app/anime/search/search.module.css | 114 |
4 files changed, 0 insertions, 242 deletions
diff --git a/src/app/anime/search/components/fetchInfo.js b/src/app/anime/search/components/fetchInfo.js deleted file mode 100644 index 2f81345..0000000 --- a/src/app/anime/search/components/fetchInfo.js +++ /dev/null @@ -1,14 +0,0 @@ -"use server";
-
-export default async function Results(id) {
- return await testFunction(id);
-}
-
-async function testFunction(title) {
- const res = await fetch(
- "https://consumet-jade.vercel.app/anime/gogoanime/" + title,
- { next: { revalidate: 21600 } }
- );
- const data = await res.json();
- return data;
-}
diff --git a/src/app/anime/search/components/fetchedInfo.js b/src/app/anime/search/components/fetchedInfo.js deleted file mode 100644 index 359e745..0000000 --- a/src/app/anime/search/components/fetchedInfo.js +++ /dev/null @@ -1,45 +0,0 @@ -import styles from "../search.module.css";
-import Link from "next/link";
-import Image from "next/image";
-import { preFetchAnimeInfo } from "../../videoLinkfetcher";
-
-export default async function fetchedInfo(data) {
- preFetchAnimeInfo(data);
- return (
- <div className={styles.animeEntry}>
- {data ? (
- data.results && data.results.length > 0 ? (
- data.results.map((item, index) => (
- <Link
- key={index}
- href={`/anime/${item.id}`}
- style={{ textDecoration: "none" }}
- >
- <div className={styles.anime}>
- <p>{item.title}</p>
- <Image
- src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=${item.image}`}
- className={styles.animeImage}
- width={120}
- height={180}
- alt="Drama Poster"
- />
- </div>
- </Link>
- ))
- ) : (
- <div style={{ margin: "0px auto" }}>
- <p
- style={{
- color: "white",
- fontSize: 18,
- }}
- >
- No results found
- </p>
- </div>
- )
- ) : null}
- </div>
- );
-}
diff --git a/src/app/anime/search/page.jsx b/src/app/anime/search/page.jsx deleted file mode 100644 index f543fd8..0000000 --- a/src/app/anime/search/page.jsx +++ /dev/null @@ -1,69 +0,0 @@ -"use client";
-
-import styles from "./search.module.css";
-import { FaSearch } from "react-icons/fa"; // Import the search icon from react-icons library
-import { useState } from "react";
-import Results from "./components/fetchInfo";
-import fetchedInfo from "./components/fetchedInfo";
-import Link from "next/link";
-
-export default function Input() {
- const [searchedAnime, setSearchedAnime] = useState(null);
- const [loading, setLoading] = useState(null);
- const [info, setInfo] = useState(null);
-
- const handleKeyPress = async (event) => {
- if (
- (event.code === "Enter" ||
- event.key === "Enter" ||
- event.code === 13) &&
- searchedAnime !== ""
- ) {
- setLoading(true);
- setInfo(await fetchedInfo(await Results(searchedAnime)));
- setLoading(false);
- } else if (
- (event.code === "Enter" ||
- event.key === "Enter" ||
- event.code === 13) &&
- searchedAnime === ""
- ) {
- alert("Input cannot be empty");
- }
- };
-
- return (
- <div style={{ marginBottom: -15 }}>
- <div className={styles.inputContainer}>
- <div className={styles.searchContainer}>
- <FaSearch className={styles.searchIcon} />
- <input
- onChange={(event) => {
- if (event.target.value.trim() !== "") {
- setSearchedAnime(event.target.value);
- }
- }}
- onKeyDown={(event) => handleKeyPress(event)}
- placeholder="Enter anime title"
- className={styles.SearchInput}
- ></input>
- </div>
- <div>
- <button>
- <Link href={"/anime/history/continueWatching"}>
- History
- </Link>
- </button>
- </div>
- </div>
-
- {loading && (
- <p className={styles.waitWhileLoading}>
- Please wait while we crunch all the data for you
- </p>
- )}
-
- {info}
- </div>
- );
-}
diff --git a/src/app/anime/search/search.module.css b/src/app/anime/search/search.module.css deleted file mode 100644 index a185e36..0000000 --- a/src/app/anime/search/search.module.css +++ /dev/null @@ -1,114 +0,0 @@ -.waitWhileLoading {
- font-size: 18px;
- text-align: center;
- color: white;
-}
-
-.inputContainer {
- display: flex;
- align-items: center;
- margin: 0 0.3rem 0 0.3rem;
-}
-
-.inputContainer button {
- margin: 5px;
- background-color: #121212;
- padding: 10px;
- border-radius: 10px;
- outline: none;
- border: none;
- color: white;
- font-family: "Lexend Deca", serif;
-}
-
-.inputContainer button a {
- text-decoration: none;
- color: white;
-}
-
-.searchContainer input {
- border: none;
- border-radius: 5px;
- color: white;
- outline: none;
- background: none;
- width: 100%;
- font-family: "Lexend Deca", serif;
- font-size: 16px;
-}
-
-.searchContainer {
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 20px 0px 20px 0px;
- background-color: #121212;
- padding: 10px;
- border-radius: 10px;
- width: 30%;
-}
-
-.searchIcon {
- color: white;
- margin-right: 5px;
-}
-
-.animeEntry {
- display: flex;
- overflow-x: auto;
- margin: 0 0 1rem 0.5rem;
-}
-
-.animeEntry:hover .anime {
- opacity: 0.5;
-}
-
-.animeEntry:hover .anime:hover {
- opacity: 1;
- background-color: #292929;
-}
-
-.animeEntry::-webkit-scrollbar {
- height: 5px;
-}
-
-.animeEntry::-webkit-scrollbar-track {
- background-color: #636363;
- border-radius: 5px;
-}
-
-.animeEntry::-webkit-scrollbar-thumb {
- background-color: rgba(196, 196, 196, 0.692);
- border-radius: 5px;
-}
-
-.anime {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 5px;
- margin: 0 10px 0 0;
- border-radius: 0.5rem;
- transition: opacity 200ms ease-in, background-color 200ms linear;
- background-color: #242424d0;
-}
-
-.anime p {
- color: white;
- width: 20dvw;
- font-size: 18px;
-}
-
-.animeImage {
- border-radius: 0.5rem;
-}
-
-@media screen and (max-width: 768px) {
- .searchContainer {
- width: 100%;
- }
-
- .anime p {
- width: 50dvw;
- }
-}
\ No newline at end of file |