aboutsummaryrefslogtreecommitdiff
path: root/src/app/search/components
diff options
context:
space:
mode:
authorreal-zephex <[email protected]>2024-03-21 13:15:44 +0530
committerreal-zephex <[email protected]>2024-03-21 13:15:44 +0530
commit2f333479353864e9a5965459296bf8288592f1db (patch)
treedc537000fce3d217fd891836588028d9c33352bc /src/app/search/components
parentfixes: anime section is fully server rendered, added a loading screen for inf... (diff)
downloaddramalama-2f333479353864e9a5965459296bf8288592f1db.tar.xz
dramalama-2f333479353864e9a5965459296bf8288592f1db.zip
fixes: minor performance improvements
Diffstat (limited to 'src/app/search/components')
-rw-r--r--src/app/search/components/fetchInfo.js14
-rw-r--r--src/app/search/components/fetchedInfo.js44
2 files changed, 58 insertions, 0 deletions
diff --git a/src/app/search/components/fetchInfo.js b/src/app/search/components/fetchInfo.js
new file mode 100644
index 0000000..f843dff
--- /dev/null
+++ b/src/app/search/components/fetchInfo.js
@@ -0,0 +1,14 @@
+"use server";
+
+export default async function Results(id) {
+ return await testFunction(id);
+}
+
+async function testFunction(title) {
+ const res = await fetch(
+ "https://dramalama-api.vercel.app/anime/gogoanime/" + title,
+ { cache: "force-cache" }
+ );
+ const data = await res.json();
+ return data;
+}
diff --git a/src/app/search/components/fetchedInfo.js b/src/app/search/components/fetchedInfo.js
new file mode 100644
index 0000000..aa03437
--- /dev/null
+++ b/src/app/search/components/fetchedInfo.js
@@ -0,0 +1,44 @@
+import "../search.css";
+import Link from "next/link";
+import Image from "next/image";
+
+export default async function fetchedInfo(data) {
+ return (
+ <div className="animeEntry">
+ {data ? (
+ data.results && data.results.length > 0 ? (
+ data.results.map((item, index) => (
+ <Link
+ key={index}
+ href={`/info/${item.id}`}
+ style={{ textDecoration: "none" }}
+ >
+ <div className="anime">
+ <p>{item.title}</p>
+ <Image
+ src={item.image}
+ className="animeImage"
+ width={120}
+ height={160}
+ alt="Drama Poster"
+ />
+ </div>
+ </Link>
+ ))
+ ) : (
+ <div style={{ margin: "0px auto" }}>
+ <p
+ style={{
+ color: "white",
+ fontFamily: "Kanit",
+ fontSize: 18,
+ }}
+ >
+ No results found
+ </p>
+ </div>
+ )
+ ) : null}
+ </div>
+ );
+}