From 67056c0cb151f271cefd8ea89dbaafdf052491f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vikt=C3=B3ria=20Brezinov=C3=A1?= Date: Sun, 10 Dec 2023 13:58:50 +0100 Subject: [PATCH 1/3] change semesterPicker to support admin/opravovanie --- .../SemesterPicker/SemesterPicker.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/SemesterPicker/SemesterPicker.tsx b/src/components/SemesterPicker/SemesterPicker.tsx index 487f6d3e..a7e42b44 100644 --- a/src/components/SemesterPicker/SemesterPicker.tsx +++ b/src/components/SemesterPicker/SemesterPicker.tsx @@ -28,7 +28,7 @@ export interface SemesterListItem { series_set: SeriesListItem[] } -export const SemesterPicker: FC<{page: 'zadania' | 'vysledky'}> = ({page}) => { +export const SemesterPicker: FC<{page: 'zadania' | 'vysledky' | 'admin/opravovanie'}> = ({page}) => { const {seminar} = useSeminarInfo() const {setPageTitle} = PageTitleContainer.useContainer() @@ -42,7 +42,9 @@ export const SemesterPicker: FC<{page: 'zadania' | 'vysledky'}> = ({page}) => { let pageTitleToSet = '' if (semester) { const semesterTitle = `${semester?.year}. ročník - ${semester?.season_code === 0 ? 'zimný' : 'letný'} semester` - if (displayWholeSemesterOnResults) { + if (page === 'admin/opravovanie') { + pageTitleToSet = 'Opravovanie' + } else if (displayWholeSemesterOnResults) { pageTitleToSet = semesterTitle } else if (series) { pageTitleToSet = `${semesterTitle}${series?.order ? ` - ${series?.order}. séria` : ''}` @@ -50,9 +52,17 @@ export const SemesterPicker: FC<{page: 'zadania' | 'vysledky'}> = ({page}) => { } setPageTitle(pageTitleToSet) // `semester` a `series` su nami vytiahnute objekty, tak mozu triggerovat effekt kazdy render. nemalo by vadit - }, [displayWholeSemesterOnResults, semester, series, setPageTitle]) + }, [displayWholeSemesterOnResults, semester, series, page, setPageTitle]) const dropdownSemesterList = semesterList.map((semester) => { + if (page === 'admin/opravovanie') { + return { + id: semester.id, + text: `${semester.year}. ročník - ${semester.season_code === 0 ? 'zimný' : 'letný'} semester`, + link: `/${seminar}/${page}/${semester.id}`, + selected: semester.id === selectedItem.semesterId, + } + } return { id: semester.id, text: `${semester.year}. ročník - ${semester.season_code === 0 ? 'zimný' : 'letný'} semester`, @@ -85,7 +95,7 @@ export const SemesterPicker: FC<{page: 'zadania' | 'vysledky'}> = ({page}) => { return (
- + {page !== 'admin/opravovanie' && }
) From 11bc08e2d53e13abc9249adbfea9684f87ef5a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vikt=C3=B3ria=20Brezinov=C3=A1?= Date: Sun, 10 Dec 2023 13:59:18 +0100 Subject: [PATCH 2/3] add semesterPicker to administration --- .../SemesterAdministration.module.scss | 5 +++++ .../SemesterAdministration.module.scss.d.ts | 1 + .../SemesterAdministration/SemesterAdministration.tsx | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/components/SemesterAdministration/SemesterAdministration.module.scss b/src/components/SemesterAdministration/SemesterAdministration.module.scss index d9476036..c3734551 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.module.scss +++ b/src/components/SemesterAdministration/SemesterAdministration.module.scss @@ -1,3 +1,8 @@ .textarea { width: 100%; +} + +.semesterPicker { + display: flex; + justify-content: flex-end; } \ No newline at end of file diff --git a/src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts b/src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts index 09e0f310..2e41f22b 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts +++ b/src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts @@ -1,5 +1,6 @@ export type Styles = { textarea: string + semesterPicker: SemesterPicker } export type ClassNames = keyof Styles diff --git a/src/components/SemesterAdministration/SemesterAdministration.tsx b/src/components/SemesterAdministration/SemesterAdministration.tsx index 9cf190e1..ed8c7907 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.tsx +++ b/src/components/SemesterAdministration/SemesterAdministration.tsx @@ -6,6 +6,7 @@ import {FC, useState} from 'react' import {Button} from '@/components/Clickable/Button' import {Link} from '@/components/Clickable/Link' +import {SemesterPicker} from '@/components/SemesterPicker/SemesterPicker' import {SemesterWithProblems} from '@/types/api/generated/competition' import {formatDateTime} from '@/utils/formatDate' import {useHasPermissions} from '@/utils/useHasPermissions' @@ -95,6 +96,9 @@ export const SemesterAdministration: FC = () => { return ( <> +
+ +
{semester.year}. ročník ({semester.school_year}) - {semester.season_code === 0 ? 'zima' : 'leto'} From 1df7449590b349f006a6342827e5734f5dfd491e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vikt=C3=B3ria=20Brezinov=C3=A1?= Date: Sun, 10 Dec 2023 14:13:06 +0100 Subject: [PATCH 3/3] generate type --- .../SemesterAdministration.module.scss.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts b/src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts index 2e41f22b..89a00b6c 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts +++ b/src/components/SemesterAdministration/SemesterAdministration.module.scss.d.ts @@ -1,6 +1,6 @@ export type Styles = { + semesterPicker: string textarea: string - semesterPicker: SemesterPicker } export type ClassNames = keyof Styles