@@ -5,7 +5,6 @@ import { toast } from 'react-toastify';
5
5
import Pagination from './Pagination' ;
6
6
import PerformanceData from '../dummyData/performance.json' ;
7
7
import { TRAINEE_RATING } from '../Mutations/Ratings' ;
8
- import Button from './Buttons' ;
9
8
import RemarksModal from '../pages/ratings/CoordinatorRemarks' ;
10
9
import { UserContext } from '../hook/useAuth' ;
11
10
import { rowsType } from '../pages/ratings/frame' ;
@@ -63,7 +62,7 @@ export const GET_RATINGS_DATA = gql`
63
62
` ;
64
63
65
64
function TraineePerfomance ( ) {
66
- const [ usedata , setUserdata ] = React . useState ( [ ] ) ;
65
+ const [ usedata , setUserdata ] = useState ( [ ] ) ;
67
66
const { data, loading, error } = useQuery ( GET_RATINGS_DATA , { } ) ;
68
67
const { user } = useContext ( UserContext ) ;
69
68
const [ row , setRow ] = useState < rowsType > ( {
@@ -121,14 +120,11 @@ function TraineePerfomance() {
121
120
useEffect ( ( ) => {
122
121
getRatings ( {
123
122
fetchPolicy : 'network-only' ,
124
- onCompleted : /* istanbul ignore next */ ( data ) => {
125
- /* istanbul ignore next */
123
+ onCompleted : ( data ) => {
126
124
setRatings ( data ?. fetchRatingsTrainee ) ;
127
- /* istanbul ignore next */
128
125
sessionStorage . removeItem ( 'data' ) ;
129
126
} ,
130
- onError : /* istanbul ignore next */ ( error ) => {
131
- /* istanbul ignore next */
127
+ onError : ( error ) => {
132
128
toast . error ( error ?. message || 'Something went wrong' ) ;
133
129
} ,
134
130
} ) ;
@@ -152,6 +148,7 @@ function TraineePerfomance() {
152
148
const closeFeeds = ( ) => {
153
149
setToggle ( false ) ;
154
150
} ;
151
+
155
152
if ( loading ) {
156
153
return (
157
154
< >
@@ -171,59 +168,6 @@ function TraineePerfomance() {
171
168
</ >
172
169
) ;
173
170
}
174
- if ( ratings ?. length === 0 ) {
175
- return (
176
- < >
177
- < div className = "bg-light-bg dark:bg-dark-frame-bg pb-10" >
178
- < div className = "" >
179
- < div className = "bg-white dark:bg-dark-bg shadow-lg py-8 px-5 rounded-md w-full mdl:w-[70%] mdl:m-auto flex" >
180
- < div className = "flex ml-2 items-center justify-between" >
181
- < div className = "" >
182
- < img src = { oop } className = "w-[8rem] h-[8rem]" alt = "images" />
183
- </ div >
184
- </ div >
185
-
186
- < div className = " flex-1" >
187
- < div className = "flex w-full h-full items-center justify-between" >
188
- < p className = "text-gray-800 dark:text-white font-semibold text-[24px] w-[90%] m-auto" >
189
- Performance updates are on the way! Stay tuned for the
190
- latest insights!
191
- </ p >
192
- </ div >
193
- </ div >
194
- </ div >
195
- </ div >
196
- </ div >
197
- </ >
198
- ) ;
199
- }
200
-
201
- if ( ratings ?. length === 0 ) {
202
- return (
203
- < >
204
- < div className = "bg-light-bg dark:bg-dark-frame-bg pb-10" >
205
- < div className = "" >
206
- < div className = "bg-white dark:bg-dark-bg shadow-lg py-8 px-5 rounded-md w-full mdl:w-[70%] mdl:m-auto flex" >
207
- < div className = "flex ml-2 items-center justify-between" >
208
- < div className = "" >
209
- < img src = { oop } className = "w-[8rem] h-[8rem]" alt = "images" />
210
- </ div >
211
- </ div >
212
-
213
- < div className = " flex-1" >
214
- < div className = "flex w-full h-full items-center justify-between" >
215
- < p className = "text-gray-800 dark:text-white font-semibold text-[24px] w-[90%] m-auto" >
216
- Performance updates are on the way! Stay tuned for the
217
- latest insights!
218
- </ p >
219
- </ div >
220
- </ div >
221
- </ div >
222
- </ div >
223
- </ div >
224
- </ >
225
- ) ;
226
- }
227
171
228
172
if ( ratings ?. length === 0 ) {
229
173
return (
@@ -294,14 +238,10 @@ function TraineePerfomance() {
294
238
< th className = "px-5 py-3 border-b-2 border-gray-200 bg-gray-100 dark:bg-neutral-600 text-center text-xs font-semibold text-gray-600 dark:text-white uppercase tracking-wider" >
295
239
{ t ( 'Average' ) }
296
240
</ th >
297
- < th className = "px-5 py-3 border-b-2 border-gray-200 bg-gray-100 dark:bg-neutral-600 text-center text-xs font-semibold text-gray-600 dark:text-white uppercase tracking-wider" >
298
- { t ( 'Actions' ) }
299
- </ th >
300
241
</ tr >
301
- { ratings ?. slice ( firstContentIndex , lastContentIndex ) . map (
302
- /* istanbul ignore next */
303
- ( item : any ) => (
304
- /* istanbul ignore next */
242
+ { ratings
243
+ ?. slice ( firstContentIndex , lastContentIndex )
244
+ . map ( ( item : any ) => (
305
245
< tr key = { item . sprint } >
306
246
< td className = "px-5 py-5 border-b border-gray-200 bg-white dark:bg-dark-bg text-sm" >
307
247
< div className = "flex justify-center items-center" >
@@ -339,26 +279,8 @@ function TraineePerfomance() {
339
279
: Number ( item . average ) . toFixed ( 2 ) }
340
280
</ p >
341
281
</ td >
342
-
343
- < td className = "px-0 py-5 border-b border-gray-200 bg-white dark:bg-dark-bg text-sm" >
344
- < Button
345
- variant = "primary"
346
- size = "sm"
347
- style = "px-4 py-1 text-sm"
348
- onClick = {
349
- /* istanbul ignore next */
350
- ( ) => {
351
- /* istanbul ignore next */
352
- openFeed ( item ) ;
353
- }
354
- }
355
- >
356
- { t ( 'Details' ) }
357
- </ Button >
358
- </ td >
359
282
</ tr >
360
- ) ,
361
- ) }
283
+ ) ) }
362
284
</ tbody >
363
285
</ table >
364
286
</ div >
@@ -386,22 +308,19 @@ function TraineePerfomance() {
386
308
>
387
309
1
388
310
</ button >
389
- { /* @ts -ignore */ }
390
- { gaps . paginationGroup . map (
391
- /* istanbul ignore next */ ( el ) => (
392
- < button
393
- onClick = { /* istanbul ignore next */ ( ) => setPage ( el ) }
394
- data-testid = "page"
395
- key = { el }
396
- type = "button"
397
- className = { `page flex text-white h-12 w-12 items-center justify-center border-solid cursor-pointer bg-transparent ${
398
- page === el ? 'active' : ''
399
- } `}
400
- >
401
- { el }
402
- </ button >
403
- ) ,
404
- ) }
311
+ { gaps . paginationGroup . map ( ( el ) => (
312
+ < button
313
+ onClick = { ( ) => setPage ( el ) }
314
+ data-testid = "page"
315
+ key = { el }
316
+ type = "button"
317
+ className = { `page flex text-white h-12 w-12 items-center justify-center border-solid cursor-pointer bg-transparent ${
318
+ page === el ? 'active' : ''
319
+ } `}
320
+ >
321
+ { el }
322
+ </ button >
323
+ ) ) }
405
324
< button
406
325
onClick = { ( ) => setPage ( totalPages ) }
407
326
data-testid = "page3"
0 commit comments