From 8d83789b76ba9c78ebd5f4e0afb616369dcb15cd Mon Sep 17 00:00:00 2001 From: pravinsyadav Date: Mon, 20 Jan 2025 14:21:38 +0530 Subject: [PATCH 1/3] changes made in sidenavbar --- src/Components/TopNavbar.jsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Components/TopNavbar.jsx b/src/Components/TopNavbar.jsx index efc3ceb..ffacc06 100644 --- a/src/Components/TopNavbar.jsx +++ b/src/Components/TopNavbar.jsx @@ -26,23 +26,22 @@ const TopNavbar = () => { const isAdmin = localStorage.getItem("isAdmin") === "true"; const availableRoutes = [ + // Protected User Routes + { path: "/", label: "Home", public: false }, + { path: "/your-profile", label: "Profile", public: false }, + { path: "/reports", label: "Reports", public: false }, + { path: "/projects", label: "Projects", public: false }, + + // Public Routes - { path: "/login", label: "Login", public: true }, - { path: "/signup", label: "Sign Up", public: true }, + { path: "/frequently-asked-questions", label: "FAQ", public: true }, { path: "/aboutus", label: "About Us", public: true }, { path: "/privacypolicy", label: "Privacy Policy", public: true }, - { path: "/frequently-asked-questions", label: "FAQ", public: true }, // Protected User Routes - { path: "/", label: "Home", public: false }, - { path: "/dashboard", label: "Dashboard", public: false }, - { path: "/your-profile", label: "Profile", public: false }, { path: "/notifications", label: "Notifications", public: false }, - { path: "/reports", label: "Reports", public: false }, - { path: "/projects", label: "Projects", public: false }, { path: "/help", label: "Help", public: false }, { path: "/my-attendance", label: "My Attendance", public: false }, - { path: "/stores", label: "Stores", public: false }, { path: "/leave-application", label: "Leave Application", public: false }, { path: "/setting", label: "Settings", public: false }, @@ -144,7 +143,6 @@ const TopNavbar = () => { {/* Desktop Header */}
-
@@ -153,7 +151,6 @@ const TopNavbar = () => {
-
From 4fee03753b92cfcdb33d5425b6b809c3ce0339a1 Mon Sep 17 00:00:00 2001 From: pravinsyadav Date: Mon, 20 Jan 2025 14:41:33 +0530 Subject: [PATCH 2/3] added ui to show remaining time of intern --- src/Admin/AdminInternTime.jsx | 170 ++++++++++++++++++++++++++++++++++ src/App.jsx | 12 ++- src/Pages/pageIndex.js | 4 +- 3 files changed, 183 insertions(+), 3 deletions(-) create mode 100644 src/Admin/AdminInternTime.jsx diff --git a/src/Admin/AdminInternTime.jsx b/src/Admin/AdminInternTime.jsx new file mode 100644 index 0000000..6eacac5 --- /dev/null +++ b/src/Admin/AdminInternTime.jsx @@ -0,0 +1,170 @@ +"use client"; + +import { useState } from "react"; +import { Button } from "@/Components/ui/button"; +import { Card } from "@/Components/ui/card"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/Components/ui/select"; +import { Clock, Calendar } from "lucide-react"; + +const interns = [ + { + name: "Alice Johnson", + department: "Engineering", + startDate: "2023-01-01", + endDate: "2023-06-30", + progress: "100", + }, + { + name: "Bob Smith", + department: "Marketing", + startDate: "2023-03-15", + endDate: "2023-09-15", + progress: "75", + }, + { + name: "Charlie Brown", + department: "Design", + startDate: "2023-02-01", + endDate: "2023-08-01", + progress: "50", + }, + { + name: "Diana Prince", + department: "Engineering", + startDate: "2023-01-01", + endDate: "2023-06-30", + progress: "100", + }, + { + name: "Ethan Hunt", + department: "HR", + startDate: "2023-01-01", + endDate: "2023-06-30", + progress: "90", + }, +]; + +function calculateRemainingTime(startDate, endDate) { + const today = new Date(); + const end = new Date(endDate); + const timeDiff = Math.max(end - today, 0); + const daysRemaining = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); + return daysRemaining > 0 + ? `${daysRemaining} days remaining` + : "Internship Completed"; +} + +export default function AdminInternTime() { + const [remainingTimes, setRemainingTimes] = useState({}); + + const handleToggleRemainingTime = (internName) => { + setRemainingTimes((prev) => ({ + ...prev, + [internName]: !prev[internName], + })); + }; + + return ( +
+ {/* Header Section */} +
+

+ Intern Progress Tracker +

+
+ + Total Interns: {interns.length} + +
+
+ + {/* Department Filter */} +
+ +
+ + {/* Interns Grid */} +
+ {interns.map((intern) => ( + + {/* Intern Info */} +
+
+

+ {intern.name} +

+

+ {intern.department} +

+
+ +
+ + {/* Internship Details */} +
handleToggleRemainingTime(intern.name)} + > +
+ + + Remaining Time + +
+ {remainingTimes[intern.name] && ( +

+ {calculateRemainingTime(intern.startDate, intern.endDate)} +

+ )} +
+ + {/* Progress and Duration */} +
+
+ + + Progress: {intern.progress}% + +
+
+
+
+
+ Duration: {intern.startDate} to {intern.endDate} +
+
+
+ ))} +
+
+ ); +} diff --git a/src/App.jsx b/src/App.jsx index 141f5b9..ffc20b9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -42,6 +42,7 @@ import "./App.css"; import { NotFound } from "./Components/Notfound"; import { useAuthContext } from "./context/AuthContext"; import AllAttendance from "./Admin/AllAttendance"; +import AdminInternTime from "./Admin/AdminInternTime"; const AdminRoute = ({ children }) => { const isAdmin = localStorage.getItem("isAdmin") === "true"; @@ -272,11 +273,18 @@ const App = () => { path="/help-request" element={ - + + + } + /> + + } /> - ); }; diff --git a/src/Pages/pageIndex.js b/src/Pages/pageIndex.js index 373924e..4c91a13 100644 --- a/src/Pages/pageIndex.js +++ b/src/Pages/pageIndex.js @@ -34,7 +34,9 @@ import Internleaveapplication from "@/Admin/InternLeaveApplications"; import IntroPage from "./IntroPage"; import AdminNotify from "@/Admin/AdminNotify"; import HarassmentEmailForm from "@/Components/HarassmentEmailForm"; +import AdminInternTime from "@/Admin/AdminInternTime"; -export { Home, Notifications, HarassmentEmailForm, Settings, AdminNotify, IntroPage, ResetPassword, Reports, UserAttendance, NotAuthorized, Projects, FAQ, SettingsPage, Categories, Dashboard, Stores, Signin, SignUp, Logout, Profile, Aboutus, CustomNavbar, AdminHomePage, AdminProject, AdminTask, AdminReport, PrivacyPolicy, Help, AllUsers, AdminHelpPage, InternAttendance, AdminHelp, InternTasksSubmissions, LeaveApplication, Internleaveapplication } + +export { Home, Notifications, HarassmentEmailForm, Settings, AdminNotify, IntroPage, ResetPassword, Reports, UserAttendance, NotAuthorized, Projects, FAQ, SettingsPage, Categories, Dashboard, Stores, Signin, SignUp, Logout, Profile, Aboutus, CustomNavbar, AdminHomePage, AdminProject, AdminTask, AdminReport, PrivacyPolicy, Help, AllUsers, AdminHelpPage, InternAttendance, AdminHelp, InternTasksSubmissions, LeaveApplication, Internleaveapplication, AdminInternTime } From 38ed32e396921981fa64f9694d86752c7662a5d7 Mon Sep 17 00:00:00 2001 From: pravinsyadav Date: Sat, 25 Jan 2025 19:16:51 +0530 Subject: [PATCH 3/3] edited intern time ui --- src/Admin/AdminInternTime.jsx | 92 +++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/src/Admin/AdminInternTime.jsx b/src/Admin/AdminInternTime.jsx index 6eacac5..f16724b 100644 --- a/src/Admin/AdminInternTime.jsx +++ b/src/Admin/AdminInternTime.jsx @@ -10,7 +10,7 @@ import { SelectTrigger, SelectValue, } from "@/Components/ui/select"; -import { Clock, Calendar } from "lucide-react"; +import { Clock, Calendar, Filter } from "lucide-react"; const interns = [ { @@ -62,6 +62,7 @@ function calculateRemainingTime(startDate, endDate) { export default function AdminInternTime() { const [remainingTimes, setRemainingTimes] = useState({}); + const [selectedDepartment, setSelectedDepartment] = useState("all"); const handleToggleRemainingTime = (internName) => { setRemainingTimes((prev) => ({ @@ -70,57 +71,68 @@ export default function AdminInternTime() { })); }; + const filteredInterns = + selectedDepartment === "all" + ? interns + : interns.filter( + (intern) => + intern.department.toLowerCase() === selectedDepartment.toLowerCase() + ); + return ( -
- {/* Header Section */} -
-

+
+ {/* Header */} +
+

Intern Progress Tracker

-
- - Total Interns: {interns.length} - -
+ + Total Interns: {filteredInterns.length} +
- {/* Department Filter */} -
- + - - All Departments - Engineering - Marketing - Design - HR + + + + All Departments + + Engineering + Marketing + Design + HR
{/* Interns Grid */}
- {interns.map((intern) => ( + {filteredInterns.map((intern) => ( {/* Intern Info */} -
+
-

+

{intern.name}

-

- {intern.department} -

+

{intern.department}

@@ -128,37 +140,35 @@ export default function AdminInternTime() { {/* Internship Details */}
handleToggleRemainingTime(intern.name)} >
- + Remaining Time
{remainingTimes[intern.name] && ( -

+

{calculateRemainingTime(intern.startDate, intern.endDate)}

)}
- {/* Progress and Duration */} -
-
- - - Progress: {intern.progress}% - + {/* Progress Section */} +
+
+ + Progress: {intern.progress}%
-
+
Duration: {intern.startDate} to {intern.endDate}