Skip to content

List of uploaded tests in profile #10

Description

@quasimik

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>&ensp;</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.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    mvpFeature is critical for release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions