Skip to content

Commit

Permalink
Register to semester dialog refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
michalmasrna1 committed Nov 11, 2023
1 parent eba5aaf commit d7ba0a2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/Problems/Problems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,22 @@ export const Problems: FC = () => {

const {hasPermissions, permissionsIsLoading} = useHasPermissions()

const [deleteDialogId, setDeleteDialogId] = useState<number | undefined>()
const close = () => setDeleteDialogId(undefined)
const [displayRegisterDialog, setDisplayRegisterDialog] = useState<boolean>(false)
const closeRegisterDialog = () => setDisplayRegisterDialog(false)
const editProfile = () => {
close()
closeRegisterDialog()
router.push(`/${seminar}/profil/uprava`)
}
const agree = () => {
deleteDialogId !== undefined && registerToSemester(semesterId)
close()
displayRegisterDialog && registerToSemester(semesterId)
closeRegisterDialog()
}

return (
<>
<Dialog
open={deleteDialogId !== undefined}
close={close}
open={displayRegisterDialog}
close={closeRegisterDialog}
title="Skontroluj prosím, čí údaje o ročníku a škole sú správne."
contentText={`Škola: ${profile?.grade_name}, Ročník: ${profile?.school.verbose_name}`} // TODO: this is not styled, I suggest expanding the dialog component to support content as component
actions={
Expand Down Expand Up @@ -228,7 +228,7 @@ export const Problems: FC = () => {
canRegister={canRegister}
canSubmit={canSubmit}
invalidateSeriesQuery={invalidateSeriesQuery}
displayRegisterDialog={() => setDeleteDialogId(problem.id)}
displayRegisterDialog={() => setDisplayRegisterDialog(true)}
/>
))}

Expand Down

0 comments on commit d7ba0a2

Please sign in to comment.