Skip to content

Commit

Permalink
små ting
Browse files Browse the repository at this point in the history
  • Loading branch information
henriktheboss committed Oct 9, 2024
1 parent f1a0f30 commit 0bc24b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/moduler/mal/mal-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ import { selectErUnderOppfolging, selectHarSkriveTilgang } from '../oppfolging-s
import { selectGjeldendeMal } from './aktivitetsmal-selector';
//import Malvisning from './mal-visning';
import MalForm from './MalForm';
import { selectViserHistoriskPeriode } from '../filtrering/filter/filter-selector';

interface Props {
dirtyRef: MutableRefObject<boolean>;
onLagre: () => void;
}

const MalContainer = (props: Props) => {
//const viserHistoriskPeriode = useSelector(selectViserHistoriskPeriode, shallowEqual);
const viserHistoriskPeriode = useSelector(selectViserHistoriskPeriode, shallowEqual);
const malData = useSelector(selectGjeldendeMal, shallowEqual);
const underOppfolging = useSelector(selectErUnderOppfolging, shallowEqual);
const erVeileder = useErVeileder();
const harSkriveTilgang = useSelector(selectHarSkriveTilgang, shallowEqual);

const mal = malData && malData.mal;

const [edit, setEdit] = useState(underOppfolging && harSkriveTilgang);
const [edit, setEdit] = useState( !viserHistoriskPeriode && underOppfolging && harSkriveTilgang);

if (edit) {
return (
Expand Down
4 changes: 3 additions & 1 deletion src/moduler/mal/mal-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useSelector } from 'react-redux';

import Modal from '../../felles-komponenter/modal/Modal';
import { selectHentMalListeFeil } from '../feilmelding/feil-selector';
// import { useNavigate } from 'react-router-dom';
// import { useRoutes } from '../../routing/useRoutes';

interface Props {
children: React.ReactNode;
Expand All @@ -15,7 +17,7 @@ export function MalModal(props: Props) {
const feil = useSelector(selectHentMalListeFeil);

return (
<Modal feilmeldinger={feil} heading={heading}>
<Modal lukkPåKlikkUtenfor={true} onRequestClose={props.onRequestClosed} feilmeldinger={feil} heading={heading}>
{children}
</Modal>
);
Expand Down
3 changes: 3 additions & 0 deletions src/moduler/mal/mal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ const Mal = () => {
const avhengigheter = [malStatus, malListeStatus];

const onModalRequestClosed = () => {
console.log('onModalRequestClosed');
if (!isDirty.current || window.confirm(CONFIRM)) {
console.log("onModalRequestClosed er true")
navigate(hovedsideRoute());
return true;
}
console.log("onModalRequestClosed er false")
return false;
};

Expand Down

0 comments on commit 0bc24b4

Please sign in to comment.