2024-09-16 15:03:26 +00:00
|
|
|
import { useState } from "react";
|
2024-09-06 15:02:20 +00:00
|
|
|
import Footer from "./Footer";
|
|
|
|
import Navbar from "./Navbar";
|
2024-09-11 17:14:28 +00:00
|
|
|
import profilepic from "../img/samplepic.jpg";
|
|
|
|
import Addproperty from "./Addproperty";
|
2024-09-16 15:03:26 +00:00
|
|
|
import UserProperties from "./UserProperties";
|
2024-09-11 17:14:28 +00:00
|
|
|
import "../dashboard.css";
|
2024-09-30 15:39:00 +00:00
|
|
|
import { useSelector } from "react-redux";
|
|
|
|
import UserProfile from "./UserProfile";
|
|
|
|
import { NavLink } from "react-router-dom";
|
|
|
|
|
2024-09-06 15:02:20 +00:00
|
|
|
const Dashboard = () => {
|
2024-09-11 17:14:28 +00:00
|
|
|
const [activeTab, setActiveTab] = useState("dashboard");
|
2024-09-30 15:39:00 +00:00
|
|
|
const { user } = useSelector((state) => state.auth);
|
2024-09-11 17:14:28 +00:00
|
|
|
const renderTabContent = () => {
|
|
|
|
switch (activeTab) {
|
2024-09-30 15:39:00 +00:00
|
|
|
case "Userdetails":
|
|
|
|
return <UserProfile />;
|
|
|
|
|
2024-09-11 17:14:28 +00:00
|
|
|
case "addProperty":
|
|
|
|
return <Addproperty />;
|
2024-09-30 15:39:00 +00:00
|
|
|
|
2024-09-11 17:14:28 +00:00
|
|
|
case "activeProperties":
|
|
|
|
return (
|
2024-09-30 15:39:00 +00:00
|
|
|
<div>
|
|
|
|
<h3>Active Properties</h3>
|
|
|
|
<UserProperties />
|
2024-09-11 17:14:28 +00:00
|
|
|
</div>
|
|
|
|
);
|
2024-09-30 15:39:00 +00:00
|
|
|
case "closedProperties":
|
|
|
|
return <p>These are your closed properties.</p>;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return <></>;
|
2024-09-11 17:14:28 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Navbar />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<div className="d-flex flex-row">
|
|
|
|
{/* Left sidebar */}
|
|
|
|
<div className="col-md-3">
|
|
|
|
<div className="card card1 p-5">
|
|
|
|
<img
|
|
|
|
className="img-fluid"
|
2024-09-30 15:39:00 +00:00
|
|
|
src={user.result.profileImage || profilepic}
|
2024-09-11 17:14:28 +00:00
|
|
|
alt="ProfileImage"
|
|
|
|
style={{
|
|
|
|
marginTop: "0px",
|
|
|
|
maxWidth: "200px",
|
|
|
|
maxHeight: "200px",
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<hr className="hline" />
|
|
|
|
<div className="d-flex flex-column align-items-center">
|
|
|
|
<button
|
|
|
|
className={`btn ${activeTab === "dashboard" ? "active" : ""}`}
|
|
|
|
// style={{ backgroundColor: "#fda417", border: "#fda417" }}
|
|
|
|
onClick={() => setActiveTab("dashboard")}
|
|
|
|
>
|
|
|
|
<i className="fa fa-dashboard" style={{ color: "#F74B02" }} />
|
|
|
|
<span>Dashboard</span>
|
|
|
|
</button>
|
2024-09-30 15:39:00 +00:00
|
|
|
|
2024-09-11 17:14:28 +00:00
|
|
|
<button
|
2024-09-30 15:39:00 +00:00
|
|
|
className={`btn mt-3 ${
|
|
|
|
activeTab === "Userdetails" ? "active" : ""
|
|
|
|
}`}
|
|
|
|
onClick={() => setActiveTab("Userdetails")}
|
|
|
|
>
|
|
|
|
<span className="fa fa-home" style={{ color: "#F74B02" }} />
|
|
|
|
<span>User Profile</span>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button
|
|
|
|
className={`btn mt-3 ${
|
|
|
|
activeTab === "addProperty" ? "active" : ""
|
|
|
|
}`}
|
2024-09-11 17:14:28 +00:00
|
|
|
onClick={() => setActiveTab("addProperty")}
|
|
|
|
>
|
2024-09-11 17:22:23 +00:00
|
|
|
<span className="fa fa-home" style={{ color: "#F74B02" }} />
|
2024-09-11 17:14:28 +00:00
|
|
|
<span>Add Property</span>
|
|
|
|
</button>
|
|
|
|
<button
|
2024-09-30 15:39:00 +00:00
|
|
|
className={`btn mt-3 ${
|
|
|
|
activeTab === "activeProperties" ? "active" : ""
|
|
|
|
}`}
|
2024-09-11 17:14:28 +00:00
|
|
|
onClick={() => setActiveTab("activeProperties")}
|
|
|
|
>
|
2024-09-11 17:22:23 +00:00
|
|
|
<span className="fa fa-home" style={{ color: "#F74B02" }} />
|
2024-09-11 17:14:28 +00:00
|
|
|
<span>Active Properties</span>
|
|
|
|
</button>
|
|
|
|
<button
|
2024-09-30 15:39:00 +00:00
|
|
|
className={`btn mt-3 ${
|
|
|
|
activeTab === "closedProperties" ? "active" : ""
|
|
|
|
}`}
|
2024-09-11 17:14:28 +00:00
|
|
|
onClick={() => setActiveTab("closedProperties")}
|
|
|
|
>
|
2024-09-11 17:22:23 +00:00
|
|
|
<span className="fa fa-home" style={{ color: "#F74B02" }} />
|
2024-09-11 17:14:28 +00:00
|
|
|
<span>Closed Properties</span>
|
|
|
|
</button>
|
|
|
|
{/* <span className="other mt-4">Other Information</span>
|
|
|
|
<button className="btn mt-3">
|
|
|
|
<i className="fa fa-book" />
|
|
|
|
<span>Knowledge</span>
|
|
|
|
</button> */}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-09-06 15:02:20 +00:00
|
|
|
|
2024-09-11 17:14:28 +00:00
|
|
|
{/* Main content area */}
|
|
|
|
<div className="col-md-9">
|
2024-09-22 14:00:31 +00:00
|
|
|
<div className="card card2 p-1">
|
2024-09-11 17:14:28 +00:00
|
|
|
{/* Static Dashboard greeting */}
|
2024-09-30 15:39:00 +00:00
|
|
|
<br />
|
|
|
|
<span>
|
|
|
|
Welcome to{" "}
|
|
|
|
<span style={{ color: "#067ADC" }}>
|
|
|
|
|
|
|
|
|
|
|
|
<NavLink
|
|
|
|
to={`/profile/${user.result.userId}`}
|
|
|
|
className="link-primary text-decoration-none"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
{user.result.title}. {user.result.firstName}{" "}
|
|
|
|
{user.result.middleName} {user.result.lastName}
|
|
|
|
</NavLink>
|
|
|
|
|
2024-09-11 17:14:28 +00:00
|
|
|
</span>
|
2024-09-30 15:39:00 +00:00
|
|
|
</span>
|
|
|
|
<br />
|
2024-09-11 17:14:28 +00:00
|
|
|
|
|
|
|
{/* Dynamic content based on the selected tab */}
|
2024-09-30 15:39:00 +00:00
|
|
|
|
|
|
|
{renderTabContent()}
|
2024-09-11 17:14:28 +00:00
|
|
|
</div>
|
2024-09-06 16:40:57 +00:00
|
|
|
</div>
|
2024-09-11 17:14:28 +00:00
|
|
|
</div>
|
|
|
|
<Footer />
|
|
|
|
</>
|
|
|
|
);
|
2024-09-06 15:02:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Dashboard;
|