-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Historisk visning av brukerhendelser (#2)
* Add historic view and slight redesign
- Loading branch information
1 parent
bb2e580
commit 8816fd0
Showing
38 changed files
with
924 additions
and
204 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,45 @@ | ||
import React from "react"; | ||
import { Aktivitetskrav } from "./Aktivitetskrav"; | ||
import fixtures from "@/mocks/fixtures"; | ||
import { infoSideHeaderText } from "@/components/view/AktivitetskravInfoComponent"; | ||
import { forhandsVarselHeaderText } from "@/components/view/ForhandsvarselComponent"; | ||
|
||
describe("<Aktivitetskrav />", () => { | ||
it("Displays infoside for Ny kandidat", () => { | ||
cy.mount(<Aktivitetskrav aktivitetskrav={fixtures.nyKandidatVurdering} />); | ||
it("Displays infoside for vurdering ny kandidat", () => { | ||
cy.mount(<Aktivitetskrav aktivitetskrav={fixtures.nyKandidatFixture} />); | ||
|
||
cy.contains(infoSideHeaderText); | ||
cy.contains("Det er på tide å informere deg om aktivitetsplikten"); | ||
}); | ||
|
||
it("Displays infoside for forhandsvarsel with missing document", () => { | ||
it("Displays infoside for vurdering forhandsvarsel with missing document", () => { | ||
cy.mount( | ||
<Aktivitetskrav | ||
aktivitetskrav={fixtures.forhaandsvarselVurderingWithoutDocument} | ||
aktivitetskrav={fixtures.forhaandsvarselFixtureWithoutDocument} | ||
/>, | ||
); | ||
|
||
cy.contains(infoSideHeaderText); | ||
cy.contains("Det er på tide å informere deg om aktivitetsplikten"); | ||
}); | ||
|
||
it("Displays forhaandsvarsel for forhandsvarsel with document", () => { | ||
it("Displays forhaandsvarsel for vurdering forhandsvarsel with document", () => { | ||
cy.mount( | ||
<Aktivitetskrav aktivitetskrav={fixtures.forhaandsvarselVurdering} />, | ||
<Aktivitetskrav aktivitetskrav={fixtures.forhaandsvarselFixture} />, | ||
); | ||
|
||
cy.contains(forhandsVarselHeaderText); | ||
cy.contains("Varsel om stans av sykepenger"); | ||
}); | ||
|
||
it("Defaults to infoside for other states", () => { | ||
cy.mount(<Aktivitetskrav aktivitetskrav={fixtures.unntakVurdering} />); | ||
it("Displays unntaksinfo with årsak for vurdering unntak", () => { | ||
cy.mount(<Aktivitetskrav aktivitetskrav={fixtures.unntakFixture} />); | ||
|
||
cy.contains(infoSideHeaderText); | ||
cy.contains("NAV har vurdert aktivitetsplikten din"); | ||
cy.contains( | ||
"NAV har vurdert aktivitetsplikten din og besluttet at du er unntatt fra aktivitetsplikten på grunn av medisinske opplysninger.", | ||
); | ||
}); | ||
|
||
it("Displays oppfyltinfo with årsak for vurdering oppfylt", () => { | ||
cy.mount(<Aktivitetskrav aktivitetskrav={fixtures.oppfyltFixture} />); | ||
|
||
cy.contains("NAV har vurdert aktivitetsplikten din"); | ||
cy.contains("NAV vurderer at du oppfyller aktivitetsplikten siden du er"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
import { AktivitetskravVurdering } from "@/schema/aktivitetskravVurderingSchema"; | ||
import { AktivitetskravInfoComponent } from "@/components/view/AktivitetskravInfoComponent"; | ||
import { ForhandsvarselComponent } from "@/components/view/ForhandsvarselComponent"; | ||
import { Page } from "@/components/page/Page"; | ||
import { AktivitetskravBox } from "@/components/box/AktivitetskravBox"; | ||
import React from "react"; | ||
import { HistoricEventsSummary } from "@/components/history/HistoricEventsSummary"; | ||
import { getViewItems } from "@/components/view/viewUtils"; | ||
import { Vurdering } from "@/components/view/Vurdering"; | ||
|
||
interface Props { | ||
aktivitetskrav: AktivitetskravVurdering; | ||
aktivitetskrav: AktivitetskravVurdering[]; | ||
} | ||
|
||
export const Aktivitetskrav = ({ aktivitetskrav }: Props) => { | ||
switch (aktivitetskrav.status) { | ||
case "FORHANDSVARSEL": { | ||
if (!aktivitetskrav.document) { | ||
return <AktivitetskravInfoComponent />; | ||
} | ||
return <ForhandsvarselComponent document={aktivitetskrav.document} />; | ||
} | ||
default: { | ||
return <AktivitetskravInfoComponent />; | ||
} | ||
} | ||
const { activeVurdering, historicVurderinger } = getViewItems(aktivitetskrav); | ||
|
||
return ( | ||
<Page> | ||
<AktivitetskravBox> | ||
<Vurdering viewItem={activeVurdering} /> | ||
</AktivitetskravBox> | ||
|
||
<HistoricEventsSummary historicVurderinger={historicVurderinger} /> | ||
</Page> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React, { ReactNode } from "react"; | ||
import { Box } from "@navikt/ds-react"; | ||
|
||
interface Props { | ||
children: ReactNode; | ||
} | ||
|
||
export const AktivitetskravBox = ({ children }: Props) => { | ||
return ( | ||
<div className="max-w-3xl w-full"> | ||
<Box | ||
background="bg-default" | ||
padding="6" | ||
borderRadius="medium" | ||
shadow="small" | ||
className="mx-4 mt-4 flex flex-col gap-4" | ||
> | ||
{children} | ||
</Box> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { BodyLong, Heading } from "@navikt/ds-react"; | ||
import React from "react"; | ||
import { getShortDateFormat } from "@/utils/dateUtils"; | ||
import { | ||
CheckmarkCircleFillIcon, | ||
ExclamationmarkTriangleFillIcon, | ||
InformationSquareFillIcon, | ||
XMarkOctagonFillIcon, | ||
} from "@navikt/aksel-icons"; | ||
import styles from "./componentheader.module.css"; | ||
|
||
interface Props { | ||
headerText: string; | ||
alertStyle: "info" | "success" | "warning" | "error"; | ||
createdAt: string; | ||
} | ||
|
||
export const ComponentHeader = ({ | ||
headerText, | ||
alertStyle, | ||
createdAt, | ||
}: Props) => { | ||
return ( | ||
<div className="mb-4"> | ||
<div className="flex flex-row mb-4 space-between"> | ||
<Heading size="large" level="1"> | ||
{headerText} | ||
</Heading> | ||
<> | ||
{alertStyle === "info" && ( | ||
<InformationSquareFillIcon className={styles.infoIcon} /> | ||
)} | ||
{alertStyle === "warning" && ( | ||
<ExclamationmarkTriangleFillIcon className={styles.warningIcon} /> | ||
)} | ||
{alertStyle === "success" && ( | ||
<CheckmarkCircleFillIcon className={styles.successIcon} /> | ||
)} | ||
{alertStyle === "error" && ( | ||
<XMarkOctagonFillIcon className={styles.errorIcon} /> | ||
)} | ||
</> | ||
</div> | ||
|
||
<BodyLong textColor="subtle"> | ||
Utsendt {getShortDateFormat(createdAt)} | ||
</BodyLong> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.roundedIcon { | ||
flex-shrink: 0; | ||
font-size: 2rem; | ||
height: 30px; | ||
margin-top: 0.2rem; | ||
margin-left: auto; | ||
} | ||
|
||
.infoIcon { | ||
composes: roundedIcon; | ||
color: var(--a-icon-info); | ||
} | ||
|
||
.warningIcon { | ||
composes: roundedIcon; | ||
color: var(--a-icon-warning); | ||
} | ||
|
||
.successIcon { | ||
composes: roundedIcon; | ||
color: var(--a-icon-success); | ||
} | ||
|
||
.errorIcon { | ||
composes: roundedIcon; | ||
color: var(--a-icon-danger); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { AktivitetskravBox } from "@/components/box/AktivitetskravBox"; | ||
import { Heading, LinkPanel } from "@navikt/ds-react"; | ||
import NextLink from "next/link"; | ||
import React from "react"; | ||
import { getShortDateFormat } from "@/utils/dateUtils"; | ||
import { AktivitetskravViewItem } from "@/components/view/viewUtils"; | ||
|
||
const getHeaderText = (viewItem: AktivitetskravViewItem) => { | ||
switch (viewItem.type) { | ||
case "UNDER_BEHANDLING": | ||
return "NAV vurderer aktivitetsplikten din"; | ||
case "IKKE_OPPFYLT": | ||
return "Svarfristen har gått ut"; | ||
case "FORHANDSVARSEL": | ||
return "Forhåndsvarsel om stans av sykepenger"; | ||
case "MOTTATT_VURDERING": | ||
return "Du har mottatt en vurdering av din aktivitetsplikt"; | ||
} | ||
}; | ||
|
||
interface Props { | ||
historicVurderinger: AktivitetskravViewItem[] | null; | ||
} | ||
|
||
export const HistoricEventsSummary = ({ historicVurderinger }: Props) => { | ||
if (historicVurderinger && historicVurderinger.length > 0) { | ||
return ( | ||
<AktivitetskravBox> | ||
<Heading size="medium" level="2" spacing> | ||
Tidligere hendelser vedrørende din aktivitetsplikt | ||
</Heading> | ||
|
||
{historicVurderinger.map((item, index) => { | ||
return ( | ||
<LinkPanel | ||
href={`/${item.vurdering.internUuid}`} | ||
border | ||
as={NextLink} | ||
key={index} | ||
> | ||
<LinkPanel.Title> | ||
{getShortDateFormat(item.vurdering.createdAt)}:{" "} | ||
{getHeaderText(item)} | ||
</LinkPanel.Title> | ||
</LinkPanel> | ||
); | ||
})} | ||
</AktivitetskravBox> | ||
); | ||
} | ||
return null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.