Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/modules/admin/pages/AdminDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Doughnut } from "react-chartjs-2";
import "./AdminDashboard.css";
import { AccountCircleOutlined, Folder } from "@mui/icons-material"; // Removed HomeOutlined
import { Col, Row } from "antd";
import AdminHeaderDashboard from "../components/AdminHeaderDashboard";
import AdminSidebarDashboard from "../components/AdminSidebarDashboard"; // Import the sidebar component
import AdminHeaderDashboard from "../../../shared/components/AdminHeaderDashboard";
import AdminSidebarDashboard from "../../../shared/components/AdminSidebarDashboard"; // Import the sidebar component
import React, { useState } from "react";

ChartJS.register(ArcElement, Tooltip, Legend);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/admin/pages/UserManagement.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
body {
background-color: lightblue;
/* */
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
Expand Down
4 changes: 2 additions & 2 deletions src/modules/auth/pages/Login.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
padding: 0;
margin: 0;
box-sizing: border-box;
overflow: hidden;

}

.login-page {

overflow: hidden;
}

.login-left {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/auth/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Login = () => {
const user = {
email: values.email,
password: values.password,
role: Role.ADMIN,
role: Role.USER,
};
setRole(user.role);
console.log(role);
Expand Down
119 changes: 63 additions & 56 deletions src/modules/users/pages/user-dashboard/UserDashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,71 @@
import React from "react";
import { Tabs } from "antd";
import React, { useState } from "react";


import UserSidebarDashboardProps from "../../../../shared/components/UserSidebarDashboard";
import AdminHeaderDashboard from "../../../../shared/components/AdminHeaderDashboard";

import Topbar from "../../components/topbar/Topbar";
import HouseIcon from "@mui/icons-material/House";
import BadgeIcon from '@mui/icons-material/Badge';
import RequestPageIcon from '@mui/icons-material/RequestPage';
import User from "./User";
import Home from "./Home";
import RequestPage from "../request/RequestPage";
import AddRequestPage from "../../components/request-comp/AddRequest";

const UserDashboard: React.FC = () => {
const [isSidebarOpen, setIsSidebarOpen] = useState(false);

const toggleSidebar = () => {
setIsSidebarOpen(!isSidebarOpen);
};

return (
<>
<Topbar />
<Tabs
tabPosition="left"
items={[
{
key: "1",
label: (
<span className="tab-item">
<HouseIcon className="Icon"/>
Home
</span>
),
children: <Home />,
},
{
key: "2",
label: (
<span className="tab-item">
<BadgeIcon className="Icon"/>
Profile
</span>
),
children: <User />,
},
{
key: "3",
label: (
<span className="tab-item">
<RequestPageIcon className="Icon"/>
My Request
</span>
),
children: <RequestPage />,
},
{
key: "4",
label: (
<span className="tab-item">
<RequestPageIcon className="Icon"/>
Add request
</span>
),
children: <AddRequestPage />,
},
]}
/>
<AdminHeaderDashboard toggleSidebar={toggleSidebar} />
<UserSidebarDashboardProps isOpen={isSidebarOpen} toggleSidebar={toggleSidebar} />
{/* <Home/> */}
{/* <Tabs tabPosition="left">
<Tabs.TabPane
key="1"
tab={
<span className="tab-item">
<HouseIcon className="Icon" />
Home
</span>
}
>
<Home />
</Tabs.TabPane>

<Tabs.TabPane
key="2"
tab={
<span className="tab-item">
<BadgeIcon className="Icon" />
Profile
</span>
}
>
<User />
</Tabs.TabPane>

<Tabs.TabPane
key="3"
tab={
<span className="tab-item">
<RequestPageIcon className="Icon" />
My Request
</span>
}
>
<RequestPage />
</Tabs.TabPane>

<Tabs.TabPane
key="4"
tab={
<span className="tab-item">
<RequestPageIcon className="Icon" />
Add Request
</span>
}
>
<AddRequestPage />
</Tabs.TabPane>
</Tabs> */}
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function AdminSidebarDashboard({ isOpen, toggleSidebar }: AdminSi
onClick={toggleSidebar}
onKeyDown={toggleSidebar}
>

<List>
{['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => (
<ListItem key={text} disablePadding>
Expand All @@ -49,6 +50,7 @@ export default function AdminSidebarDashboard({ isOpen, toggleSidebar }: AdminSi
))}
</List>
</Box>

);

return (
Expand Down
64 changes: 64 additions & 0 deletions src/shared/components/UserSidebarDashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import * as React from 'react';
import { useState } from 'react';
import Box from '@mui/material/Box';
import Drawer from '@mui/material/Drawer';
import List from '@mui/material/List';
import Divider from '@mui/material/Divider';
import ListItem from '@mui/material/ListItem';
import ListItemButton from '@mui/material/ListItemButton';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import HouseIcon from "@mui/icons-material/House";
import BadgeIcon from "@mui/icons-material/Badge";
import RequestPageIcon from "@mui/icons-material/RequestPage";
import Home from '../../modules/users/pages/user-dashboard/Home';
import User from '../../modules/users/pages/user-dashboard/User';
import RequestPage from '../../modules/users/pages/request/RequestPage';
import AddRequestPage from '../../modules/users/components/request-comp/AddRequest';



interface UserSidebarDashboardProps {
isOpen: boolean;
toggleSidebar: () => void;
}

export default function UserSidebarDashboard({ isOpen, toggleSidebar }: UserSidebarDashboardProps) {
const [selectedTab, setSelectedTab] = useState("Home");

const menuItems = [
{ text: "Home", icon: <HouseIcon /> },
{ text: "Profile", icon: <BadgeIcon /> },
{ text: "My Requests", icon: <RequestPageIcon /> },
{ text: "Add Request", icon: <RequestPageIcon /> },
];

return (
<>
{/* <AdminHeaderDashboard toggleSidebar={toggleSidebar} /> */}
<Drawer open={isOpen} onClose={toggleSidebar}>
<Box sx={{ width: 250 }} role="presentation">
<List>
{menuItems.map(({ text, icon }) => (
<ListItem key={text} disablePadding>
<ListItemButton onClick={() => setSelectedTab(text)}>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={text} />
</ListItemButton>
</ListItem>
))}
</List>
<Divider />
</Box>
</Drawer>

{/* Render selected content */}
<Box sx={{ padding: 2 }}>
{selectedTab === "Home" && <Home />}
{selectedTab === "Profile" && <User />}
{selectedTab === "My Requests" && <RequestPage />}
{selectedTab === "Add Request" && <AddRequestPage />}
</Box>
</>
);
}