Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { DataGrid, GridRowParams } from '@mui/x-data-grid';
import { useNavigate } from 'react-router-dom';
import { Container, Typography, Stack } from '@mui/material';
import { Container, Typography, Stack, Box } from '@mui/material';

import {
ApplicationRow,
Expand All @@ -20,12 +20,14 @@ import { useApplicationData } from '@shared/hooks/useApplicationData';
export function ApplicationTable() {
const navigate = useNavigate();
const { token: accessToken } = useLoginContext();
const { data } = useApplicationData(accessToken);
const { data, isLoading, error } = useApplicationData(accessToken);
const [allRecruiters] = useState<AssignedRecruiter[]>([]);

const handleRowClick = (params: GridRowParams<ApplicationRow>) => {
navigate(`/applications/${params.row.userId}`);
};
const showEmpty = !isLoading && !error && data.length === 0;

return (
<Container maxWidth="xl">
<Stack direction="row" alignItems="center" spacing={2} mt={4} mb={8}>
Expand All @@ -38,19 +40,38 @@ export function ApplicationTable() {
Database | {getCurrentSemester()} {getCurrentYear()} Recruitment Cycle
</Typography>
</Stack>
<DataGrid
rows={data}
columns={applicationColumns(allRecruiters)}
initialState={{
pagination: {
paginationModel: defaultPaginationModel,
},
}}
pageSizeOptions={defaultPageSizeOptions}
onRowClick={handleRowClick}
disableRowSelectionOnClick
sx={{ cursor: 'pointer' }}
/>
{showEmpty ? (
<Box
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: 300,
border: '1px dashed rgba(255,255,255,0.2)',
borderRadius: 2,
color: 'rgba(255,255,255,0.85)',
background: 'rgba(255,255,255,0.02)',
}}
>
<Typography variant="h6" sx={{ fontWeight: 500 }}>
There are no applications at this time
</Typography>
</Box>
) : (
<DataGrid
rows={data}
columns={applicationColumns(allRecruiters)}
initialState={{
pagination: {
paginationModel: defaultPaginationModel,
},
}}
pageSizeOptions={defaultPageSizeOptions}
onRowClick={handleRowClick}
disableRowSelectionOnClick
sx={{ cursor: 'pointer' }}
/>
)}
</Container>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ const IndividualApplicationDetails = ({
{isAdmin ? (
<AssignedRecruiters
applicationId={selectedApplication.id}
assignedRecruiters={selectedApplication.assignedRecruiters}
assignedRecruiters={
selectedApplication.assignedRecruiters
}
/>
) : (
<Typography sx={{ color: '#fff', mt: 1 }}>
Expand Down Expand Up @@ -514,4 +516,4 @@ const IndividualApplicationDetails = ({
);
};

export default IndividualApplicationDetails;
export default IndividualApplicationDetails;
Loading