import { useState,useEffect } from "react";
import Footer from "./Footer";
import Navbar from "./Navbar";
import { useSelector, useDispatch } from "react-redux";
import profilepic from "../img/samplepic.jpg";
import Addproperty from "./Addproperty";
import { fetchUserProperties } from "../redux/features/propertySlice";
import "../dashboard.css";
const Dashboard = () => {
const dispatch = useDispatch();
const { user } = useSelector((state) => ({ ...state.auth }));
const { userProperties} = useSelector((state) => state.property);
const [activeTab, setActiveTab] = useState("dashboard");
// Fetch user properties when "Active Properties" tab is selected
useEffect(() => {
if (activeTab === "activeProperties") {
dispatch(fetchUserProperties(user?.result?.userId));
}
}, [activeTab, dispatch, user?.result?.userId]);
const renderTabContent = () => {
switch (activeTab) {
case "addProperty":
return
No active properties found.
)}These are your closed properties.
; default: return (