import { useEffect, useState } from "react"; import { NavLink } from "react-router-dom"; import { useNavigate } from "react-router-dom"; import { getProperties } from "../../redux/features/propertySlice"; import { useSelector, useDispatch } from "react-redux"; import UserProperties from "./UserProperties"; const AdminDashboard = () => { const dispatch = useDispatch(); const navigate = useNavigate(); const { properties } = useSelector((state) => state.property); // Set pagination state const page = 1; const limit = 10; // Number of results per page const keyword = ""; // State to track selected tab const [selectedTab, setSelectedTab] = useState("dashboard"); useEffect(() => { dispatch(getProperties({ page, limit, keyword })); }, [dispatch, page, keyword]); console.log("properties", properties); const renderContent = () => { switch (selectedTab) { case "activeUsers": return
Active Users Content
; case "inactiveUsers": return
Inactive Users Content
; case "addProperty": return
Add Property Content
; case "userProperties": return
; case "adminProperties": return
Admin Properties Content
; default: return (
Welcome to the Dashboard
{/* Content Row */}
{/* Earnings (Monthly) Card Example */}
Total Users
40,000,000
{/* Earnings (Monthly) Card Example */}
Total payments
$215,000
{/* Earnings (Monthly) Card Example */}
Total Properties
50,000
{/* Pending Requests Card Example */}
Pending Inquires
18
{/* Content Row */}
{/* Area Chart */}
{/* Content Row */}
); } }; const handleLogout = () => { localStorage.removeItem("token"); navigate("/AdminPLogin"); }; return ( <>
{/* Page Wrapper */}
{/* Sidebar */}
    {/* Sidebar - Brand */}
    Admin EL

  • setSelectedTab("dashboard")} className="nav-link link-primary text-decoration-none" > Dashboard

  • Interface
  • Users
    Registered Users:
    setSelectedTab("activeUsers")} className="collapse-item link-primary text-decoration-none" > Active Users setSelectedTab("inactiveUsers")} className="collapse-item link-primary text-decoration-none" > Inactive Users
  • Properties
    Details:
    setSelectedTab("addProperty")} className="collapse-item link-primary text-decoration-none" > Add Property setSelectedTab("userProperties")} className="collapse-item link-primary text-decoration-none" > User Properties setSelectedTab("adminProperties")} className="collapse-item link-primary text-decoration-none" > Admin Properties

  • Addons
  • setSelectedTab("admin")} className="nav-link link-primary text-decoration-none" > Admin

  • { e.preventDefault(); // Prevent the default link behavior handleLogout(); }} className="nav-link link-primary text-decoration-none" > Logout
{/* End of Sidebar */} {/* Content Wrapper */}
{/* Main Content */}
{renderContent()}
{/* End of Content Wrapper */}
{/* End of Page Wrapper */}
); }; export default AdminDashboard;