Skip to content

Commit

Permalink
Merge pull request #2047 from navikt/feature/clean-up-revarsling-unleash
Browse files Browse the repository at this point in the history
[KAIZEN-0] Fjerne revarsling toggle
  • Loading branch information
Jesperpaulsen authored Apr 13, 2023
2 parents 996982c + adb74cd commit 8d983de
Show file tree
Hide file tree
Showing 14 changed files with 799 additions and 589 deletions.
40 changes: 2 additions & 38 deletions src/app/personside/infotabs/oversikt/VarselOversikt.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import * as React from 'react';
import styled from 'styled-components/macro';
import theme from '../../../../styles/personOversiktTheme';
import Varsel from '../varsel/Varsel';
import { AlertStripeInfo } from 'nav-frontend-alertstriper';
import { ReactNode } from 'react';
import { useOnMount } from '../../../../utils/customHooks';
import { Normaltekst } from 'nav-frontend-typografi';
import VarslerLoader, { VarslerRendererProps } from '../varsel/varsel-loader';
import VarselNy from '../varsel/VarselNy';
import IfFeatureToggleOn from '../../../../components/featureToggle/IfFeatureToggleOn';
import IfFeatureToggleOff from '../../../../components/featureToggle/IfFeatureToggleOff';
import { FeatureToggles } from '../../../../components/featureToggle/toggleIDs';
import Varsel from '../varsel/Varsel';

const ListStyle = styled.ol`
> *:not(:first-child) {
Expand All @@ -23,16 +19,7 @@ interface Props {
}

function VarselOversikt(props: Props) {
return (
<>
<IfFeatureToggleOn toggleID={FeatureToggles.visRevarslingDetaljer}>
<VarslerLoader component={VarselVisningNy} {...props} />
</IfFeatureToggleOn>
<IfFeatureToggleOff toggleID={FeatureToggles.visRevarslingDetaljer}>
<VarslerLoader component={VarselVisning} {...props} />
</IfFeatureToggleOff>
</>
);
return <VarslerLoader component={VarselVisning} {...props} />;
}

function VarselVisning(props: VarslerRendererProps & Props) {
Expand All @@ -58,27 +45,4 @@ function VarselVisning(props: VarslerRendererProps & Props) {
);
}

function VarselVisningNy(props: VarslerRendererProps & Props) {
const forsteVarsler = props.varsler.slice(0, 2);
useOnMount(() => {
props.setHeaderContent(
<Normaltekst>
{forsteVarsler.length} / {props.varsler.length}
</Normaltekst>
);
});

if (props.varsler.length === 0) {
return <AlertStripeInfo>Ingen varsler på bruker</AlertStripeInfo>;
}

return (
<ListStyle>
{forsteVarsler.map((varsel, index) => (
<VarselNy key={index} varsel={varsel} />
))}
</ListStyle>
);
}

export default VarselOversikt;
Loading

0 comments on commit 8d983de

Please sign in to comment.