estatesfunding/ef-ui/src/components/Dashboard.jsx

159 lines
5.5 KiB
React
Raw Normal View History

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-10-25 15:40:40 +00:00
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 />;
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 />
2024-10-25 15:40:40 +00:00
<br /> <br /> <br /> <br /> <br />
<div className="d-flex" style={{ margin: "0", padding: "0" }}>
2024-09-11 17:14:28 +00:00
{/* Left sidebar */}
2024-10-25 15:40:40 +00:00
<div className="col-md-3 p-1" style={{ paddingRight: "2px", margin: "0" }}>
2024-09-11 17:14:28 +00:00
<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={{
2024-10-25 15:40:40 +00:00
maxWidth: "250px",
maxHeight: "250px",
2024-09-11 17:14:28 +00:00
}}
/>
<hr className="hline" />
<div className="d-flex flex-column align-items-center">
<button
className={`btn ${activeTab === "dashboard" ? "active" : ""}`}
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>
</div>
</div>
</div>
2024-09-06 15:02:20 +00:00
2024-09-11 17:14:28 +00:00
{/* Main content area */}
2024-10-25 15:40:40 +00:00
<div className="col-md-9 p-1" style={{ paddingLeft: "2px", margin: "0" }}>
<div className="card card2 p-2">
2024-09-30 15:39:00 +00:00
<span>
2024-10-25 15:40:40 +00:00
<br />
2024-09-30 15:39:00 +00:00
Welcome to{" "}
<span style={{ color: "#067ADC" }}>
2024-10-25 05:34:27 +00:00
<NavLink
to={`/profile/${user.result.userId}`}
className="link-primary text-decoration-none"
>
{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>
2024-10-25 15:40:40 +00:00
{activeTab === "dashboard" && (
<>
<br />
<div className="banner_taital">
2024-10-25 05:34:27 +00:00
<h1 style={{ color: "#fda417", fontSize: "30px",
padding: "10px",
fontWeight: "normal" }} className="services_taital">
Now you are accessing the world's only portal which has Streamlined the
<h1 style={{ fontSize: "30px",
padding: "10px",
fontWeight: "normal" }}> investor-borrower interactions, </h1>
</h1>
<h1 className="services_taital" style={{color: "#fda417",fontSize: "30px",
padding: "10px",
fontWeight: "normal" }} >
gaining complete visibility
into your data, and using smart filters to
<h1 className="services_taital" style={{fontSize: "30px",
padding: "10px",
fontWeight: "normal" }} >create automatic
workflows{" "}</h1>
</h1>
2024-10-25 15:40:40 +00:00
<br /> <br /> <br /> <br /> <br /><br />
2024-10-25 05:34:27 +00:00
</div>
2024-10-25 15:40:40 +00:00
</>
)}
2024-09-30 15:39:00 +00:00
<br />
{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;