Skip to content

Commit e2de959

Browse files
committed
fx-remove-performance details fields
1 parent 48d176f commit e2de959

File tree

1 file changed

+21
-102
lines changed

1 file changed

+21
-102
lines changed

src/components/TraineePerformance.tsx

+21-102
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { toast } from 'react-toastify';
55
import Pagination from './Pagination';
66
import PerformanceData from '../dummyData/performance.json';
77
import { TRAINEE_RATING } from '../Mutations/Ratings';
8-
import Button from './Buttons';
98
import RemarksModal from '../pages/ratings/CoordinatorRemarks';
109
import { UserContext } from '../hook/useAuth';
1110
import { rowsType } from '../pages/ratings/frame';
@@ -63,7 +62,7 @@ export const GET_RATINGS_DATA = gql`
6362
`;
6463

6564
function TraineePerfomance() {
66-
const [usedata, setUserdata] = React.useState([]);
65+
const [usedata, setUserdata] = useState([]);
6766
const { data, loading, error } = useQuery(GET_RATINGS_DATA, {});
6867
const { user } = useContext(UserContext);
6968
const [row, setRow] = useState<rowsType>({
@@ -121,14 +120,11 @@ function TraineePerfomance() {
121120
useEffect(() => {
122121
getRatings({
123122
fetchPolicy: 'network-only',
124-
onCompleted: /* istanbul ignore next */ (data) => {
125-
/* istanbul ignore next */
123+
onCompleted: (data) => {
126124
setRatings(data?.fetchRatingsTrainee);
127-
/* istanbul ignore next */
128125
sessionStorage.removeItem('data');
129126
},
130-
onError: /* istanbul ignore next */ (error) => {
131-
/* istanbul ignore next */
127+
onError: (error) => {
132128
toast.error(error?.message || 'Something went wrong');
133129
},
134130
});
@@ -152,6 +148,7 @@ function TraineePerfomance() {
152148
const closeFeeds = () => {
153149
setToggle(false);
154150
};
151+
155152
if (loading) {
156153
return (
157154
<>
@@ -171,59 +168,6 @@ function TraineePerfomance() {
171168
</>
172169
);
173170
}
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-
}
227171

228172
if (ratings?.length === 0) {
229173
return (
@@ -294,14 +238,10 @@ function TraineePerfomance() {
294238
<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">
295239
{t('Average')}
296240
</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>
300241
</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) => (
305245
<tr key={item.sprint}>
306246
<td className="px-5 py-5 border-b border-gray-200 bg-white dark:bg-dark-bg text-sm">
307247
<div className="flex justify-center items-center">
@@ -339,26 +279,8 @@ function TraineePerfomance() {
339279
: Number(item.average).toFixed(2)}
340280
</p>
341281
</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>
359282
</tr>
360-
),
361-
)}
283+
))}
362284
</tbody>
363285
</table>
364286
</div>
@@ -386,22 +308,19 @@ function TraineePerfomance() {
386308
>
387309
1
388310
</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+
))}
405324
<button
406325
onClick={() => setPage(totalPages)}
407326
data-testid="page3"

0 commit comments

Comments
 (0)