+
{/* Animated Background Elements */}
{/* Remove animated background blobs */}
diff --git a/client/src/Pages/Tutorial.jsx b/client/src/Pages/Tutorial.jsx
index b8d74d2..bb0d2a8 100644
--- a/client/src/Pages/Tutorial.jsx
+++ b/client/src/Pages/Tutorial.jsx
@@ -24,69 +24,61 @@ const Tutorial = () => {
{ name: "Appliances", query: "home appliance repair" },
];
- useEffect(() => {
- const storedSearchHistory = localStorage.getItem("searchHistory");
- const storedRecentlyViewed = localStorage.getItem("recentlyViewed");
- const storedBookmarkedTutorials = localStorage.getItem(
- "refixly_savedTutorials"
+useEffect(() => {
+ const storedSearchHistory = localStorage.getItem("searchHistory");
+ const storedRecentlyViewed = localStorage.getItem("recentlyViewed");
+ const storedBookmarkedTutorials = localStorage.getItem("refixly_savedTutorials");
+
+ if (storedSearchHistory) setSearchHistory(JSON.parse(storedSearchHistory));
+ if (storedRecentlyViewed) setRecentlyViewed(JSON.parse(storedRecentlyViewed));
+ if (storedBookmarkedTutorials) setBookmarkedTutorials(JSON.parse(storedBookmarkedTutorials));
+}, []);
+
+useEffect(() => {
+ localStorage.setItem("searchHistory", JSON.stringify(searchHistory));
+}, [searchHistory]);
+
+useEffect(() => {
+ localStorage.setItem("recentlyViewed", JSON.stringify(recentlyViewed));
+}, [recentlyViewed]);
+
+useEffect(() => {
+ localStorage.setItem("refixly_savedTutorials", JSON.stringify(bookmarkedTutorials));
+}, [bookmarkedTutorials]);
+
+const fetchTutorials = useCallback(async (objectName, pageToken = "", append = false) => {
+ if (!objectName.trim()) {
+ setError("Please enter a search term or select a category.");
+ setTutorials([]);
+ setNextPageToken(null);
+ return;
+ }
+ setLoading(true);
+ setError(null);
+ try {
+ const res = await fetch(
+ `https://refixly.onrender.com/api/tutorials/${encodeURIComponent(objectName)}?pageToken=${pageToken}`
);
- if (storedSearchHistory) setSearchHistory(JSON.parse(storedSearchHistory));
- if (storedRecentlyViewed)
- setRecentlyViewed(JSON.parse(storedRecentlyViewed));
- if (storedBookmarkedTutorials)
- setBookmarkedTutorials(JSON.parse(storedBookmarkedTutorials));
- }, [fetchTutorials]);
-
- useEffect(() => {
- localStorage.setItem("searchHistory", JSON.stringify(searchHistory));
- }, [searchHistory]);
-
- useEffect(() => {
- localStorage.setItem("recentlyViewed", JSON.stringify(recentlyViewed));
- }, [recentlyViewed]);
-
- useEffect(() => {
- localStorage.setItem(
- "bookmarkedTutorials",
- JSON.stringify(bookmarkedTutorials)
+ if (!res.ok)
+ throw new Error((await res.json()).message || "Failed to fetch");
+ const data = await res.json();
+ setTutorials((prev) =>
+ append ? [...prev, ...data.tutorials] : data.tutorials
);
- }, [bookmarkedTutorials]);
-
- const fetchTutorials = async (objectName, pageToken = "", append = false) => {
- if (!objectName.trim()) {
- setError("Please enter a search term or select a category.");
- setTutorials([]);
- setNextPageToken(null);
- return;
- }
- setLoading(true);
- setError(null);
- try {
- const res = await fetch(
- `https://refixly.onrender.com/api/tutorials/${encodeURIComponent(
- objectName
- )}?pageToken=${pageToken}`
- );
- if (!res.ok)
- throw new Error((await res.json()).message || "Failed to fetch");
- const data = await res.json();
- setTutorials((prev) =>
- append ? [...prev, ...data.tutorials] : data.tutorials
- );
- setNextPageToken(data.nextPageToken);
- setSearchHistory((prev) =>
- [objectName, ...prev.filter((term) => term !== objectName)].slice(0, 5)
- );
- } catch (e) {
- setError(e.message);
- if (!append) setTutorials([]);
- setNextPageToken(null);
- } finally {
- setLoading(false);
- }
- },
- [setError, setTutorials, setNextPageToken, setSearchHistory]
-);
+ setNextPageToken(data.nextPageToken);
+ setSearchHistory((prev) =>
+ [objectName, ...prev.filter((term) => term !== objectName)].slice(0, 5)
+ );
+ } catch (e) {
+ setError(e.message);
+ if (!append) setTutorials([]);
+ setNextPageToken(null);
+ } finally {
+ setLoading(false);
+ }
+}, [setError, setTutorials, setNextPageToken, setSearchHistory]);
+
+
const handleSearch = (e) => {
e.preventDefault();
diff --git a/client/src/index.css b/client/src/index.css
index 3939072..4805f87 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -4,10 +4,11 @@
body {
@apply overflow-x-hidden;
+
}
html {
- scroll-behavior: smooth;
+ overflow-y: scroll;
}
.glow {
diff --git a/client/src/main.jsx b/client/src/main.jsx
index f66fc31..981fd88 100644
--- a/client/src/main.jsx
+++ b/client/src/main.jsx
@@ -4,7 +4,7 @@ import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import App from './App.jsx';
import './index.css';
-import { ThemeProvider } from './context/ThemeContext.jsx';
+import { ThemeProvider } from './context/ThemeProvider.jsx';
ReactDOM.createRoot(document.getElementById('root')).render(