Skip to content

Commit

Permalink
Transformovaný zoznam úloh na tabulku (#541)
Browse files Browse the repository at this point in the history
* TRansformovaný zoznam úloh na tabulku

* Pridaný prehľad opravenia série

* Polish some code style

---------

Co-authored-by: kovacspe <[email protected]>
Co-authored-by: matushl <[email protected]>
  • Loading branch information
3 people authored Dec 15, 2024
1 parent 5b79ef7 commit 3953f06
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/components/SemesterAdministration/SemesterAdministration.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {Stack, Typography} from '@mui/material'
import Grid from '@mui/material/Unstable_Grid2'
import {useMutation, useQuery} from '@tanstack/react-query'
import axios, {AxiosError} from 'axios'
import {FC, useState} from 'react'
import {FC, Fragment, useState} from 'react'

import {Button} from '@/components/Clickable/Button'
import {Link} from '@/components/Clickable/Link'
Expand Down Expand Up @@ -149,13 +150,35 @@ export const SemesterAdministration: FC = () => {
<b>Termín série:</b> {formatDateTime(series.deadline)}
</Typography>
</Stack>
<Stack px={2} direction="row" justifyContent="space-between">
<Grid container spacing={2} xs={12} md={9}>
{series?.problems.map((problem) => (
<Link key={problem.id} variant="button2" href={`/${seminar}/admin/opravit-ulohu/${problem.id}`}>
{problem.order}. úloha
</Link>
<Fragment key={problem.id}>
<Grid xs={4}>
<Link key={problem.id} variant="button2" href={`/${seminar}/admin/opravit-ulohu/${problem.id}`}>
{problem.order}. úloha
</Link>
</Grid>
<Grid xs={4} textAlign="center">
{problem.num_corrected_solutions === problem.num_solutions ? (
<>{`Opravené (${problem.num_solutions})`}</>
) : (
<>
{problem.num_corrected_solutions}/{problem.num_solutions}
</>
)}
</Grid>
<Grid xs={4} textAlign="center">
{problem.solution_pdf ? (
<Link key={problem.id} variant="button2" href={problem.solution_pdf}>
Vzorák
</Link>
) : (
<>{'chýba vzorák'}</>
)}
</Grid>
</Fragment>
))}
</Stack>
</Grid>
</Stack>
))}

Expand Down
3 changes: 3 additions & 0 deletions src/types/api/generated/competition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ export interface ProblemCorrection {
export interface Problem {
id: number
submitted?: any
num_solutions: number
num_corrected_solutions: number
text: string
order: number
image?: any | null
series?: any
solution_pdf?: string
}

export interface Comment {
Expand Down

0 comments on commit 3953f06

Please sign in to comment.