diff --git a/src/components/Alert/AlertBox.tsx b/src/components/Alert/AlertBox.tsx index fa617aff..de80221d 100644 --- a/src/components/Alert/AlertBox.tsx +++ b/src/components/Alert/AlertBox.tsx @@ -25,9 +25,9 @@ export const AlertBox: FC = () => { contentText={container.alertBox?.message} close={closeContainer} > - - diff --git a/src/components/CompetitionPage/CompetitionPage.tsx b/src/components/CompetitionPage/CompetitionPage.tsx index 9b54b563..6cd2dbc1 100644 --- a/src/components/CompetitionPage/CompetitionPage.tsx +++ b/src/components/CompetitionPage/CompetitionPage.tsx @@ -1,11 +1,12 @@ import {Stack, Typography} from '@mui/material' +import Grid from '@mui/material/Unstable_Grid2' import {useQuery} from '@tanstack/react-query' import axios from 'axios' import {useRouter} from 'next/router' -import {FC, useEffect} from 'react' +import {FC, Fragment, useEffect} from 'react' import {Link} from '@/components/Clickable/Link' -import {Competition, Event} from '@/types/api/competition' +import {Competition, Event, PublicationTypes} from '@/types/api/competition' import {BannerContainer} from '@/utils/BannerContainer' import {UpcomingOrCurrentEventInfo} from './UpcomingOrCurrentEventInfo' @@ -78,26 +79,36 @@ export const CompetitionPage: FC = ({ )} - - Archív - - {history_events.map((event) => ( - - - {name} {event.school_year} - - - {event.publication_set.map((publication) => ( - - {publication.name} + + {history_events.map((event) => { + const results = event.publication_set.find((p) => p.publication_type === PublicationTypes.RESULTS.id) + const problems = event.publication_set.find((p) => p.publication_type === PublicationTypes.PROBLEMS.id) + return ( + + + + {name} {event.school_year} + + + + {results && ( + + {results.name} - ))} - - - ))} - - + )} + + + {problems && ( + + {problems.name} + + )} + + + ) + })} + ) } diff --git a/src/components/FormItems/FormInput/FormInput.tsx b/src/components/FormItems/FormInput/FormInput.tsx index c0854ee9..3da0c239 100644 --- a/src/components/FormItems/FormInput/FormInput.tsx +++ b/src/components/FormItems/FormInput/FormInput.tsx @@ -12,6 +12,7 @@ export const FormInput = < label, type, rules, + ...props }: TextFieldProps & Pick, 'name' | 'control' | 'rules'> & { label: string @@ -31,6 +32,7 @@ export const FormInput = < helperText={error?.message} focused={false} sx={formItemStyle} + {...props} /> )} /> diff --git a/src/components/PageLayout/Banner/Banner.tsx b/src/components/PageLayout/Banner/Banner.tsx index fe93778b..6c1dc63f 100644 --- a/src/components/PageLayout/Banner/Banner.tsx +++ b/src/components/PageLayout/Banner/Banner.tsx @@ -10,6 +10,11 @@ export const Banner: FC = () => { const bannerTextFormatted = bannerMessages.length > 0 ? Array(10).fill(bannerMessages).flat().join(divider) + divider : undefined + + if (!bannerTextFormatted) { + return null + } + return ( { > - {bannerTextFormatted || '\u00A0'} + {bannerTextFormatted} diff --git a/src/components/PageLayout/LoginForm/LoginForm.tsx b/src/components/PageLayout/LoginForm/LoginForm.tsx index 41366b72..01bf178a 100644 --- a/src/components/PageLayout/LoginForm/LoginForm.tsx +++ b/src/components/PageLayout/LoginForm/LoginForm.tsx @@ -1,10 +1,10 @@ -import {Stack} from '@mui/material' +import {Visibility, VisibilityOff} from '@mui/icons-material' +import {Box, IconButton, Stack} from '@mui/material' import {useRouter} from 'next/router' import {FC, useState} from 'react' import {SubmitHandler, useForm} from 'react-hook-form' import {Button} from '@/components/Clickable/Button' -import {Link} from '@/components/Clickable/Link' import {Dialog} from '@/components/Dialog/Dialog' import {FormInput} from '@/components/FormItems/FormInput/FormInput' import {AuthContainer} from '@/utils/AuthContainer' @@ -53,6 +53,8 @@ export const LoginForm: FC = ({closeDialog}) => { setDisplayForgottenDialog((prev) => !prev) } + const [showPassword, setShowPassword] = useState(false) + return ( <> @@ -79,22 +81,40 @@ export const LoginForm: FC = ({closeDialog}) => { }, }} /> - - - - + setShowPassword(!showPassword)}> + {showPassword ? : } + + ), + }} + /> + - - Chcem sa registrovať - - - - - + + + + + diff --git a/src/components/PageLayout/MenuMain/BottomButtons.tsx b/src/components/PageLayout/MenuMain/BottomButtons.tsx index 06be8045..e14705f8 100644 --- a/src/components/PageLayout/MenuMain/BottomButtons.tsx +++ b/src/components/PageLayout/MenuMain/BottomButtons.tsx @@ -29,27 +29,23 @@ export const BottomButtons: FC = () => { } } - const separator = - return ( - + {!isAuthed ? ( <> - + Registrovať - {separator} - ) : ( <> - + Profil - {separator} - diff --git a/src/components/PageLayout/MenuMain/MenuMain.tsx b/src/components/PageLayout/MenuMain/MenuMain.tsx index df0b0b72..92cc339b 100644 --- a/src/components/PageLayout/MenuMain/MenuMain.tsx +++ b/src/components/PageLayout/MenuMain/MenuMain.tsx @@ -166,10 +166,6 @@ const MenuMainItem: FC<{caption: string; url: string}> = ({caption, url}) => { py: '4px', px: '8px', }} - textSx={{ - fontStyle: 'normal', - textAlign: 'center', - }} > {caption} diff --git a/src/components/PageLayout/PasswordResetRequest/PasswordResetRequest.tsx b/src/components/PageLayout/PasswordResetRequest/PasswordResetRequest.tsx index bf1cb5b4..7040aa9a 100644 --- a/src/components/PageLayout/PasswordResetRequest/PasswordResetRequest.tsx +++ b/src/components/PageLayout/PasswordResetRequest/PasswordResetRequest.tsx @@ -54,7 +54,7 @@ export const PasswordResetRequestForm: FC = ({cl }, }} /> - + diff --git a/src/components/Profile/PasswordChangeForm.tsx b/src/components/Profile/PasswordChangeForm.tsx index f1994485..ba1d15e3 100644 --- a/src/components/Profile/PasswordChangeForm.tsx +++ b/src/components/Profile/PasswordChangeForm.tsx @@ -1,7 +1,8 @@ -import {Stack} from '@mui/material' +import {Visibility, VisibilityOff} from '@mui/icons-material' +import {IconButton, Stack} from '@mui/material' import {useMutation} from '@tanstack/react-query' import axios, {AxiosError} from 'axios' -import {FC} from 'react' +import {FC, useState} from 'react' import {SubmitHandler, useForm} from 'react-hook-form' import {IGeneralPostResponse} from '@/types/api/general' @@ -69,6 +70,10 @@ export const PasswordChangeDialog: FC = ({open, close const requiredRule = {required: '* Toto pole nemôže byť prázdne.'} + const [showPassword1, setShowPassword1] = useState(false) + const [showPassword2, setShowPassword2] = useState(false) + const [showPassword3, setShowPassword3] = useState(false) + return ( = ({open, close control={control} name="old_password" label="aktuálne heslo" - type="password" + type={showPassword1 ? 'text' : 'password'} rules={requiredRule} + InputProps={{ + endAdornment: ( + setShowPassword1(!showPassword1)}> + {showPassword1 ? : } + + ), + }} /> = ({open, close message: '* Toto heslo je príliš krátke. Musí obsahovať aspoň 8 znakov.', }, }} + InputProps={{ + endAdornment: ( + setShowPassword2(!showPassword2)}> + {showPassword2 ? : } + + ), + }} /> { if (val !== getValues().new_password1) return '* Zadané heslá sa nezhodujú.' }, }} + InputProps={{ + endAdornment: ( + setShowPassword3(!showPassword3)}> + {showPassword3 ? : } + + ), + }} /> diff --git a/src/components/RegisterForm/RegisterForm.tsx b/src/components/RegisterForm/RegisterForm.tsx index 8a9faedb..8fac5b90 100644 --- a/src/components/RegisterForm/RegisterForm.tsx +++ b/src/components/RegisterForm/RegisterForm.tsx @@ -1,4 +1,5 @@ -import {Stack, Typography} from '@mui/material' +import {Visibility, VisibilityOff} from '@mui/icons-material' +import {IconButton, Stack, Typography} from '@mui/material' import {useMutation} from '@tanstack/react-query' import axios, {AxiosError} from 'axios' import {useRouter} from 'next/router' @@ -119,6 +120,9 @@ export const RegisterForm: FC = () => { }, }) + const [showPassword1, setShowPassword1] = useState(false) + const [showPassword2, setShowPassword2] = useState(false) + return ( <> { control={control} name="password1" label="heslo*" - type="password" + type={showPassword1 ? 'text' : 'password'} rules={{ ...requiredRule, minLength: { @@ -168,24 +172,38 @@ export const RegisterForm: FC = () => { message: '* Toto heslo je príliš krátke. Musí obsahovať aspoň 8 znakov.', }, }} + InputProps={{ + endAdornment: ( + setShowPassword1(!showPassword1)}> + {showPassword1 ? : } + + ), + }} /> { if (val !== getValues().password1) return '* Zadané heslá sa nezhodujú.' }, }} + InputProps={{ + endAdornment: ( + setShowPassword2(!showPassword2)}> + {showPassword2 ? : } + + ), + }} /> - - + + * takto označené polia sú povinné diff --git a/src/components/Results/ResultsRow.tsx b/src/components/Results/ResultsRow.tsx index 3d2b2dad..774c4105 100644 --- a/src/components/Results/ResultsRow.tsx +++ b/src/components/Results/ResultsRow.tsx @@ -54,11 +54,12 @@ export const ResultsRow: FC<{result: Result}> = ({result}) => { justifyContent: 'center', // top-level PageLayout padding je vypnuty, odsadzame to rucne tu pl: 1, + pr: {xs: '3px', sm: '5px'}, }} > {rank_changed && rank_start + '.'} - + {registration.profile.first_name + ' ' + registration.profile.last_name} @@ -68,13 +69,13 @@ export const ResultsRow: FC<{result: Result}> = ({result}) => { : registration.school.abbreviation} - + {/* reused resultsName font */} {registration.grade.tag} - + {solutions.map((series, index) => ( {series.map((solution, index) => ( @@ -101,6 +102,7 @@ export const ResultsRow: FC<{result: Result}> = ({result}) => { axios.get(`/api/personal/schools`), }) - const schools = schoolsData?.data ?? [] + const schools = (schoolsData?.data ?? []).sort((a, b) => a.name.localeCompare(b.name)) const allSchoolItems: SelectOption[] = schools.map(({code, city, name, street}) => ({ id: code, label: city ? `${name} ${street}, ${city}` : name, diff --git a/src/pages/strom/index.tsx b/src/pages/strom/index.tsx index 6fbf0eeb..48484003 100644 --- a/src/pages/strom/index.tsx +++ b/src/pages/strom/index.tsx @@ -4,7 +4,7 @@ import {PageLayout} from '@/components/PageLayout/PageLayout' import {Posts} from '@/components/Posts/Posts' const Strom: NextPage = () => ( - + ) diff --git a/src/theme.ts b/src/theme.ts index 81575bff..46c79453 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -131,7 +131,6 @@ const _theme = createTheme({ ...font.style, textTransform: 'uppercase', fontWeight: 800, - fontStyle: 'italic', }, button2: { ...font.style, @@ -245,6 +244,13 @@ const _theme = createTheme({ }, }, }, + MuiIconButton: { + styleOverrides: { + root: { + color: 'inherit', + }, + }, + }, }, }) diff --git a/src/types/api/competition.ts b/src/types/api/competition.ts index 42ab37df..4cf41f75 100644 --- a/src/types/api/competition.ts +++ b/src/types/api/competition.ts @@ -24,7 +24,7 @@ export const PublicationTypes = { }, RESULTS: { id: 1, - name: 'Výsledky', + name: 'Poradia', }, SOLUTIONS: { id: 2,