Probably somehow reuse the table in the SubjectNumberCourses component:
|
<TableContainer> |
|
<Table className={classes.table} aria-label='test table' aria-labelledby='tableTitle' size='small'> |
|
<TableHead> |
|
<TableRow> |
|
<TableCell component='th' scope='row'>Identifier</TableCell> |
|
<TableCell>Professor</TableCell> |
|
<TableCell>Kind</TableCell> |
|
<TableCell>Term</TableCell> |
|
<TableCell align='right'>Size</TableCell> |
|
<TableCell padding='none'></TableCell> |
|
</TableRow> |
|
</TableHead> |
|
<TableBody> |
|
{testData.tests.map(test => ( |
|
<TableRow key={test._id}> |
|
<TableCell component='th' scope='row'> |
|
<Chip |
|
label={test._id.slice(-6)} |
|
variant='outlined' |
|
size='small' |
|
style={{ color: colorHash.hex(test._id), fontFamily: 'Monospace' }} |
|
onClick={handleClickTestInfo(test._id)} |
|
/> |
|
</TableCell> |
|
<TableCell>{test.professor.name || '-'}</TableCell> |
|
<TableCell>{test.kind.name + (test.kind.number ? ' ' + test.kind.number : '')}</TableCell> |
|
<TableCell> |
|
{test.term.year}<span> </span>{emojiTooltip(test.term.quarter)}</TableCell> |
|
<TableCell align='right'>{test.filesize || '-'}</TableCell> |
|
<TableCell padding='none'> |
|
<IconButton onClick={downloadFile(test._id)}> |
|
<GetAppIcon style={{ fontSize: '18px' }} /> |
|
</IconButton> |
|
</TableCell> |
|
</TableRow> |
|
))} |
|
</TableBody> |
|
<TableFooter> |
|
<TableRow> |
|
<TablePagination |
|
rowsPerPageOptions={[5, 10, 25]} |
|
colSpan={3} |
|
count={testData.count} |
|
rowsPerPage={rowsPerPage} |
|
page={page} |
|
SelectProps={{ |
|
inputProps: { 'aria-label': 'rows per page' }, |
|
native: true, |
|
}} |
|
onChangePage={handleChangePage} |
|
onChangeRowsPerPage={handleChangeRowsPerPage} |
|
ActionsComponent={SubjectNumberCoursesPagination} |
|
/> |
|
</TableRow> |
|
</TableFooter> |
|
</Table> |
|
</TableContainer> |
A small subtlety: even if a professor's filters have hidden a test, the uploader should still be able to see it in his list of uploaded tests on his profile. The test should still be hidden from the main SubjectNumberCourses list, just like for everyone else. If such a thing happens, it would also be nice if we tell the user that their test is being hidden due to a professor's filters. (But maybe this belongs in another issue later.)
Probably somehow reuse the table in the SubjectNumberCourses component:
UPE-Website-V2/testbank/src/SubjectNumberCourses.js
Lines 267 to 323 in 7f1d0bd
A small subtlety: even if a professor's filters have hidden a test, the uploader should still be able to see it in his list of uploaded tests on his profile. The test should still be hidden from the main SubjectNumberCourses list, just like for everyone else. If such a thing happens, it would also be nice if we tell the user that their test is being hidden due to a professor's filters. (But maybe this belongs in another issue later.)