From 1eee8b5196828128a189d6e9bf889500aadb2308 Mon Sep 17 00:00:00 2001
From: real-zephex <143923795+real-zephex@users.noreply.github.com>
Date: Sun, 7 Apr 2024 13:50:17 +0000
Subject: idek

---
 src/app/kdrama/components/search.jsx | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'src/app/kdrama/components/search.jsx')

diff --git a/src/app/kdrama/components/search.jsx b/src/app/kdrama/components/search.jsx
index 4c9d00c..f9ba174 100644
--- a/src/app/kdrama/components/search.jsx
+++ b/src/app/kdrama/components/search.jsx
@@ -10,11 +10,14 @@ import Link from "next/link";
 export default function DramaSearch() {
 	const [title, setTitle] = useState("");
 	const [infoTitle, setInfoTitle] = useState(null);
+	const [loadingText, setLoadingText] = useState(null);
 
-	async function getSearchResults(title) {
+	const handleSearch = async (title) => {
+		setLoadingText(true);
 		const data = await FetchSearchTitle(title);
+		setLoadingText(false);
 		setInfoTitle(data);
-	}
+	};
 
 	return (
 		<div className={styles.SearchContainer}>
@@ -25,12 +28,16 @@ export default function DramaSearch() {
 					onChange={(event) => setTitle(event.target.value)}
 					onKeyDown={async (e) => {
 						if ((e.key === "Enter" || e.code === 13) && title) {
-							await getSearchResults(e.target.value);
+							await handleSearch(e.target.value);
 						}
 					}}
 				></input>
 			</div>
 
+			{loadingText && (
+				<p className={styles.LoadingText}>Wait a moment...</p>
+			)}
+
 			<div className={styles.SearchResults}>
 				{infoTitle &&
 					infoTitle.results.map((item, index) => (
@@ -42,7 +49,7 @@ export default function DramaSearch() {
 							<div className={styles.SearchEntry}>
 								<p>{item.title}</p>
 								<Image
-									src={item.image}
+									src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=${item.image}`}
 									width={110}
 									height={180}
 									alt="Drama Poster"
-- 
cgit v1.2.3

