diff --git a/apps/web-dashboard/src/components/Layout/BackToTop.jsx b/apps/web-dashboard/src/components/Layout/BackToTop.jsx
new file mode 100644
index 000000000..cd298b5f9
--- /dev/null
+++ b/apps/web-dashboard/src/components/Layout/BackToTop.jsx
@@ -0,0 +1,72 @@
+import { useState, useEffect } from 'react';
+import { ArrowUp } from 'lucide-react';
+
+function BackToTop() {
+ const [isVisible, setIsVisible] = useState(false);
+ const [isHovered, setIsHovered] = useState(false);
+
+ useEffect(() => {
+ let ticking = false;
+
+ const handleScroll = () => {
+ if (!ticking) {
+ window.requestAnimationFrame(() => {
+ setIsVisible(window.scrollY > 300);
+ ticking = false;
+ });
+ ticking = true;
+ }
+ };
+
+ window.addEventListener('scroll', handleScroll);
+ handleScroll();
+
+ return () => {
+ window.removeEventListener('scroll', handleScroll);
+ };
+ }, []);
+
+ const handleClick = () => {
+ window.scrollTo({
+ top: 0,
+ behavior: 'smooth'
+ });
+ };
+
+ if (!isVisible) {
+ return null;
+ }
+
+ return (
+
+ );
+}
+
+export default BackToTop;
\ No newline at end of file
diff --git a/apps/web-dashboard/src/components/Layout/MainLayout.jsx b/apps/web-dashboard/src/components/Layout/MainLayout.jsx
index c4139efa4..a16bcc5c9 100644
--- a/apps/web-dashboard/src/components/Layout/MainLayout.jsx
+++ b/apps/web-dashboard/src/components/Layout/MainLayout.jsx
@@ -4,7 +4,7 @@ import Sidebar from './Sidebar';
import Header from './Header';
import ProjectNavbar from './ProjectNavbar';
import { useLayout } from '../../context/LayoutContext';
-
+import BackToTop from './BackToTop';
// Use the new official logo from public directory
const logoImage = "https://cdn.jsdelivr.net/gh/yash-pouranik/urBackend@main/frontend/public/logo.png";
@@ -68,6 +68,7 @@ function MainLayout({ children }) {
{children}
+
);
}
diff --git a/apps/web-dashboard/src/pages/LandingPage/index.jsx b/apps/web-dashboard/src/pages/LandingPage/index.jsx
index 2d91cccba..55094e8f9 100644
--- a/apps/web-dashboard/src/pages/LandingPage/index.jsx
+++ b/apps/web-dashboard/src/pages/LandingPage/index.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useRef, useCallback } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { useAuth } from '../../context/AuthContext';
-
+import BackToTop from '../../components/Layout/BackToTop';
import {
Database,
Shield,
@@ -907,6 +907,7 @@ function LandingPage() {
+
);
}