Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformovaný zoznam úloh na tabulku #541

Merged
merged 3 commits into from
Dec 15, 2024
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
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
Loading