+
{
- setShow(true);
- }}
+ aria-label="Search Term"
/>
-
- {/* Loading Indicator */}
- {isLoading && show && (
-
- {t("loading")} {/* Use translation for loading text */}
-
- )}
-
- {/* Error Message */}
- {error && show && (
-
{error}
- )}
-
- {/* Search Results */}
- {results.length > 0 && show && (
-
- {results.map((dua) => (
- - openDua(dua)}
- key={dua.id}
- className="px-4 py-2 hover:bg-gray-100 cursor-pointer"
- >
- {dua.title}
-
- ))}
-
- )}
);
};
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 2f8233d..7f2d42d 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -1,6 +1,7 @@
import DefaultSeo from "@/components/common/default-seo";
import { AudioProvider } from "@/components/context/audio-conext";
import { FontSettingsProvider } from "@/components/context/font-setting-context";
+import { SearchProvider } from "@/components/context/search-context";
import { UIProvider } from "@/components/context/ui.context";
import Header from "@/components/layout/header";
import MobileHeader from "@/components/layout/mobile-header";
@@ -23,24 +24,26 @@ function App({ Component, pageProps }: AppProps) {
-
-
- {" "}
- {/* Apply rtl class if the language is RTL */}
-
-
-
-
-
-
-
-
+
+
+
+ {" "}
+ {/* Apply rtl class if the language is RTL */}
+
+
+
-
-
+
-
-
+
diff --git a/src/pages/duas/[slug].tsx b/src/pages/duas/[slug].tsx
index b27d615..becb6b8 100644
--- a/src/pages/duas/[slug].tsx
+++ b/src/pages/duas/[slug].tsx
@@ -96,8 +96,9 @@ const DuaComponent: React.FC
= ({
// Use the memoized fetchData in the effect hook
useEffect(() => {
- setDuaParts([]); // Reset Dua parts when slug changes
- fetchData(false);
+ setDuaParts([]);
+
+ fetchData(false); // Fetch data for the first page
}, [slug]); // Only slug changes should trigger this effect
// Play audio from a specific part
@@ -219,6 +220,8 @@ const DuaComponent: React.FC = ({
}
}, [recitingPart, duaParts]);
+
+
const handleScroll = useCallback(
(e: React.UIEvent) => {
const target = e.currentTarget;
@@ -286,7 +289,7 @@ const DuaComponent: React.FC = ({
padding: "1px",
}}
>
-