Skip to content

Commit

Permalink
кидает ошибку, если в уровне нет заданий
Browse files Browse the repository at this point in the history
  • Loading branch information
semant1cs committed Dec 18, 2023
1 parent 32e48da commit ed9aad3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
19 changes: 15 additions & 4 deletions frontend/src/components/mapMenu/UIMapMenu/Level/Level.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,25 @@ const Level: React.FC<IModuleProps> = ({id, level}) => {
setOpenModalWindow(!isOpenModalWindow)
}, [isOpenModalWindow])

const renderModal = () => {
if (level.task_units && level.theory_units)
return (
level.task_units.length + level.theory_units.length !== 0
? <ModalWindow
onClose={onHandleCloseModalWindow}
body={<ModalLevelBody level={level}/>}
/>
: <ModalWindow
onClose={onHandleCloseModalWindow}
body={<div className="error-nolvl-modal-window">Нет доступных заданий для этого уровня</div>}/>
)
}

return (
<div onClick={onHandleOpenModalWindow} className={classNameGeolocation}>

{isOpenModalWindow
? <ModalWindow
onClose={onHandleCloseModalWindow}
body={<ModalLevelBody level={level}/>}
/>
? renderModal()
: null}

<div>
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/styles/mapMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,12 @@
border: 1px solid #F1F1F1;
letter-spacing: 0;
}

.error-nolvl-modal-window {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 20px;
letter-spacing: 1px;
}

0 comments on commit ed9aad3

Please sign in to comment.