11import React , { useEffect , useState } from "react" ;
22import { useDispatch , useSelector } from "react-redux" ;
3- import {
4- setRecentProjects ,
3+ import {
4+ setRecentProjects ,
55 selectRecentProjects ,
66 setMyJobPosts ,
7- selectMyJobPosts
7+ selectMyJobPosts ,
88} from "../../../redux/reducers/dashboard/projectsSlice" ;
99import { selectRole } from "../../../redux/Features/user/authSlice" ;
1010import { selectUserProfile } from "../../../redux/Features/user/ProfileSlice" ;
@@ -31,7 +31,9 @@ const ProjectsSummary = () => {
3131 try {
3232 if ( isFreelancer ) {
3333 try {
34- const projectsResponse = await axiosInstance . get ( "/project/recent-projects" ) ;
34+ const projectsResponse = await axiosInstance . get (
35+ "/project/recent-projects"
36+ ) ;
3537 if ( projectsResponse . data . recentProjects ) {
3638 dispatch ( setRecentProjects ( projectsResponse . data . recentProjects ) ) ;
3739 } else {
@@ -48,7 +50,9 @@ const ProjectsSummary = () => {
4850
4951 if ( isEmployer && userProfile ?. _id ) {
5052 try {
51- const jobsResponse = await axiosInstance . get ( `/jobs/user/${ userProfile . _id } ` ) ;
53+ const jobsResponse = await axiosInstance . get (
54+ `/jobs/user/${ userProfile . _id } `
55+ ) ;
5256 if ( jobsResponse . data . data ) {
5357 dispatch ( setMyJobPosts ( jobsResponse . data . data ) ) ;
5458 } else {
@@ -101,8 +105,9 @@ const ProjectsSummary = () => {
101105 ) ;
102106 }
103107
104- const hasNoData = ( ! isFreelancer || ! projects || projects . length === 0 ) &&
105- ( ! isEmployer || ! myJobPosts || myJobPosts . length === 0 ) ;
108+ const hasNoData =
109+ ( ! isFreelancer || ! projects || projects . length === 0 ) &&
110+ ( ! isEmployer || ! myJobPosts || myJobPosts . length === 0 ) ;
106111
107112 if ( hasNoData ) {
108113 return (
@@ -112,9 +117,9 @@ const ProjectsSummary = () => {
112117 </ h2 >
113118 < div className = "text-gray-400 bg-gray-800/50 p-6 rounded-lg border border-gray-600 text-center" >
114119 < div className = "text-5xl mb-4" > 🎯</ div >
115- { isFreelancer && isEmployer
120+ { isFreelancer && isEmployer
116121 ? "No projects or job posts found. Start bidding on jobs or post new jobs to see them here!"
117- : isFreelancer
122+ : isFreelancer
118123 ? "No projects found. Start bidding on jobs to see them here!"
119124 : "No job posts found. Start posting jobs to see them here!" }
120125 </ div >
@@ -131,28 +136,34 @@ const ProjectsSummary = () => {
131136 </ h3 >
132137 < div className = "grid gap-6" >
133138 { projects . slice ( 0 , 3 ) . map ( ( project ) => (
134- < div key = { project . _id }
135- className = "p-6 bg-gray-800/40 rounded-xl hover:bg-gray-700/40 transition-all duration-300 transform hover:-translate-y-1 border border-gray-600 hover:border-gray-500" >
139+ < div
140+ key = { project . _id }
141+ className = "p-6 bg-gray-800/40 rounded-xl hover:bg-gray-700/40 transition-all duration-300 transform hover:-translate-y-1 border border-gray-600 hover:border-gray-500"
142+ >
136143 < div className = "flex justify-between items-start mb-4" >
137144 < h4 className = "text-xl font-semibold text-white hover:text-blue-400 transition-colors" >
138145 { project . title }
139146 </ h4 >
140- < span className = { `px-4 py-1.5 rounded-full text-sm font-medium ${
141- project . status === "completed"
142- ? "bg-green-900/50 text-green-300 border border-green-700"
143- : "bg-yellow-900/50 text-yellow-300 border border-yellow-700"
144- } `} >
147+ < span
148+ className = { `px-4 py-1.5 rounded-full text-sm font-medium ${
149+ project . status === "completed"
150+ ? "bg-green-900/50 text-green-300 border border-green-700"
151+ : "bg-yellow-900/50 text-yellow-300 border border-yellow-700"
152+ } `}
153+ >
145154 { project . status }
146155 </ span >
147156 </ div >
148- < p className = "text-gray-300 mb-4 line-clamp-2" > { project . description } </ p >
157+ < p className = "text-gray-300 mb-4 line-clamp-2" >
158+ { project . description }
159+ </ p >
149160 < div className = "flex justify-between items-center text-sm" >
150161 < span className = "text-blue-400 bg-blue-900/20 px-3 py-1.5 rounded-full" >
151162 💰 ${ project . budget ?. min } - ${ project . budget ?. max }
152163 </ span >
153- < span className = "text-purple-400 bg-purple-900/20 px-3 py-1.5 rounded-full" >
164+ { /* <span className="text-purple-400 bg-purple-900/20 px-3 py-1.5 rounded-full">
154165 ⏰ Due: {new Date(project.deadline).toLocaleDateString()}
155- </ span >
166+ </span> */ }
156167 </ div >
157168 </ div >
158169 ) ) }
@@ -167,23 +178,29 @@ const ProjectsSummary = () => {
167178 </ h3 >
168179 < div className = "grid gap-6" >
169180 { myJobPosts . slice ( 0 , 3 ) . map ( ( job ) => (
170- < div key = { job . _id }
171- className = "p-6 bg-gray-800/40 rounded-xl hover:bg-gray-700/40 transition-all duration-300 transform hover:-translate-y-1 border border-gray-600 hover:border-gray-500" >
181+ < div
182+ key = { job . _id }
183+ className = "p-6 bg-gray-800/40 rounded-xl hover:bg-gray-700/40 transition-all duration-300 transform hover:-translate-y-1 border border-gray-600 hover:border-gray-500"
184+ >
172185 < div className = "flex justify-between items-start mb-4" >
173186 < h4 className = "text-xl font-semibold text-white hover:text-blue-400 transition-colors" >
174187 { job . title }
175188 </ h4 >
176- < span className = { `px-4 py-1.5 rounded-full text-sm font-medium ${
177- job . status === "completed"
178- ? "bg-green-900/50 text-green-300 border border-green-700"
179- : job . status === "in-progress"
180- ? "bg-blue-900/50 text-blue-300 border border-blue-700"
181- : "bg-yellow-900/50 text-yellow-300 border border-yellow-700"
182- } `} >
189+ < span
190+ className = { `px-4 py-1.5 rounded-full text-sm font-medium ${
191+ job . status === "completed"
192+ ? "bg-green-900/50 text-green-300 border border-green-700"
193+ : job . status === "in-progress"
194+ ? "bg-blue-900/50 text-blue-300 border border-blue-700"
195+ : "bg-yellow-900/50 text-yellow-300 border border-yellow-700"
196+ } `}
197+ >
183198 { job . status }
184199 </ span >
185200 </ div >
186- < p className = "text-gray-300 mb-4 line-clamp-2" > { job . description } </ p >
201+ < p className = "text-gray-300 mb-4 line-clamp-2" >
202+ { job . description }
203+ </ p >
187204 < div className = "flex justify-between items-center text-sm" >
188205 < span className = "text-blue-400 bg-blue-900/20 px-3 py-1.5 rounded-full" >
189206 💰 ${ job . budget ?. min } - ${ job . budget ?. max }
0 commit comments