@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
22import { toast } from 'react-toastify' ;
33import { FaCheck } from 'react-icons/fa' ;
44import { getPromotionEligibility , postPromotionEligibility } from '../../actions/promotionActions' ;
5- import './PromotionEligibility.module.css' ;
5+ import styles from './PromotionEligibility.module.css' ;
66import { useSelector } from 'react-redux' ;
77
88function PromotionEligibility ( { currentUser } ) {
@@ -13,8 +13,7 @@ function PromotionEligibility({ currentUser }) {
1313 const [ selectedForPromotion , setSelectedForPromotion ] = useState ( new Set ( ) ) ;
1414 const [ processing , setProcessing ] = useState ( false ) ;
1515
16- const [ showNew , setShowNew ] = useState ( true ) ;
17- const [ showExisting , setShowExisting ] = useState ( true ) ;
16+ const [ selectGroup , setSelectedGroup ] = useState ( 'new' ) ;
1817
1918 const darkMode = useSelector ( state => state . theme . darkMode ) ;
2019
@@ -45,6 +44,7 @@ function PromotionEligibility({ currentUser }) {
4544
4645 const newMembers = reviewers . filter ( r => r . isNewMember ) ;
4746 const existingMembers = reviewers . filter ( r => ! r . isNewMember ) ;
47+ const filteredMemebers = selectGroup === 'new' ? newMembers : existingMembers ;
4848
4949 const toggleSelectPromotion = id => {
5050 setSelectedForPromotion ( prev => {
@@ -111,7 +111,7 @@ function PromotionEligibility({ currentUser }) {
111111 < td data-label = "Reviewer Name" > { reviewerName } </ td >
112112 < td
113113 data-label = "Weekly Requirements"
114- className = { weeklyRequirementsMet ? 'status-met' : 'status-not-met' }
114+ className = { weeklyRequirementsMet ? styles . status_met : styles . status_not_met }
115115 >
116116 { weeklyRequirementsMet ? '✓ Has Met' : '✗ Has not Met' }
117117 </ td >
@@ -130,113 +130,98 @@ function PromotionEligibility({ currentUser }) {
130130 toggleSelectPromotion ( id ) ;
131131 }
132132 } }
133- className = { `custom-circular-checkbox-wrapper ${ processing ? 'disabled' : '' } ` }
133+ className = { `${ styles . custom_circular_checkbox_wrapper } ${ processing ? 'disabled' : '' } ` }
134134 style = { {
135- cursor : ! processing ? 'pointer' : 'not-allowed ' ,
135+ cursor : ! processing ? 'pointer' : 'not_allowed ' ,
136136 } }
137137 >
138138 < div
139- className = { `custom-circular-checkbox ${ selectedForPromotion . has ( id ) ? 'checked' : '' } ` }
139+ className = { `${ styles . custom_circular_checkbox } ${
140+ selectedForPromotion . has ( id ) ? 'checked' : ''
141+ } `}
140142 >
141- { selectedForPromotion . has ( id ) && < FaCheck className = "check-icon " /> }
143+ { selectedForPromotion . has ( id ) && < FaCheck className = "check_icon " /> }
142144 </ div >
143145 </ div >
144146 </ td >
145147 </ tr >
146148 ) ;
147149
148150 return (
149- < div className = { `page-wrapper ${ darkMode ? ' dark' : '' } ` } >
150- < div className = { `promo-table-container ${ darkMode ? ' dark' : '' } ` } >
151- < div className = "promo-table-header" >
151+ < div className = { `${ styles . pageWrapper } ${ darkMode ? styles . dark : '' } ` } >
152+ < div className = { `${ styles . promo_table_container } ${ darkMode ? styles . dark : '' } ` } >
153+ < div className = { styles . promo_table_header } >
152154 Promotion Eligibility
153155 < div >
156+ < select
157+ className = { `${ styles . selectGroup } ${ darkMode ? styles . dark : '' } ` }
158+ value = { selectGroup }
159+ onChange = { e => setSelectedGroup ( e . target . value ) }
160+ >
161+ < option value = "new" > New Member</ option >
162+ < option value = "existing" > Existing Member</ option >
163+ </ select >
154164 < button
155165 type = "button"
156166 onClick = { ( ) => toast . info ( 'Review Weekly clicked. Logic not implemented yet.' ) }
157167 disabled = { processing }
158- className = "review-btn"
168+ className = { styles . review_btn }
159169 >
160170 Review for this week
161171 </ button >
162172 < button
163173 type = "button"
164174 onClick = { handleProcessPromotions }
165175 disabled = { processing }
166- className = "process-promo-btn"
176+ className = { styles . process_promo_btn }
167177 >
168178 { processing ? 'Processing...' : 'Process Promotions' }
169179 </ button >
170180 </ div >
171181 </ div >
172-
173- < table className = "promo-table" >
174- < thead >
175- < tr >
176- < th > Reviewer Name</ th >
177- < th > Weekly Requirements</ th >
178- < th > Required PRs</ th >
179- < th > Total Reviews Done</ th >
180- < th > Remaining Weeks</ th >
181- < th > Promote?</ th >
182- </ tr >
183- </ thead >
184- < tbody >
185- { loading && (
186- < tr >
187- < td colSpan = "6" style = { { textAlign : 'center' } } >
188- Loading...
189- </ td >
190- </ tr >
191- ) }
192-
193- { ! loading && error && (
182+ < div className = { styles . tableWrapper } >
183+ < table className = { styles . promo_table } >
184+ < thead >
194185 < tr >
195- < td colSpan = "6" style = { { textAlign : 'center' , color : 'red' } } >
196- { error }
197- </ td >
186+ < th > Reviewer Name</ th >
187+ < th > Weekly Requirements</ th >
188+ < th > Required PRs</ th >
189+ < th > Total Reviews Done</ th >
190+ < th > Remaining Weeks</ th >
191+ < th > Promote?</ th >
198192 </ tr >
199- ) }
200-
201- { ! loading && ! error && reviewers . length === 0 && (
202- < tr >
203- < td colSpan = "6" style = { { textAlign : 'center' } } >
204- No reviewers found.
205- </ td >
206- </ tr >
207- ) }
208-
209- { ! loading && ! error && (
210- < >
211- { newMembers . length > 0 && (
212- < >
213- < tr
214- className = "section-row"
215- onClick = { ( ) => setShowNew ( prev => ! prev ) }
216- style = { { cursor : 'pointer' } }
217- >
218- < td colSpan = "6" > New Members { showNew ? '▲' : '▼' } </ td >
219- </ tr >
220- { showNew && newMembers . map ( renderRow ) }
221- </ >
222- ) }
223-
224- { existingMembers . length > 0 && (
225- < >
226- < tr
227- className = "section-row"
228- onClick = { ( ) => setShowExisting ( prev => ! prev ) }
229- style = { { cursor : 'pointer' } }
230- >
231- < td colSpan = "6" > Existing Members{ showExisting ? '▲' : '▼' } </ td >
232- </ tr >
233- { showExisting && existingMembers . map ( renderRow ) }
234- </ >
235- ) }
236- </ >
237- ) }
238- </ tbody >
239- </ table >
193+ </ thead >
194+ < tbody >
195+ { loading && (
196+ < tr >
197+ < td colSpan = "6" style = { { textAlign : 'center' } } >
198+ Loading...
199+ </ td >
200+ </ tr >
201+ ) }
202+
203+ { ! loading && error && (
204+ < tr >
205+ < td colSpan = "6" style = { { textAlign : 'center' , color : 'red' } } >
206+ { error }
207+ </ td >
208+ </ tr >
209+ ) }
210+
211+ { ! loading && ! error && reviewers . length === 0 && (
212+ < tr >
213+ < td colSpan = "6" style = { { textAlign : 'center' } } >
214+ No reviewers found.
215+ </ td >
216+ </ tr >
217+ ) }
218+
219+ { ! loading && ! error && (
220+ < > { filteredMemebers . length > 0 && filteredMemebers . map ( renderRow ) } </ >
221+ ) }
222+ </ tbody >
223+ </ table >
224+ </ div >
240225 </ div >
241226 </ div >
242227 ) ;
0 commit comments