diff --git a/frontend/.vscode/settings.json b/frontend/.vscode/settings.json index e928b87f..cd248b56 100644 --- a/frontend/.vscode/settings.json +++ b/frontend/.vscode/settings.json @@ -12,7 +12,7 @@ "editor.linkedEditing": true, "editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "typescript.validate.enable": true, "typescript.tsdk": "node_modules/typescript/lib", diff --git a/frontend/src/breadcrumbs/use-breadcrumbs.ts b/frontend/src/breadcrumbs/use-breadcrumbs.ts index e719cafc..7b646da4 100644 --- a/frontend/src/breadcrumbs/use-breadcrumbs.ts +++ b/frontend/src/breadcrumbs/use-breadcrumbs.ts @@ -5,7 +5,7 @@ import { useLanguage } from '@app/language/use-language'; import { useTranslation } from '@app/language/use-translation'; import { currentPath } from '@app/routes/current-path'; -export interface Breadcrumb { +interface Breadcrumb { url: string; title: string; handleInApp?: boolean; diff --git a/frontend/src/components/text-loader/title-loader.tsx b/frontend/src/components/text-loader/title-loader.tsx deleted file mode 100644 index 398f684f..00000000 --- a/frontend/src/components/text-loader/title-loader.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; -import { useLanguage } from '@app/language/use-language'; -import { useGetInnsendingsytelserQuery } from '@app/redux-api/innsendingsytelser'; -import { TextLoader } from './text-loader'; - -interface Props { - innsendingsytelse: Innsendingsytelse; -} - -export const TitleLoader = ({ innsendingsytelse }: Props) => { - const lang = useLanguage(); - const { data, isLoading } = useGetInnsendingsytelserQuery(lang); - - return ( - - {data?.[innsendingsytelse] ?? innsendingsytelse} - - ); -}; diff --git a/frontend/src/hooks/use-innsendingsytelser.ts b/frontend/src/hooks/use-innsendingsytelser.ts index e0d4ec1a..bef5fe96 100644 --- a/frontend/src/hooks/use-innsendingsytelser.ts +++ b/frontend/src/hooks/use-innsendingsytelser.ts @@ -14,16 +14,3 @@ export const useInnsendingsytelseName = (innsendingsytelse: Innsendingsytelse): return [data[innsendingsytelse] ?? innsendingsytelse, false]; }; - -export const useInnsendingsytelserNames = (innsendingsytelser: Innsendingsytelse[]): [string[], boolean] => { - const lang = useLanguage(); - const { data, isLoading } = useGetInnsendingsytelserQuery(lang); - - if (isLoading || typeof data === 'undefined') { - return [[], true]; - } - - const titles = innsendingsytelser.map((innsendingsytelse) => data[innsendingsytelse] ?? innsendingsytelse); - - return [titles, isLoading]; -}; diff --git a/frontend/src/icons/document.tsx b/frontend/src/icons/document.tsx deleted file mode 100644 index 93c1df4b..00000000 --- a/frontend/src/icons/document.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react'; -import { styled } from 'styled-components'; - -interface Props { - className?: string; -} - -const DocumentSvg = (props: Props) => ( - - - - - - - - - - - -); - -export const Document = styled(DocumentSvg)` - width: 100px; -`; diff --git a/frontend/src/innsendingsytelser/innsendingsytelser.ts b/frontend/src/innsendingsytelser/innsendingsytelser.ts index 38917a27..b4aa6bce 100644 --- a/frontend/src/innsendingsytelser/innsendingsytelser.ts +++ b/frontend/src/innsendingsytelser/innsendingsytelser.ts @@ -111,7 +111,7 @@ export enum Innsendingsytelse { FEIL = 'FEIL', } -const INNSENDINGSYTELSER = Object.values(Innsendingsytelse); +export const INNSENDINGSYTELSER = Object.values(Innsendingsytelse); export const ensureStringIsInnsendingsytelse = (value: string | null = null): Innsendingsytelse | null => { if (value === null) { diff --git a/frontend/src/kategorier/kategorier.ts b/frontend/src/kategorier/kategorier.ts deleted file mode 100644 index bbdef776..00000000 --- a/frontend/src/kategorier/kategorier.ts +++ /dev/null @@ -1,339 +0,0 @@ -/* eslint-disable max-lines */ -import { Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; -import { Languages } from '@app/language/types'; - -export type StringValue = { - [key in Languages]: string; -}; - -export enum TemaType { - TEMA = 'TEMA', - INNSENDINGSYTELSE = 'INNSENDINGSYTELSE', - EXTERNAL = 'EXTERNAL', -} - -export interface IExternalTema { - type: TemaType.EXTERNAL; - title: StringValue; - externalUrl: StringValue; -} - -export interface ITemaWithKategorier { - type: TemaType.TEMA; - path: string; - title: StringValue; - innsendingsytelser: IInnsendingsytelse[]; -} - -export interface IInnsendingsytelse { - type: TemaType.INNSENDINGSYTELSE; - path: string; - innsendingsytelse: Innsendingsytelse; - allowsAnke: boolean; -} - -type ITema = ITemaWithKategorier | IInnsendingsytelse | IExternalTema; - -export const INNGANG_KATEGORIER: ITema[] = [ - { - type: TemaType.TEMA, - title: { - [Languages.nb]: 'Arbeid', - [Languages.en]: 'Work', - }, - path: 'arbeid', - innsendingsytelser: [ - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.DAGPENGER, - allowsAnke: true, - path: 'dagpenger', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.DAGPENGER_TILBAKEBETALING_FORSKUDD, - allowsAnke: false, - path: 'dagpenger-tilbakebetaling-forskudd', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.ARBEIDSAVKLARINGSPENGER, - allowsAnke: true, - path: 'arbeidsavklaringspenger', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.LONNSGARANTI, - allowsAnke: false, - path: 'lonnsgaranti', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.TILTAKSPENGER, - allowsAnke: false, - - path: 'tiltakspenger', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.NAV_LOVEN_14A, - allowsAnke: false, - path: 'nav-loven-14a', - }, - ], - }, - { - type: TemaType.TEMA, - title: { [Languages.nb]: 'Helse', [Languages.en]: 'Health' }, - path: 'helse', - innsendingsytelser: [ - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.SYKEPENGER, - allowsAnke: true, - path: 'sykepenger', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.ARBEIDSAVKLARINGSPENGER, - allowsAnke: true, - path: 'arbeidsavklaringspenger', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.UFORETRYGD, - allowsAnke: true, - path: 'uforetrygd', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.SUPPLERENDE_STONAD_UFORE_FLYKTNINGER, - allowsAnke: true, - path: 'supplerende-stonad-ufore-flyktninger', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.GRUNN_OG_HJELPESTONAD, - allowsAnke: true, - path: 'grunn-og-hjelpestonad', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.YRKESSKADE, - allowsAnke: true, - path: 'yrkesskade', - }, - ], - }, - { - type: TemaType.TEMA, - title: { [Languages.nb]: 'Familie', [Languages.en]: 'Family' }, - path: 'familie', - innsendingsytelser: [ - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.FORELDREPENGER, - allowsAnke: true, - path: 'foreldrepenger', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.ENGANGSSTONAD, - allowsAnke: true, - path: 'engangsstonad', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.SVANGERSKAPSPENGER, - allowsAnke: true, - path: 'svangerskapspenger', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.KONTANTSTOTTE, - allowsAnke: false, - path: 'kontantstotte', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.BARNETRYGD, - allowsAnke: true, - path: 'barnetrygd', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.BARNEBIDRAG_OG_BIDRAGSFORSKUDD, - allowsAnke: false, - path: 'barnebidrag-og-bidragsforskudd', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.EKTEFELLEBIDRAG, - allowsAnke: false, - path: 'ektefellebidrag', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.ENSLIG_MOR_ELLER_FAR, - allowsAnke: true, - path: 'enslig-mor-eller-far', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.GRAVFERDSSTONAD, - allowsAnke: true, - path: 'gravferdsstonad', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.SYKDOM_I_FAMILIEN, - allowsAnke: true, - path: 'sykdom-i-familien', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.OPPFOSTRINGSBIDRAG, - allowsAnke: false, - path: 'oppfostringsbidrag', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.REISEKOSTNADER_VED_SAMVAER, - allowsAnke: false, - path: 'reisekostnader-ved-samvaer', - }, - ], - }, - { - type: TemaType.TEMA, - title: { [Languages.nb]: 'Pensjon', [Languages.en]: 'Pension' }, - path: 'pensjon', - innsendingsytelser: [ - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.ALDERSPENSJON, - allowsAnke: true, - path: 'alderspensjon', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.AVTALEFESTET_PENSJON_SPK, - allowsAnke: true, - path: 'avtalefestet-pensjon-spk', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.AVTALEFESTET_PENSJON_PRIVAT, - allowsAnke: true, - path: 'avtalefestet-pensjon-privat', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.BARNEPENSJON, - allowsAnke: true, - path: 'barnepensjon', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.KRIGSPENSJON, - allowsAnke: true, - path: 'krigspensjon', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.GJENLEVENDE, - allowsAnke: true, - path: 'gjenlevende', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.SUPPLERENDE_STONAD, - allowsAnke: true, - path: 'supplerende-stonad', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.TIDLIGERE_FAMILIEPLEIER, - allowsAnke: true, - path: 'tidligere-familiepleier', - }, - ], - }, - { - type: TemaType.TEMA, - title: { [Languages.nb]: 'Til eller fra Norge', [Languages.en]: 'To and from Norway' }, - path: 'til-eller-fra-norge', - innsendingsytelser: [ - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.OPPHOLD_ELLER_ARBEID_I_NORGE, - allowsAnke: true, - path: 'opphold-eller-arbeid-i-norge', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.OPPHOLD_ELLER_ARBEID_UTENFOR_NORGE, - allowsAnke: true, - path: 'opphold-eller-arbeid-utenfor-norge', - }, - ], - }, - { - type: TemaType.TEMA, - title: { - [Languages.nb]: 'Hjelpemidler og tilrettelegging', - [Languages.en]: 'Assistive technology and facilitation', - }, - path: 'hjelpemidler-og-tilrettelegging', - innsendingsytelser: [ - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.HJELPEMIDLER, - allowsAnke: true, - path: 'hjelpemidler', - }, - { - type: TemaType.INNSENDINGSYTELSE, - innsendingsytelse: Innsendingsytelse.BILSTONAD, - allowsAnke: true, - path: 'bil', - }, - ], - }, - { - type: TemaType.INNSENDINGSYTELSE, - path: 'tilleggsstonader', - innsendingsytelse: Innsendingsytelse.TILLEGGSSTONADER, - allowsAnke: true, - }, - { - type: TemaType.EXTERNAL, - title: { [Languages.nb]: 'Økonomisk sosialhjelp', [Languages.en]: 'Financial social assistance' }, - externalUrl: { - [Languages.nb]: 'https://www.nav.no/sosialhjelp/klage', - [Languages.en]: 'https://www.nav.no/sosialhjelp/klage?lang=en', - }, - }, -]; - -export const innsendingsytelsePath = (innsendingsytelse: Innsendingsytelse | null): string | null => { - if (innsendingsytelse === null) { - return null; - } - - for (const tema of INNGANG_KATEGORIER) { - if (tema.type === TemaType.TEMA) { - const kategori = tema.innsendingsytelser.find((k) => k.innsendingsytelse === innsendingsytelse); - - if (kategori !== undefined) { - return `${tema.path}/${kategori.path}`; - } - } - - if (tema.type === TemaType.INNSENDINGSYTELSE) { - return tema.path; - } - } - - return null; -}; diff --git a/frontend/src/language/nb.tsx b/frontend/src/language/nb.tsx index 89853693..7968324f 100644 --- a/frontend/src/language/nb.tsx +++ b/frontend/src/language/nb.tsx @@ -379,7 +379,7 @@ export const nb = { }, not_found_page: { title: 'Finner ikke siden', - go_back: 'Gå tilbake til startsiden', + go_back: 'Gå tilbake til nav.no/klage', }, utfall: { [Utfall.TRUKKET]: 'Trukket', diff --git a/frontend/src/redux-api/case/klage/types.ts b/frontend/src/redux-api/case/klage/types.ts index 38f55384..520b17cf 100644 --- a/frontend/src/redux-api/case/klage/types.ts +++ b/frontend/src/redux-api/case/klage/types.ts @@ -1,5 +1,4 @@ import { Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; -import { StringValue } from '@app/kategorier/kategorier'; import { Languages } from '@app/language/types'; import { Case } from '../types'; @@ -21,6 +20,10 @@ export interface NewKlage readonly checkboxesSelected: Reason[]; } +type StringValue = { + [key in Languages]: string; +}; + export interface Klage extends ResumeKlage, Case { readonly title: StringValue; readonly language: Languages; diff --git a/frontend/src/routes/inngang/guide-panel.tsx b/frontend/src/routes/inngang/guide-panel.tsx deleted file mode 100644 index 12a9bcd1..00000000 --- a/frontend/src/routes/inngang/guide-panel.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { GuidePanel } from '@navikt/ds-react'; -import React from 'react'; -import { useIsAuthenticated } from '@app/hooks/use-user'; -import { useTranslation } from '@app/language/use-translation'; - -export const InngangGuidePanel = () => { - const { data } = useIsAuthenticated(); - const { inngang } = useTranslation(); - - const guideText = - data === true - ? inngang.guide_panel.general_info - : inngang.guide_panel.general_info.concat(inngang.guide_panel.login_info); - - return {guideText}; -}; diff --git a/frontend/src/routes/inngang/kategori.tsx b/frontend/src/routes/inngang/kategori.tsx deleted file mode 100644 index 886f80fc..00000000 --- a/frontend/src/routes/inngang/kategori.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import { Alert, Heading, LinkPanel } from '@navikt/ds-react'; -import React, { memo, useMemo } from 'react'; -import { Link, useParams } from 'react-router-dom'; -import { Breadcrumb, useBreadcrumbs } from '@app/breadcrumbs/use-breadcrumbs'; -import { IconLinkPanel } from '@app/components/icon-link-panel/icon-link-panel'; -import { Optional } from '@app/components/optional/optional'; -import { queryStringify } from '@app/functions/query-string'; -import { useInnsendingsytelseName } from '@app/hooks/use-innsendingsytelser'; -import { usePageInit } from '@app/hooks/use-page-init'; -import { useIsAuthenticated } from '@app/hooks/use-user'; -import { Document } from '@app/icons/document'; -import { Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; -import { IInnsendingsytelse, ITemaWithKategorier } from '@app/kategorier/kategorier'; -import { Languages } from '@app/language/types'; -import { useLanguage } from '@app/language/use-language'; -import { useTranslation } from '@app/language/use-translation'; -import { PageIdentifier } from '@app/logging/amplitude'; -import { useLogPageView } from '@app/logging/use-log-page-view'; -import { InngangMainContainer } from '@app/styled-components/main-container'; -import { InngangGuidePanel } from './guide-panel'; -import { AnkeLinkPanel } from './klage-anke-knapper/anke-link-panel'; -import { KlageLinkPanel } from './klage-anke-knapper/klage-link-panel'; -import { CenteredHeading, InngangPanel, PanelContainer } from './styled-components/panels'; - -interface Props extends IInnsendingsytelse { - tema?: ITemaWithKategorier | null; -} - -export const Kategori = memo( - ({ innsendingsytelse, tema = null, allowsAnke = false }: Props) => { - useLogPageView(PageIdentifier.INNGANG_INNSENDING_DIGITAL, innsendingsytelse); - const [title] = useInnsendingsytelseName(innsendingsytelse); - const lang = useLanguage(); - const { inngang } = useTranslation(); - usePageInit(`${title} \u2013 ${inngang.title_postfix}`); - const breadcrumbs = useMemo(() => getBreadcrumbs(tema, lang), [tema, lang]); - useBreadcrumbs(breadcrumbs, title); - - return ( - - - - {title} - - - - - - - - - - - }> - {inngang.innsendingsvalg.ettersendelse.title} - {inngang.innsendingsvalg.ettersendelse.description} - - - - - ); - }, - (prevProps, nextProps) => prevProps.innsendingsytelse === nextProps.innsendingsytelse, -); - -Kategori.displayName = 'InngangInnsending'; - -interface LinksProps { - innsendingsytelse: Innsendingsytelse; -} - -const Links = ({ innsendingsytelse }: LinksProps) => { - const { saksnummer } = useParams(); - const { inngang } = useTranslation(); - const { data: isAuthenticated } = useIsAuthenticated(); - - const query = useMemo(() => queryStringify({ saksnummer }), [saksnummer]); - - return ( - <> - - {inngang.innsendingsvalg.title} - - - - - {inngang.innsendingsvalg.common.warning} - - - - - - ); -}; - -const getBreadcrumbs = (inngangkategori: ITemaWithKategorier | null, lang: Languages): Breadcrumb[] => { - if (inngangkategori === null) { - return []; - } - - return [ - { - title: inngangkategori.title[lang], - url: `/${lang}/${inngangkategori.path}`, - handleInApp: true, - }, - ]; -}; diff --git a/frontend/src/routes/inngang/klage-anke-knapper/anke-link-panel.tsx b/frontend/src/routes/inngang/klage-anke-knapper/anke-link-panel.tsx deleted file mode 100644 index 58d6b8f9..00000000 --- a/frontend/src/routes/inngang/klage-anke-knapper/anke-link-panel.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { LinkPanel } from '@navikt/ds-react'; -import React, { useMemo } from 'react'; -import { Link, useParams } from 'react-router-dom'; -import { IconLinkPanel } from '@app/components/icon-link-panel/icon-link-panel'; -import { queryStringify } from '@app/functions/query-string'; -import { useIsAuthenticated } from '@app/hooks/use-user'; -import { LawBook } from '@app/icons/law-book'; -import { Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; -import { useLanguage } from '@app/language/use-language'; -import { useTranslation } from '@app/language/use-translation'; - -interface Props { - innsendingsytelse: Innsendingsytelse; -} - -export const AnkeLinkPanel = ({ innsendingsytelse }: Props) => { - const { saksnummer } = useParams(); - const lang = useLanguage(); - const { inngang } = useTranslation(); - const { data: isAuthenticated } = useIsAuthenticated(); - - const query = useMemo(() => queryStringify({ saksnummer }), [saksnummer]); - - return ( - } as={Link} to={`/${lang}/anke/ny/${innsendingsytelse}${query}`} border> - {inngang.innsendingsvalg.anke.title} - - - ); -}; - -interface DescriptionProps { - isAuthenticated?: boolean; -} - -const Description = ({ isAuthenticated }: DescriptionProps) => { - const { inngang } = useTranslation(); - - if (isAuthenticated === true) { - return {inngang.innsendingsvalg.anke.description.logged_in_digital}; - } - - return {inngang.innsendingsvalg.anke.description.logged_out_digital}; -}; diff --git a/frontend/src/routes/inngang/klage-anke-knapper/klage-link-panel.tsx b/frontend/src/routes/inngang/klage-anke-knapper/klage-link-panel.tsx deleted file mode 100644 index d0f008ac..00000000 --- a/frontend/src/routes/inngang/klage-anke-knapper/klage-link-panel.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { LinkPanel } from '@navikt/ds-react'; -import React from 'react'; -import { Link } from 'react-router-dom'; -import { IconLinkPanel } from '@app/components/icon-link-panel/icon-link-panel'; -import { useIsAuthenticated } from '@app/hooks/use-user'; -import { LetterOpened } from '@app/icons/letter-opened'; -import { Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; -import { useLanguage } from '@app/language/use-language'; -import { useTranslation } from '@app/language/use-translation'; - -interface Props { - innsendingsytelse: Innsendingsytelse; - query: string; -} - -export const KlageLinkPanel = ({ innsendingsytelse, query }: Props) => { - const lang = useLanguage(); - const { inngang } = useTranslation(); - const { data: isAuthenticated } = useIsAuthenticated(); - - return ( - } as={Link} to={`/${lang}/klage/ny/${innsendingsytelse}${query}`} border> - {inngang.innsendingsvalg.klage.title} - - - ); -}; - -interface DescriptionProps { - isAuthenticated?: boolean; -} - -const Description = ({ isAuthenticated }: DescriptionProps) => { - const { inngang } = useTranslation(); - - if (isAuthenticated === true) { - return {inngang.innsendingsvalg.klage.description.logged_in_digital}; - } - - return {inngang.innsendingsvalg.klage.description.logged_out_digital}; -}; diff --git a/frontend/src/routes/inngang/styled-components/panels.tsx b/frontend/src/routes/inngang/styled-components/panels.tsx index a373d930..1c13deb3 100644 --- a/frontend/src/routes/inngang/styled-components/panels.tsx +++ b/frontend/src/routes/inngang/styled-components/panels.tsx @@ -1,14 +1,6 @@ -import { Heading, Panel } from '@navikt/ds-react'; +import { Panel } from '@navikt/ds-react'; import { styled } from 'styled-components'; -export const PanelContainer = styled(Panel)` - display: flex; - flex-direction: column; - max-width: 1000px; - margin: 0 auto; - gap: 16px; -`; - export const InngangPanel = styled(Panel)` display: flex; flex-direction: column; @@ -16,17 +8,3 @@ export const InngangPanel = styled(Panel)` width: 100%; background-color: #fff; `; - -export const LinkContainer = styled.div` - display: grid; - grid-gap: 16px; - grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); - - @media (max-width: 768px) { - grid-template-columns: minmax(0, 1fr); - } -`; - -export const CenteredHeading = styled(Heading)` - text-align: center; -`; diff --git a/frontend/src/routes/inngang/tema-with-kategorier.tsx b/frontend/src/routes/inngang/tema-with-kategorier.tsx deleted file mode 100644 index d1625233..00000000 --- a/frontend/src/routes/inngang/tema-with-kategorier.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { Heading, LinkPanel } from '@navikt/ds-react'; -import React, { memo, useMemo } from 'react'; -import { Link } from 'react-router-dom'; -import { useBreadcrumbs } from '@app/breadcrumbs/use-breadcrumbs'; -import { DraftKlageAndAnkeLists } from '@app/components/personalised-content/personalised-content'; -import { TitleLoader } from '@app/components/text-loader/title-loader'; -import { usePageInit } from '@app/hooks/use-page-init'; -import { Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; -import { ITemaWithKategorier } from '@app/kategorier/kategorier'; -import { useLanguage } from '@app/language/use-language'; -import { useTranslation } from '@app/language/use-translation'; -import { PageIdentifier } from '@app/logging/amplitude'; -import { useLogPageView } from '@app/logging/use-log-page-view'; -import { InngangMainContainer } from '@app/styled-components/main-container'; -import { InngangGuidePanel } from './guide-panel'; -import { CenteredHeading, InngangPanel, LinkContainer, PanelContainer } from './styled-components/panels'; - -interface Props { - tema: ITemaWithKategorier; -} - -export const TemaWithKategorier = memo( - ({ tema }: Props) => { - useLogPageView(PageIdentifier.INNGANG_KATEGORIER); - const lang = useLanguage(); - const title = tema.title[lang]; - const { inngang } = useTranslation(); - usePageInit(`${title} \u2013 ${inngang.title_postfix}`); - useBreadcrumbs([], title); - - const innsendingsytelser: Innsendingsytelse[] = useMemo( - () => tema.innsendingsytelser.map(({ innsendingsytelse }) => innsendingsytelse), - [tema], - ); - - return ( - - - - {title} - - - - - - - - - {inngang.kategorier.title} - - - - - - ); - }, - (prevProps, nextProps) => prevProps.tema === nextProps.tema, -); - -TemaWithKategorier.displayName = 'TemaWithKategorier'; - -const Kategorilenker = ({ innsendingsytelser: kategorier, path }: ITemaWithKategorier) => { - const lang = useLanguage(); - - return ( - - {kategorier.map((kategori) => ( - - ))} - - ); -}; - -interface KategoriLinkProps { - innsendingsytelse: Innsendingsytelse; - path: string; -} - -export const KategoriLink = ({ innsendingsytelse, path }: KategoriLinkProps) => ( - - - - - -); diff --git a/frontend/src/routes/inngang/temaer.tsx b/frontend/src/routes/inngang/temaer.tsx deleted file mode 100644 index 4573c25c..00000000 --- a/frontend/src/routes/inngang/temaer.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { Heading, LinkPanel } from '@navikt/ds-react'; -import React from 'react'; -import { Link } from 'react-router-dom'; -import { styled } from 'styled-components'; -import { useBreadcrumbs } from '@app/breadcrumbs/use-breadcrumbs'; -import { DraftKlageAndAnkeLists } from '@app/components/personalised-content/personalised-content'; -import { TextLoader } from '@app/components/text-loader/text-loader'; -import { useInnsendingsytelserNames } from '@app/hooks/use-innsendingsytelser'; -import { usePageInit } from '@app/hooks/use-page-init'; -import { IExternalTema, INNGANG_KATEGORIER, ITemaWithKategorier, TemaType } from '@app/kategorier/kategorier'; -import { useLanguage } from '@app/language/use-language'; -import { useTranslation } from '@app/language/use-translation'; -import { PageIdentifier } from '@app/logging/amplitude'; -import { useLogPageView } from '@app/logging/use-log-page-view'; -import { KategoriLink } from '@app/routes/inngang/tema-with-kategorier'; -import { InngangMainContainer } from '@app/styled-components/main-container'; -import { InngangGuidePanel } from './guide-panel'; -import { CenteredHeading, InngangPanel, LinkContainer, PanelContainer } from './styled-components/panels'; - -export const Temaer = () => { - useLogPageView(PageIdentifier.INNGANG_HOVEDKATEGORIER); - const { inngang } = useTranslation(); - const { title } = inngang.hovedkategorier; - usePageInit(title); - useBreadcrumbs([], null); - - return ( - - - - {title} - - - - - - - - - {inngang.hovedkategorier.chooseInnsendingsytelse} - - {getLinks()} - - - - ); -}; - -const getLinks = () => - INNGANG_KATEGORIER.map((tema) => { - if (tema.type === TemaType.TEMA) { - return ; - } - - if (tema.type === TemaType.EXTERNAL) { - return ; - } - - return ; - }); - -const ExternalHovedkategoriLink = ({ title, externalUrl }: IExternalTema) => { - const lang = useLanguage(); - - return ( - - {title[lang]} - - ); -}; - -const InngangKategoriLink = ({ title, path, innsendingsytelser: kategorier }: ITemaWithKategorier) => { - const lang = useLanguage(); - const [titles, isLoading] = useInnsendingsytelserNames(kategorier.map(({ innsendingsytelse }) => innsendingsytelse)); - - return ( - - - {title[lang]} - - {titles.join(' - ')} - - - - ); -}; - -const EllipsisDescription = styled(LinkPanel.Description)` - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -`; - -const StyledWrapper = styled.div` - & { - .navds-link-panel__content { - max-width: calc(100% - 24px - 16px); - } - } -`; diff --git a/frontend/src/routes/landing-page.tsx b/frontend/src/routes/landing-page.tsx index 83b6084c..b917ce60 100644 --- a/frontend/src/routes/landing-page.tsx +++ b/frontend/src/routes/landing-page.tsx @@ -3,9 +3,8 @@ import { Navigate, useSearchParams } from 'react-router-dom'; import { LoadingPage } from '@app/components/loading-page/loading-page'; import { useInnsendingsytelseFromQuery } from '@app/hooks/use-innsendingsytelse-from-query'; import { useUser } from '@app/hooks/use-user'; -import { innsendingsytelsePath } from '@app/kategorier/kategorier'; import { useTranslation } from '@app/language/use-translation'; -import { Temaer } from './inngang/temaer'; +import { NotFoundPage } from '@app/routes/not-found-page'; export const LandingPage = () => { const [query] = useSearchParams(); @@ -17,14 +16,12 @@ export const LandingPage = () => { return {landing_page.checking_user}; } - const path = innsendingsytelsePath(innsendingsytelse); - - if (path === null) { - return ; + if (innsendingsytelse === null) { + return ; } query.delete('tema'); query.delete('tittel'); - return ; + return ; }; diff --git a/frontend/src/routes/not-found-page.tsx b/frontend/src/routes/not-found-page.tsx index a90c9548..c1b0693c 100644 --- a/frontend/src/routes/not-found-page.tsx +++ b/frontend/src/routes/not-found-page.tsx @@ -1,41 +1,13 @@ -import { Home } from '@navikt/ds-icons'; -import { Button, Heading } from '@navikt/ds-react'; -import React from 'react'; +import { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; -import { styled } from 'styled-components'; -import { useTranslation } from '@app/language/use-translation'; import { PageIdentifier } from '@app/logging/amplitude'; import { useLogPageView } from '@app/logging/use-log-page-view'; export const NotFoundPage = () => { useLogPageView(PageIdentifier.NOT_FOUND); const navigate = useNavigate(); - const { not_found_page } = useTranslation(); - const onClick = () => navigate('/'); + useEffect(() => navigate('https://www.nav.no/klage'), [navigate]); - return ( - - - 404 - - - {not_found_page.title} - - }> - {not_found_page.go_back} - - - ); + return null; }; - -const Container = styled.div` - display: flex; - flex-direction: column; - align-items: center; - padding: 32px; -`; - -const StyledButton = styled(Button)` - margin-top: 16px; -`; diff --git a/frontend/src/routes/routes.tsx b/frontend/src/routes/routes.tsx index 1bba6247..bb58a835 100644 --- a/frontend/src/routes/routes.tsx +++ b/frontend/src/routes/routes.tsx @@ -1,4 +1,4 @@ -import { ErrorBoundary, withSentryReactRouterV6Routing } from '@sentry/react'; +import { ErrorBoundary } from '@sentry/react'; import React from 'react'; import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; import { AnkebegrunnelsePage } from '@app/components/anke/innlogget/begrunnelse/anke-begrunnelse-page'; @@ -16,15 +16,12 @@ import { KlageoppsummeringPage } from '@app/components/klage/innlogget/summary/k import { SessionKlagebegrunnelsePage } from '@app/components/klage/uinnlogget/begrunnelse/klage-begrunnelse-page'; import { SessionKlageinnsendingPage } from '@app/components/klage/uinnlogget/innsending/klage-innsending-page'; import { SessionKlageoppsummeringPage } from '@app/components/klage/uinnlogget/summary/klage-oppsummering-page'; -import { Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; -import { IInnsendingsytelse, INNGANG_KATEGORIER, ITemaWithKategorier, TemaType } from '@app/kategorier/kategorier'; +import { INNSENDINGSYTELSER, Innsendingsytelse } from '@app/innsendingsytelser/innsendingsytelser'; import { LanguageComponent } from '@app/language/component'; import { Languages } from '@app/language/types'; -import { TemaWithKategorier } from '@app/routes/inngang/tema-with-kategorier'; import { CreateAnke } from './create-anke/create-anke'; import { CreateKlage } from './create-klage/create-klage'; import { DekoratorSetRedirect } from './dekorator-set-redirect'; -import { Kategori } from './inngang/kategori'; import { LandingPage } from './landing-page'; import { NavigationLogger } from './navigation-logger'; import { NotFoundPage } from './not-found-page'; @@ -32,15 +29,13 @@ import { QueryParamsHandler } from './query-params-handler'; import { LoginIfUnauthorized, UpgradeSession } from './redirects'; import { SentryFallback } from './sentry-fallback'; -const SentryRoutes = withSentryReactRouterV6Routing(Routes); - export const Router = () => ( - + }> } /> @@ -49,9 +44,6 @@ export const Router = () => ( {getCaseRoutes({ component: CreateKlage })} - {innsendingsRoutes} - {temaRoutes} - } /> @@ -91,13 +83,25 @@ export const Router = () => ( } /> + + + {INNSENDINGSYTELSER.map((innsendingsytelse) => ( + } + /> + ))} + + } /> + } /> - + @@ -105,45 +109,6 @@ export const Router = () => ( ); -const temaRoutes = INNGANG_KATEGORIER.map((tema) => { - if (tema.type === TemaType.TEMA) { - return } />; - } - - if (tema.type === TemaType.INNSENDINGSYTELSE) { - return } />; - } - - return null; -}); - -const getInnsendingRoute = ( - kategoriPath: string, - kategori: IInnsendingsytelse, - inngangkategori?: ITemaWithKategorier, -) => ( - - } /> - } - /> - -); -const innsendingsRoutes = INNGANG_KATEGORIER.flatMap((tema) => { - if (tema.type === TemaType.TEMA) { - return tema.innsendingsytelser.map((innsendingsytelse) => - getInnsendingRoute(`${tema.path}/${innsendingsytelse.path}`, innsendingsytelse, tema), - ); - } - - if (tema.type === TemaType.EXTERNAL) { - return null; - } - - return getInnsendingRoute(tema.path, tema); -}); - interface YtelseComponentProps { innsendingsytelse: Innsendingsytelse; } @@ -156,32 +121,10 @@ interface Props { } const getCaseRoutes = ({ component: Component, pathSuffix = null }: Props) => - INNGANG_KATEGORIER.flatMap((tema) => { - if (tema.type === TemaType.TEMA) { - return tema.innsendingsytelser.map((kategori) => getCaseRoute(Component, kategori.innsendingsytelse, pathSuffix)); - } - - if (tema.type === TemaType.EXTERNAL) { - return null; - } - - return getCaseRoute(Component, tema.innsendingsytelse, pathSuffix); - }); - -const getCaseRoute = (Component: YtelseComponent, innsendingsytelse: Innsendingsytelse, pathSuffix: string | null) => { - if (pathSuffix === null) { - return ( - } - /> - ); - } - - return ( - - } /> - - ); -}; + INNSENDINGSYTELSER.map((innsendingsytelse) => ( + } + /> + )); diff --git a/frontend/src/styled-components/main-container.tsx b/frontend/src/styled-components/main-container.tsx index 7ba14635..8ce0d328 100644 --- a/frontend/src/styled-components/main-container.tsx +++ b/frontend/src/styled-components/main-container.tsx @@ -13,11 +13,6 @@ const MainContainer = styled.main` } `; -export const InngangMainContainer = styled(MainContainer)` - padding-top: 64px; - background-color: #f1f1f1; -`; - export const FormMainContainer = styled(MainContainer)` padding-bottom: 128px; background-color: #fff;