Skip to content

Commit

Permalink
Add useUserContext hook to Sakintro component
Browse files Browse the repository at this point in the history
  • Loading branch information
RamziAbuQassim committed Nov 16, 2023
1 parent 3739b4c commit ad2f9ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pages/saksbehandling/sakintro/Sakintro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import { ÅpentBrev } from '~src/assets/Illustrations';
import LinkAsButton from '~src/components/linkAsButton/LinkAsButton';
import Vedtakstidslinje from '~src/components/vedtakstidslinje/VedtaksTidslinje';
import { SaksoversiktContext } from '~src/context/SaksoversiktContext';
import { useUserContext } from '~src/context/userContext';
import { useNotificationFromLocation } from '~src/lib/hooks';
import { useI18n } from '~src/lib/i18n';
import * as Routes from '~src/lib/routes';
import { Nullable } from '~src/lib/types';
import Utbetalinger from '~src/pages/saksbehandling/sakintro/Utbetalinger';
import { KlageStatus } from '~src/types/Klage';
import { LoggedInUser } from '~src/types/LoggedInUser';
import { Sakstype } from '~src/types/Sak';
import { erKlageAvsluttet, erKlageÅpen } from '~src/utils/klage/klageUtils';
import { erTilbakekrevingsbehandlingÅpen } from '~src/utils/ManuellTilbakekrevingsbehandlingUtils';
Expand Down Expand Up @@ -44,6 +46,8 @@ enum NyBehandling {

const Sakintro = () => {
const props = useOutletContext<SaksoversiktContext>();
const user = useUserContext();

const { formatMessage } = useI18n({ messages });
const locationState = useNotificationFromLocation();

Expand Down Expand Up @@ -99,6 +103,7 @@ const Sakintro = () => {
<div className={styles.headerKnapper}>
{harVedtak && props.sak.sakstype !== Sakstype.Alder && (
<NyBehandlingVelger
user={user}
sakId={props.sak.id}
kanRevurdere={iverksatteInnvilgedeSøknader.length > 0}
/>
Expand Down Expand Up @@ -172,7 +177,7 @@ const Sakintro = () => {
);
};

const NyBehandlingVelger = (props: { sakId: string; kanRevurdere: boolean }) => {
const NyBehandlingVelger = (props: { user: LoggedInUser; sakId: string; kanRevurdere: boolean }) => {
const { formatMessage } = useI18n({ messages });
const [anchorEl, setAnchorEl] = useState<Nullable<HTMLElement>>(null);

Expand Down Expand Up @@ -226,7 +231,7 @@ const NyBehandlingVelger = (props: { sakId: string; kanRevurdere: boolean }) =>
>
{formatMessage('popover.option.klage')}
</LinkAsButton>
{process.env.NODE_ENV !== 'production' && (
{!props.user.isProd && (
<LinkAsButton
className={styles.popoverOption}
variant="tertiary"
Expand Down
1 change: 1 addition & 0 deletions src/types/LoggedInUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export interface LoggedInUser {
navn: string;
navIdent: string;
roller: Rolle[];
isProd: boolean;
}

0 comments on commit ad2f9ae

Please sign in to comment.