diff --git a/src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx b/src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx index c8f5453f..e58e7596 100644 --- a/src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx +++ b/src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx @@ -1,3 +1,4 @@ +import {Stack} from '@mui/material' import {useRouter} from 'next/router' import {FC, useState} from 'react' @@ -16,7 +17,7 @@ export const LoginFormWrapper: FC = ({closeOverlay}) => { if (form === 'login') return ( - <> + - + ) return ( diff --git a/src/components/Problems/Problem.tsx b/src/components/Problems/Problem.tsx index 85a760d4..fca9aefb 100644 --- a/src/components/Problems/Problem.tsx +++ b/src/components/Problems/Problem.tsx @@ -26,6 +26,7 @@ export const Problem: FC<{ isAfterDeadline: boolean invalidateSeriesQuery: () => Promise displayRegisterDialog: () => void + displayLoginDialog: () => void }> = ({ problem, registered, @@ -35,6 +36,7 @@ export const Problem: FC<{ isAfterDeadline, invalidateSeriesQuery, displayRegisterDialog, + displayLoginDialog, }) => { const handleDiscussionButtonClick = () => { setDisplaySideContent((prevState) => { @@ -45,9 +47,12 @@ export const Problem: FC<{ } }) } + const handleUploadClick = () => { if (!registered && canRegister) { displayRegisterDialog() + } else if (!registered && !canRegister) { + displayLoginDialog() } else { setDisplayProblemUploadForm((prevState) => !prevState) setDisplayActions(false) @@ -114,11 +119,9 @@ export const Problem: FC<{ - {(registered || canRegister) && ( - - )} + )} diff --git a/src/components/Problems/Problems.tsx b/src/components/Problems/Problems.tsx index 1e17c4d3..e7cbb98f 100644 --- a/src/components/Problems/Problems.tsx +++ b/src/components/Problems/Problems.tsx @@ -17,6 +17,7 @@ import {useHasPermissions} from '@/utils/useHasPermissions' import {Dialog} from '../Dialog/Dialog' import {Loading} from '../Loading/Loading' +import {LoginFormWrapper} from '../PageLayout/LoginFormWrapper/LoginFormWrapper' import {Discussion} from './Discussion' import {Problem} from './Problem' import styles from './Problems.module.scss' @@ -117,6 +118,9 @@ export const Problems: FC = () => { closeRegisterDialog() } + const [displayLoginDialog, setDisplayLoginDialog] = useState(false) + const closeLoginDialog = () => setDisplayLoginDialog(false) + return ( <> { } /> + + Pre odovzdanie sa prihlás. + + + } + /> {(loading.semesterListIsLoading || loading.currentSeriesIsLoading || @@ -177,6 +191,7 @@ export const Problems: FC = () => { isAfterDeadline={isAfterDeadline} invalidateSeriesQuery={invalidateSeriesQuery} displayRegisterDialog={() => setDisplayRegisterDialog(true)} + displayLoginDialog={() => setDisplayLoginDialog(true)} /> ))}