diff --git a/apps/frontend/craco.config.js b/apps/frontend/craco.config.js index 00a690f30..6fd72e943 100644 --- a/apps/frontend/craco.config.js +++ b/apps/frontend/craco.config.js @@ -3,5 +3,23 @@ module.exports = { postcss: { mode: 'file', } - } + }, + // create react app is unmaintained :( + // this is by no means a good solution (we're basically telling the compiler to ignore cerain warnings) + // the good solution is to move away from create-react-app + // https://github.com/facebook/create-react-app/discussions/11767#discussioncomment-2421668 + webpack: { + configure: { + ignoreWarnings: [ + function ignoreSourcemapsloaderWarnings(warning) { + return ( + warning.module && + warning.module.resource.includes("node_modules") && + warning.details && + warning.details.includes("source-map-loader") + ); + }, + ], + }, + }, } \ No newline at end of file diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 5b0d9baa9..efa94cc7e 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -3,52 +3,52 @@ "version": "0.1.0", "private": true, "dependencies": { - "@apollo/client": "^3.3.9", - "@fontsource/source-sans-pro": "^5.0.0", - "@fortawesome/fontawesome-svg-core": "^6.1.0", - "@fortawesome/free-brands-svg-icons": "^6.0.0", - "@fortawesome/free-regular-svg-icons": "^6.0.0", - "@fortawesome/free-solid-svg-icons": "^6.0.0", + "@apollo/client": "^3.8.4", + "@fontsource/source-sans-pro": "^5.0.8", + "@fortawesome/fontawesome-svg-core": "^6.4.2", + "@fortawesome/free-brands-svg-icons": "^6.4.2", + "@fortawesome/free-regular-svg-icons": "^6.4.2", + "@fortawesome/free-solid-svg-icons": "^6.4.2", "@fortawesome/react-fontawesome": "^0.2.0", - "@navikt/aksel-icons": "^5.3.1", - "@navikt/ds-css": "^5.2.1", - "@navikt/ds-react": "^5.2.1", - "@navikt/ds-tailwind": "^5.2.1", - "@types/draft-js": "^0.11.2", - "@types/markdown-draft-js": "^2.2.2", - "@types/react-draft-wysiwyg": "^1.13.2", - "amplitude-js": "^8.17.0", - "axios": "^1.1.2", + "@microlink/react-json-view": "^1.22.2", + "@navikt/aksel-icons": "^5.6.0", + "@navikt/ds-css": "^5.6.0", + "@navikt/ds-react": "^5.6.0", + "@navikt/ds-tailwind": "^5.6.0", + "@types/draft-js": "^0.11.13", + "@types/markdown-draft-js": "^2.2.5", + "@types/react-draft-wysiwyg": "^1.13.5", + "amplitude-js": "^8.21.9", + "axios": "^1.5.1", "baseui": "^13.0.0", - "core-js": "^3.8.3", + "core-js": "^3.32.2", "draft-js": "^0.11.7", - "formik": "^2.2.6", - "graphql": "^16.0.0", + "formik": "^2.4.5", + "graphql": "^16.8.1", "history": "5.3.0", - "lodash": "^4.17.20", - "markdown-draft-js": "^2.2.1", - "moment": "^2.29.1", + "lodash": "^4.17.21", + "markdown-draft-js": "^2.4.0", + "moment": "^2.29.4", "postcss-import": "^15.1.0", "query-string": "^8.1.0", "randomcolor": "^0.6.2", "react": "^18.2.0", "react-app-polyfill": "^3.0.0", - "react-beautiful-dnd": "^13.1.0", - "react-diff-viewer": "^3.1.1", + "react-beautiful-dnd": "^13.1.1", + "react-diff-viewer-continued": "^3.2.6", "react-dom": "^18.2.0", - "react-draft-wysiwyg": "^1.14.7", - "react-json-view": "^1.21.1", - "react-markdown": "^8.0.0", - "react-markdown-editor-lite": "^1.2.4", - "react-player": "^2.9.0", + "react-draft-wysiwyg": "^1.15.0", + "react-markdown": "^9.0.0", + "react-markdown-editor-lite": "^1.3.4", + "react-player": "^2.13.0", "react-process-string": "^1.2.0", "rehype-raw": "^7.0.0", "remark-gfm": "^4.0.0", "shortid": "^2.2.16", - "styletron-engine-atomic": "^1.4.8", - "styletron-react": "^6.0.2", - "typescript": "^5.0.3", - "yup": "^1.1.1" + "styletron-engine-atomic": "^1.5.0", + "styletron-react": "^6.1.0", + "typescript": "^5.2.2", + "yup": "^1.3.1" }, "scripts": { "start": "craco start", @@ -87,30 +87,31 @@ ] }, "devDependencies": { + "@babel/plugin-transform-private-property-in-object": "^7.22.11", "@craco/craco": "^7.1.0", - "@testing-library/jest-dom": "^6.0.0", + "@testing-library/jest-dom": "^6.1.3", "@testing-library/react": "^14.0.0", - "@testing-library/user-event": "^14.0.0", - "@types/amplitude-js": "^8.0.0", - "@types/jest": "^29.1.2", - "@types/lodash": "^4.14.165", - "@types/node": "^20.1.0", - "@types/randomcolor": "^0.5.5", - "@types/react": "^18.0.15", - "@types/react-beautiful-dnd": "^13.0.0", - "@types/react-dom": "^18.0.6", - "@types/react-helmet": "^6.1.0", + "@testing-library/user-event": "^14.5.1", + "@types/amplitude-js": "^8.16.3", + "@types/jest": "^29.5.5", + "@types/lodash": "^4.14.199", + "@types/node": "^20.7.1", + "@types/randomcolor": "^0.5.7", + "@types/react": "^18.2.23", + "@types/react-beautiful-dnd": "^13.1.5", + "@types/react-dom": "^18.2.8", + "@types/react-helmet": "^6.1.7", "@types/react-router-dom": "^5.3.3", "@types/shortid": "^0.0.30", - "@types/styletron-react": "^5.0.2", + "@types/styletron-react": "^5.0.4", "@types/yup": "^0.32.0", - "autoprefixer": "^10.4.15", - "http-proxy-middleware": "^2.0.0", - "postcss": "^8.4.29", + "autoprefixer": "^10.4.16", + "http-proxy-middleware": "^2.0.6", + "postcss": "^8.4.30", "prettier": "3.0.3", "react-helmet": "^6.1.0", - "react-localization": "^1.0.15", - "react-router-dom": "^6.4.0", + "react-localization": "^1.0.19", + "react-router-dom": "^6.16.0", "react-scripts": "5.0.1", "tailwindcss": "^3.3.3" } diff --git a/apps/frontend/src/api/ArkiveringApi.ts b/apps/frontend/src/api/ArkiveringApi.ts index 2c3f862d6..0f40682ca 100644 --- a/apps/frontend/src/api/ArkiveringApi.ts +++ b/apps/frontend/src/api/ArkiveringApi.ts @@ -82,7 +82,7 @@ export const useArkiveringByEtterlevelseDokumentasjonId = (etterlevelseDokumenta .then((resp) => setData(arkiveringMapToFormVal(resp.content[0]))) .catch((e) => { setData(arkiveringMapToFormVal({ id: '' })) - console.log("couldn't find arkivering with etterlevelse dokumentasjon id = ", e) + console.log('couldn\'t find arkivering with etterlevelse dokumentasjon id = ', e) }) }, [etterlevelseDokumentasjonId]) diff --git a/apps/frontend/src/api/BehandlingApi.ts b/apps/frontend/src/api/BehandlingApi.ts index b15945ac3..b75d4238a 100644 --- a/apps/frontend/src/api/BehandlingApi.ts +++ b/apps/frontend/src/api/BehandlingApi.ts @@ -31,7 +31,7 @@ export const useBehandling = (id?: string) => { .then(setData) .catch((e) => { setData(undefined) - console.log("couldn't find behandling", e) + console.log('couldn\'t find behandling', e) }) }, [id]) @@ -72,7 +72,7 @@ export const useMyBehandlinger = () => { .catch((e) => { setData([]) setLoading(false) - console.log("couldn't find behandlinger", e) + console.log('couldn\'t find behandlinger', e) }) }, [ident]) diff --git a/apps/frontend/src/api/EtterlevelseApi.ts b/apps/frontend/src/api/EtterlevelseApi.ts index 62ebf15d7..aaec7abcd 100644 --- a/apps/frontend/src/api/EtterlevelseApi.ts +++ b/apps/frontend/src/api/EtterlevelseApi.ts @@ -113,6 +113,7 @@ export const mapEtterlevelseToFormValue = (etterlevelse: Partial, if (sb.suksesskriterieId === s.id) { sb.behovForBegrunnelse = s.behovForBegrunnelse } + return sb }) }) } else { diff --git a/apps/frontend/src/api/EtterlevelseDokumentasjonApi.ts b/apps/frontend/src/api/EtterlevelseDokumentasjonApi.ts index bcca1d319..3521a8028 100644 --- a/apps/frontend/src/api/EtterlevelseDokumentasjonApi.ts +++ b/apps/frontend/src/api/EtterlevelseDokumentasjonApi.ts @@ -74,6 +74,7 @@ export const useEtterlevelseDokumentasjon = (etterlevelseDokumentasjonId?: strin if (behandlinger && behandlinger.length > 0) { behandlinger.map((b) => { b.navn = behandlingName(b) + return b }) } setData({ ...etterlevelseDokumentasjon, behandlinger: behandlinger, virkemiddel: virkmiddel }) diff --git a/apps/frontend/src/api/TeamApi.ts b/apps/frontend/src/api/TeamApi.ts index 082e1bba4..8ff4af68e 100644 --- a/apps/frontend/src/api/TeamApi.ts +++ b/apps/frontend/src/api/TeamApi.ts @@ -120,7 +120,7 @@ export const useTeam = () => { } export const useMyTeams = () => { - const [productAreas, productAreasLoading] = useMyProductAreas() + const [productAreas] = useMyProductAreas() const [data, setData] = useState([]) const [loading, setLoading] = useState(true) const ident = user.getIdent() @@ -149,7 +149,7 @@ export const useMyTeams = () => { .catch((e) => { setData([]) setLoading(false) - console.log("couldn't find teams", e) + console.log('couldn\'t find teams', e) }) !ident && setLoading(false) }, [ident, productAreas]) diff --git a/apps/frontend/src/api/TilbakemeldingApi.ts b/apps/frontend/src/api/TilbakemeldingApi.ts index aca54b93f..c2e2685ba 100644 --- a/apps/frontend/src/api/TilbakemeldingApi.ts +++ b/apps/frontend/src/api/TilbakemeldingApi.ts @@ -47,7 +47,7 @@ export const useTilbakemeldinger = (kravNummer: number, kravVersjon: number) => .catch((e) => { setData([]) setLoading(false) - console.error("couldn't find krav", e) + console.error('couldn\'t find krav', e) }) } }, [kravNummer, kravVersjon]) diff --git a/apps/frontend/src/components/DeleteItem.tsx b/apps/frontend/src/components/DeleteItem.tsx index f747945b4..ca3e7b254 100644 --- a/apps/frontend/src/components/DeleteItem.tsx +++ b/apps/frontend/src/components/DeleteItem.tsx @@ -1,7 +1,6 @@ -import React, { useState } from 'react' +import { useState } from 'react' import { Modal, ModalBody, ModalFooter, ModalHeader } from 'baseui/modal' import { useNavigate } from 'react-router-dom' -import { deleteIcon } from './Images' import { Button } from '@navikt/ds-react' import { TrashIcon } from '@navikt/aksel-icons' diff --git a/apps/frontend/src/components/EtterlevelseDokumentasjonTema/KravCard.tsx b/apps/frontend/src/components/EtterlevelseDokumentasjonTema/KravCard.tsx index 734182ee4..3ecee403e 100644 --- a/apps/frontend/src/components/EtterlevelseDokumentasjonTema/KravCard.tsx +++ b/apps/frontend/src/components/EtterlevelseDokumentasjonTema/KravCard.tsx @@ -1,8 +1,7 @@ import { EtterlevelseMetadata, KRAV_FILTER_TYPE, KravEtterlevelseData } from '../../constants' -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { getEtterlevelseMetadataByEtterlevelseDokumentasjonAndKravNummerAndKravVersion, mapEtterlevelseMetadataToFormValue } from '../../api/EtterlevelseMetadataApi' import { Block } from 'baseui/block' -import Button from '../common/Button' import { ettlevColors } from '../../util/theme' import { borderStyle, marginAll } from '../common/Style' import { LabelSmall, ParagraphXSmall } from 'baseui/typography' @@ -12,7 +11,7 @@ import TildeltPopoever from '../etterlevelseMetadata/TildeltPopover' import { faEllipsisVertical } from '@fortawesome/free-solid-svg-icons' import { arkCheckIcon, arkPennIcon, warningAlert } from '../Images' import { getEtterlevelserByEtterlevelseDokumentasjonIdKravNumber } from '../../api/EtterlevelseApi' -import { useLocation, useNavigate } from 'react-router-dom' +import { useLocation } from 'react-router-dom' import { getNumberOfDaysBetween } from '../../util/checkAge' import { isFerdigUtfylt } from '../../pages/EtterlevelseDokumentasjonTemaPage' import { getEtterlevelseStatus, getStatusLabelColor } from '../etterlevelseDokumentasjon/common/utils' @@ -21,7 +20,6 @@ import RouteLink from '../common/RouteLink' export const KravCard = (props: { krav: KravEtterlevelseData; noStatus?: boolean; etterlevelseDokumentasjonId: string; noVarsling?: boolean; kravFilter: KRAV_FILTER_TYPE }) => { const [nyVersionFlag, setNyVersionFlag] = useState(false) const [hover, setHover] = useState(false) - const navigate = useNavigate() const location = useLocation() const [kravAge, setKravAge] = useState(0) diff --git a/apps/frontend/src/components/EtterlevelseDokumentasjonTema/common/utils.ts b/apps/frontend/src/components/EtterlevelseDokumentasjonTema/common/utils.ts index 6d868063b..fccd768f8 100644 --- a/apps/frontend/src/components/EtterlevelseDokumentasjonTema/common/utils.ts +++ b/apps/frontend/src/components/EtterlevelseDokumentasjonTema/common/utils.ts @@ -10,6 +10,7 @@ export const filterKrav = async (allKravPriority: KravPrioritering[], kravList?: unfilteredkraver.map((k) => { const priority = allKravPriority.filter((kp) => kp.kravNummer === k.kravNummer && kp.kravVersjon === k.kravVersjon) k.prioriteringsId = priority.length ? priority[0].prioriteringsId : '' + return k }) const sortedKrav = sortKraverByPriority(unfilteredkraver, temaData?.shortName || '') diff --git a/apps/frontend/src/components/Header.tsx b/apps/frontend/src/components/Header.tsx index 4d56343aa..31ceaf29f 100644 --- a/apps/frontend/src/components/Header.tsx +++ b/apps/frontend/src/components/Header.tsx @@ -24,7 +24,7 @@ import { IconDefinition } from '@fortawesome/fontawesome-svg-core' import { faBars, faChevronDown, faChevronUp, faTimes } from '@fortawesome/free-solid-svg-icons' import { faUser } from '@fortawesome/free-regular-svg-icons' import SkipToContent from './common/SkipToContent/SkipToContent' -import { borderColor, borderStyle, borderWidth, marginAll } from './common/Style' +import { marginAll } from './common/Style' import { AlertType, Melding, MeldingStatus, MeldingType } from '../constants' import { getMeldingByType } from '../api/MeldingApi' import { Markdown } from './common/Markdown' @@ -101,10 +101,6 @@ const LoggedInHeader = () => { // { label: intl.settings, href: '/admin/settings', disabled: true }, ] : [] - const otherPages = [ - { label: 'Mine innstillinger', href: '/innstillinger', disabled: true }, - { label: 'Hjelp', href: '/hjelp', disabled: true }, - ] return ( @@ -359,7 +355,7 @@ const Header = (props: { noSearchBar?: boolean; noLoginButton?: boolean }) => { {systemVarsel && systemVarsel.meldingStatus === MeldingStatus.ACTIVE && (
diff --git a/apps/frontend/src/components/Lov.tsx b/apps/frontend/src/components/Lov.tsx index 4367238fa..4af85d4a2 100644 --- a/apps/frontend/src/components/Lov.tsx +++ b/apps/frontend/src/components/Lov.tsx @@ -1,9 +1,7 @@ -import React from 'react' import { codelist, ListName } from '../services/Codelist' import { env } from '../util/env' import { Regelverk } from '../constants' import { Block } from 'baseui/block' -import CustomizedLink from './common/CustomizedLink' import { Link } from '@navikt/ds-react' const reactProcessString = require('react-process-string') diff --git a/apps/frontend/src/components/Navigation/Burger/index.tsx b/apps/frontend/src/components/Navigation/Burger/index.tsx index 27f755c0f..a6b9e99db 100644 --- a/apps/frontend/src/components/Navigation/Burger/index.tsx +++ b/apps/frontend/src/components/Navigation/Burger/index.tsx @@ -2,7 +2,7 @@ import * as React from 'react' import Button from '../../common/Button' import { ANCHOR, Drawer } from 'baseui/drawer' import { theme } from '../../../util' -import { Block, BlockProps } from 'baseui/block' +import { Block } from 'baseui/block' import { StyledLink } from 'baseui/link' import { HeadingXLarge, ParagraphMedium } from 'baseui/typography' import RouteLink from '../../common/RouteLink' @@ -10,27 +10,17 @@ import { useLocation } from 'react-router-dom' import { env } from '../../../util/env' import { useStyletron } from 'styletron-react' import { user } from '../../../services/User' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faBars, faChevronDown, faChevronRight, faTimes } from '@fortawesome/free-solid-svg-icons' +import { faBars, faTimes } from '@fortawesome/free-solid-svg-icons' import { ettlevColors } from '../../../util/theme' import { arkPennIcon, exitIcon, grafIcon, husIcon, paragrafIcon } from '../../Images' -const drawerFooterProps: BlockProps = { - display: 'flex', - width: '100%', - height: '100%', - bottom: '0', - alignItems: 'flex-end', - marginTop: theme.sizing.scale800, -} - const Brand = () => ( Støtte til etterlevelse ) -const MenuItem = (props: { to: string; text: string; icon: string; setShowMenu: Function }) => ( +const MenuItem = (props: { to: string, text: string, icon: string, setShowMenu: Function }) => ( ) -const NavItem = (props: { to: string; text: string }) => ( - - - - - - - {props.text} - - -) - const LoginButton = (props: { location: string }) => { const [useCss] = useStyletron() const linkCss = useCss({ textDecoration: 'none', color: 'white' }) diff --git a/apps/frontend/src/components/Navigation/Footer.tsx b/apps/frontend/src/components/Navigation/Footer.tsx index 3bc74b472..3dd62ea45 100644 --- a/apps/frontend/src/components/Navigation/Footer.tsx +++ b/apps/frontend/src/components/Navigation/Footer.tsx @@ -1,12 +1,5 @@ import { Block } from 'baseui/block' -import { theme } from '../../util' import { datajegerSlackLink, documentationLink, githubRepo } from '../../util/config' -import SlackLogo from '../../resources/Slack_Monochrome_White.svg' -import { LabelMedium } from 'baseui/typography' -import { StatefulTooltip } from 'baseui/tooltip' -import { env } from '../../util/env' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faCodeBranch } from '@fortawesome/free-solid-svg-icons' import * as React from 'react' import { ExternalLink } from '../common/RouteLink' import ToTopCircle from '../../resources/ToTopCircle.svg' diff --git a/apps/frontend/src/components/admin/CodeList/LovCode.tsx b/apps/frontend/src/components/admin/CodeList/LovCode.tsx index 41922fa0f..69817f0c2 100644 --- a/apps/frontend/src/components/admin/CodeList/LovCode.tsx +++ b/apps/frontend/src/components/admin/CodeList/LovCode.tsx @@ -9,10 +9,8 @@ import { LovCodeData, LovCodeRelevans, lovCodeRelevansToOptions, - lovCodeRelevansToText, TemaCodeData, } from '../../../services/Codelist' -import * as React from 'react' import { SIZE as InputSIZE } from 'baseui/input' import { OptionList } from '../../common/Inputs' import { temaBilder } from '../../Images' diff --git a/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx b/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx index 70f47cd36..0355870a0 100644 --- a/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx +++ b/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx @@ -1,5 +1,5 @@ import { LabelLarge, LabelSmall } from 'baseui/typography' -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import moment from 'moment' import { Pagination } from 'baseui/pagination' import { TriangleDown } from 'baseui/icon' @@ -18,9 +18,8 @@ import { intl } from '../../../util/intl/intl' import { getAudits } from './AuditApi' import { Cell, Row, Table } from '../../common/Table' import * as _ from 'lodash' -import randomColor from 'randomcolor' import { theme } from '../../../util' -import ReactJson from 'react-json-view' +import ReactJson from '@microlink/react-json-view' import { ObjectLink } from '../../common/RouteLink' import { CustomizedStatefulSelect } from '../../common/CustomizedSelect' import { buttonContentStyle } from '../../common/Button' @@ -32,14 +31,6 @@ export const AuditRecentTable = (props: { show: boolean; tableType?: ObjectType const [limit, setLimit] = useState(20) const [table, setTable] = useState(props.tableType) - const colors = _.uniq(audits.content.map((a) => a.tableId)).reduce( - (val, id) => { - val[id] = randomColor({ seed: id, luminosity: 'dark' }) - return val - }, - {} as { [id: string]: string }, - ) - useEffect(() => { ;(async () => { props.show && setAudits(await getAudits(page - 1, limit, table)) diff --git a/apps/frontend/src/components/admin/audit/AuditView.tsx b/apps/frontend/src/components/admin/audit/AuditView.tsx index 8405bf243..c85a9841f 100644 --- a/apps/frontend/src/components/admin/audit/AuditView.tsx +++ b/apps/frontend/src/components/admin/audit/AuditView.tsx @@ -1,6 +1,6 @@ import moment from 'moment' import { Block } from 'baseui/block' -import ReactJson from 'react-json-view' +import ReactJson from '@microlink/react-json-view' import React, { useEffect, useState } from 'react' import { LabelLarge } from 'baseui/typography' import { AuditActionIcon, AuditLabel as Label } from './AuditComponents' @@ -9,7 +9,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faBinoculars, faExchangeAlt, faTimes } from '@fortawesome/free-solid-svg-icons' import { PLACEMENT, StatefulTooltip } from 'baseui/tooltip' import { StatefulPopover } from 'baseui/popover' -import DiffViewer from 'react-diff-viewer' +import DiffViewer, { DiffMethod } from 'react-diff-viewer-continued' import { Spinner } from 'baseui/spinner' import { useRefs } from '../../../util/hooks' import { theme } from '../../../util' @@ -109,6 +109,8 @@ export const AuditView = (props: AuditViewProps) => { rightTitle="Current" oldValue={JSON.stringify(auditLog?.audits[index + 1]?.data, null, 2)} newValue={JSON.stringify(audit.data, null, 2)} + showDiffOnly={true} + compareMethod={DiffMethod.LINES} /> )} diff --git a/apps/frontend/src/components/admin/settings/SettingsPage.tsx b/apps/frontend/src/components/admin/settings/SettingsPage.tsx index 0bfc80b78..c739639e1 100644 --- a/apps/frontend/src/components/admin/settings/SettingsPage.tsx +++ b/apps/frontend/src/components/admin/settings/SettingsPage.tsx @@ -10,13 +10,11 @@ import { Markdown } from '../../common/Markdown' import { CustomizedStatefulTextarea } from '../../common/CustomizedTextarea' import { ettlevColors, responsivePaddingSmall, responsiveWidthSmall } from '../../../util/theme' import { Helmet } from 'react-helmet' -import { useLocation } from 'react-router-dom' export const SettingsPage = () => { const [loading, setLoading] = React.useState(true) const [error, setError] = useState() const [settings, setSettings] = useState() - const location = useLocation() const load = async () => { setLoading(true) diff --git a/apps/frontend/src/components/behandlingsTema/KravCard.tsx b/apps/frontend/src/components/behandlingsTema/KravCard.tsx index b1c53a52c..b87ac5e87 100644 --- a/apps/frontend/src/components/behandlingsTema/KravCard.tsx +++ b/apps/frontend/src/components/behandlingsTema/KravCard.tsx @@ -1,8 +1,7 @@ import { EtterlevelseMetadata, KRAV_FILTER_TYPE, KravEtterlevelseData } from '../../constants' -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { getEtterlevelseMetadataByBehandlingsIdAndKravNummerAndKravVersion, mapEtterlevelseMetadataToFormValue } from '../../api/EtterlevelseMetadataApi' import { Block } from 'baseui/block' -import Button from '../common/Button' import { ettlevColors } from '../../util/theme' import { borderStyle, marginAll } from '../common/Style' import { LabelSmall, ParagraphXSmall } from 'baseui/typography' @@ -14,14 +13,13 @@ import { isFerdigUtfylt } from '../../pages/BehandlingTemaPage' import { faEllipsisVertical } from '@fortawesome/free-solid-svg-icons' import { arkCheckIcon, arkPennIcon, warningAlert } from '../Images' import { getEtterlevelserByBehandlingsIdKravNumber } from '../../api/EtterlevelseApi' -import { useLocation, useNavigate } from 'react-router-dom' +import { useLocation } from 'react-router-dom' import { getNumberOfDaysBetween } from '../../util/checkAge' import RouteLink from '../common/RouteLink' export const KravCard = (props: { krav: KravEtterlevelseData; noStatus?: boolean; behandlingId: string; noVarsling?: boolean; kravFilter: KRAV_FILTER_TYPE }) => { const [nyVersionFlag, setNyVersionFlag] = useState(false) const [hover, setHover] = useState(false) - const navigate = useNavigate() const location = useLocation() const [kravAge, setKravAge] = useState(0) diff --git a/apps/frontend/src/components/behandlingsTema/SecondaryHeader.tsx b/apps/frontend/src/components/behandlingsTema/SecondaryHeader.tsx index 6e24e71e6..390e478b5 100644 --- a/apps/frontend/src/components/behandlingsTema/SecondaryHeader.tsx +++ b/apps/frontend/src/components/behandlingsTema/SecondaryHeader.tsx @@ -1,13 +1,12 @@ import { Block } from 'baseui/block' import Button from '../common/Button' -import { borderRadius, marginAll, paddingAll } from '../common/Style' +import { borderRadius, marginAll } from '../common/Style' import { HeadingXXLarge, LabelSmall } from 'baseui/typography' import { ettlevColors, maxPageWidth, responsivePaddingExtraLarge } from '../../util/theme' import { angleIcon, page2Icon } from '../Images' import CustomizedModal from '../common/CustomizedModal' import { getTemaMainHeader } from '../../pages/TemaPage' -import React, { useState } from 'react' -import { useNavigate } from 'react-router-dom' +import { useState } from 'react' import { Behandling } from '../../constants' import { LovCode, TemaCode } from '../../services/Codelist' @@ -16,11 +15,9 @@ type SecondaryHeaderProps = { temaData: TemaCode | undefined lovListe: LovCode[] } -export const SecondaryHeader = ({ behandling, temaData, lovListe }: SecondaryHeaderProps) => { +export const SecondaryHeader = ({ temaData, lovListe }: SecondaryHeaderProps) => { const [isTemaModalOpen, setIsTemaModalOpen] = useState(false) - const navigate = useNavigate() - return ( diff --git a/apps/frontend/src/components/behandlingsTema/common/utils.ts b/apps/frontend/src/components/behandlingsTema/common/utils.ts index c8c62e4c7..3dc53e971 100644 --- a/apps/frontend/src/components/behandlingsTema/common/utils.ts +++ b/apps/frontend/src/components/behandlingsTema/common/utils.ts @@ -10,6 +10,7 @@ export const filterKrav = async (allKravPriority: KravPrioritering[], kravList?: unfilteredkraver.map((k) => { const priority = allKravPriority.filter((kp) => kp.kravNummer === k.kravNummer && kp.kravVersjon === k.kravVersjon) k.prioriteringsId = priority.length ? priority[0].prioriteringsId : '' + return k }) const sortedKrav = sortKraverByPriority(unfilteredkraver, temaData?.shortName || '') diff --git a/apps/frontend/src/components/common/Button.tsx b/apps/frontend/src/components/common/Button.tsx index 966d6cb2c..73f912e60 100644 --- a/apps/frontend/src/components/common/Button.tsx +++ b/apps/frontend/src/components/common/Button.tsx @@ -173,7 +173,7 @@ export const ExternalButton = ({ const underlineStyle = underlineHover ? 'underline-hover' : 'outline' const actualSize = size || 'compact' return ( - + diff --git a/apps/frontend/src/components/common/CustomizedAccordion.tsx b/apps/frontend/src/components/common/CustomizedAccordion.tsx index 1a053f43c..11b3d65e2 100644 --- a/apps/frontend/src/components/common/CustomizedAccordion.tsx +++ b/apps/frontend/src/components/common/CustomizedAccordion.tsx @@ -26,9 +26,6 @@ type CustomProps = CustomizedPanelProps & PanelProps export const CustomizedPanel = (props: CustomProps) => { const { expanded } = props - const headerBackgroundColor = props.HeaderBackgroundColor ? props.HeaderBackgroundColor : ettlevColors.white - const headerActiveBackgroundColor = props.HeaderActiveBackgroundColor ? props.HeaderActiveBackgroundColor : ettlevColors.grey50 - const customOverrides: PanelOverrides = { ToggleIcon: { component: () => { diff --git a/apps/frontend/src/components/common/CustomizedBreadcrumbs.tsx b/apps/frontend/src/components/common/CustomizedBreadcrumbs.tsx index f83e05e55..e8f0751ae 100644 --- a/apps/frontend/src/components/common/CustomizedBreadcrumbs.tsx +++ b/apps/frontend/src/components/common/CustomizedBreadcrumbs.tsx @@ -1,4 +1,3 @@ -import _ from 'lodash' import { BodyShort, Link } from '@navikt/ds-react' import { ChevronRightIcon } from '@navikt/aksel-icons' @@ -19,8 +18,8 @@ const CustomizedBreadcrumbs = (props: CustomizedProps) => { const getName = (pathName: string) => (pathName.length > 25 ? pathName.substring(0, 25) + '...' : pathName) const linkColor = /^\/(lov|krav|etterlevelse)\//.test(window.location.pathname) - ? "text-white" - : "text-text-default" + ? 'text-white' + : 'text-text-default' return (
diff --git a/apps/frontend/src/components/common/CustomizedTabs.tsx b/apps/frontend/src/components/common/CustomizedTabs.tsx index 9b916ddc3..0c42dd347 100644 --- a/apps/frontend/src/components/common/CustomizedTabs.tsx +++ b/apps/frontend/src/components/common/CustomizedTabs.tsx @@ -1,11 +1,10 @@ import * as React from 'react' -import { useState } from 'react' +import { ReactNode, useState } from 'react' import { FILL, ORIENTATION, Tab, TabProps, Tabs, TabsOverrides } from 'baseui/tabs-motion' import { StyleObject } from 'styletron-standard' import { borderColor, borderStyle, borderWidth, marginZero, paddingZero } from './Style' import { theme } from '../../util' import { ettlevColors } from '../../util/theme' -import { ReactNode } from 'react-markdown/lib/react-markdown' import _ from 'lodash' export const CustomizedTab = (props: TabProps) => { @@ -26,7 +25,7 @@ interface CustomizedTabsProps { small?: boolean tabs?: TabsContent[] - children?: React.ReactNode + children?: ReactNode activeKey?: React.Key disabled?: boolean fill?: (typeof FILL)[keyof typeof FILL] diff --git a/apps/frontend/src/components/common/DotTag.tsx b/apps/frontend/src/components/common/DotTag.tsx index 5731fdb6f..313a6c30b 100644 --- a/apps/frontend/src/components/common/DotTag.tsx +++ b/apps/frontend/src/components/common/DotTag.tsx @@ -29,7 +29,7 @@ const Content = (props: { item: ReactNode | string; list?: ListName; linkCodelis ) return <>{codelist.getShortname(list, itemString)} } - if (markdown) return + if (markdown) return return <>{item} } diff --git a/apps/frontend/src/components/common/Markdown.tsx b/apps/frontend/src/components/common/Markdown.tsx index ec872ab2b..6bbc82ba3 100644 --- a/apps/frontend/src/components/common/Markdown.tsx +++ b/apps/frontend/src/components/common/Markdown.tsx @@ -1,41 +1,30 @@ import ReactMarkdown from 'react-markdown' -import { useDebouncedState } from '../../util/hooks' import MdEditor from 'react-markdown-editor-lite' import 'react-markdown-editor-lite/lib/index.css' import { Block } from 'baseui/block' -import { theme } from '../../util' import { ExternalLink } from './RouteLink' import { markdownLink } from '../../util/config' import remarkGfm from 'remark-gfm' import rehypeRaw from 'rehype-raw' import { ettlevColors } from '../../util/theme' import { BodyLong, BodyShort, Heading, Link, List } from '@navikt/ds-react' -import { ExternalLinkIcon } from '@navikt/aksel-icons' export const Markdown = ({ vertical, escapeHtml = true, shortenLinks, - noMargin, source, sources: sourcesOrig, p1, fontColor, - fontSize, - maxWidth, - externalLink, }: { source?: string sources?: string[] escapeHtml?: boolean - noMargin?: boolean shortenLinks?: boolean vertical?: boolean p1?: boolean fontColor?: string - fontSize?: string - maxWidth?: string - externalLink?: boolean }) => { const renderers = { p: (parProps: any) => { @@ -140,15 +129,12 @@ type MarkdownEditorProps = { } export const MarkdownEditor = (props: MarkdownEditorProps) => { - // Reduce UI lag by only updating field at set interval - const [val, setVal] = useDebouncedState(props.initialValue, 500, props.setValue) - + return ( } - onChange={(data) => setVal(data.text)} onImageUpload={props.onImageUpload} /> ) diff --git a/apps/frontend/src/components/common/PanelLink.tsx b/apps/frontend/src/components/common/PanelLink.tsx index 984a8c115..86ce70b95 100644 --- a/apps/frontend/src/components/common/PanelLink.tsx +++ b/apps/frontend/src/components/common/PanelLink.tsx @@ -8,7 +8,6 @@ import { HeadingXLarge, LabelLarge, LabelSmall, ParagraphMedium, ParagraphSmall, import { arrowRightIcon, navChevronRightIcon } from '../Images' import * as _ from 'lodash' import Button from './Button' -import { ampli } from '../../services/Amplitude' interface PanelProps { href: string @@ -161,7 +160,7 @@ export const PanelExternalLink = ({ hideChevron, }: PanelProps) => { return ( - + { const [loading, setLoading] = useState(true) - const [image, setImage] = React.useState(personImageLink(props.ident)) - const [error, setError] = React.useState(false) + const [image] = useState(personImageLink(props.ident)) + const [error, setError] = useState(false) const size = props.size || '42px' return ( diff --git a/apps/frontend/src/components/common/PropertyLabel.tsx b/apps/frontend/src/components/common/PropertyLabel.tsx index acd9b929b..ed0093567 100644 --- a/apps/frontend/src/components/common/PropertyLabel.tsx +++ b/apps/frontend/src/components/common/PropertyLabel.tsx @@ -23,7 +23,7 @@ export const Label = (props: LabelProps) => { {props.markdown ? ( - + ) : ( props.children @@ -38,7 +38,7 @@ export const LabelAboveContent = (props: LabelProps) => { {props.markdown ? ( - + ) : ( props.children diff --git a/apps/frontend/src/components/common/RouteLink.tsx b/apps/frontend/src/components/common/RouteLink.tsx index bc6a29534..82dbefe53 100644 --- a/apps/frontend/src/components/common/RouteLink.tsx +++ b/apps/frontend/src/components/common/RouteLink.tsx @@ -10,7 +10,6 @@ import _ from 'lodash' import { user } from '../../services/User' import { loginUrl } from '../Header' import { ettlevColors } from '../../util/theme' -import { externalLinkIcon } from '../Images' import { Link } from '@navikt/ds-react' type RouteLinkProps = { @@ -100,7 +99,7 @@ export const urlForObject = (type: NavigableItem | string, id: string, audit?: A case ObjectType.Melding: return '/admin/varsel' } - console.warn("couldn't find object type" + type) + console.warn('couldn\'t find object type' + type) return '' } @@ -110,19 +109,12 @@ export const ObjectLink = (props: ObjectLinkProps) => { if (props.disable) { link = props.children - } else if (props.external) { + } else link = ( - + {props.children} ) - } else { - link = ( - - {props.children} - - ) - } return props.withHistory ? ( @@ -138,17 +130,13 @@ export const ExternalLink = ({ href, children, className, - hideUnderline, label, - fontColor, openOnSamePage, }: { href: string className?: string - hideUnderline?: boolean label?: string children: React.ReactNode - fontColor?: string openOnSamePage?: boolean }) => { return ( @@ -159,7 +147,7 @@ export const ExternalLink = ({ rel="noopener noreferrer" aria-label={label} > - {children} {!openOnSamePage && " (åpnes i ny fane)"} + {children} {!openOnSamePage && ' (åpnes i ny fane)'} ) } \ No newline at end of file diff --git a/apps/frontend/src/components/common/SkipToContent/SkipToContent.tsx b/apps/frontend/src/components/common/SkipToContent/SkipToContent.tsx index a8fcc8304..87cb79481 100644 --- a/apps/frontend/src/components/common/SkipToContent/SkipToContent.tsx +++ b/apps/frontend/src/components/common/SkipToContent/SkipToContent.tsx @@ -1,6 +1,5 @@ -import { Block, BlockProps } from 'baseui/block' +import { Block } from 'baseui/block' import { LabelSmall } from 'baseui/typography' -import React from 'react' import { StyleObject } from 'styletron-react' import { ettlevColors } from '../../../util/theme' import CustomizedLink from '../CustomizedLink' diff --git a/apps/frontend/src/components/common/TeamName.tsx b/apps/frontend/src/components/common/TeamName.tsx index e466100b4..ed44dd1f1 100644 --- a/apps/frontend/src/components/common/TeamName.tsx +++ b/apps/frontend/src/components/common/TeamName.tsx @@ -3,7 +3,6 @@ import { teamKatTeamLink } from '../../util/config' import { Block } from 'baseui/block' import { theme } from '../../util' import { StyleObject } from 'styletron-react' -import _ from 'lodash' import { Link } from '@navikt/ds-react' export const TeamName = (props: { id: string; link?: boolean; fontColor?: string; style?: StyleObject }) => { diff --git a/apps/frontend/src/components/etterlevelse/Edit/EtterlevelseEditFields.tsx b/apps/frontend/src/components/etterlevelse/Edit/EtterlevelseEditFields.tsx index 42bbad10b..4a4f1dd7a 100644 --- a/apps/frontend/src/components/etterlevelse/Edit/EtterlevelseEditFields.tsx +++ b/apps/frontend/src/components/etterlevelse/Edit/EtterlevelseEditFields.tsx @@ -11,7 +11,7 @@ import { SuksesskriterierBegrunnelseEdit } from './SuksesskriterieBegrunnelseEdi import { KIND as NKIND, Notification } from 'baseui/notification' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faTimesCircle } from '@fortawesome/free-solid-svg-icons' -import { borderColor, borderRadius, borderStyle, borderWidth, marginAll, padding } from '../../common/Style' +import { borderColor, borderRadius, borderStyle, borderWidth, marginAll } from '../../common/Style' import moment from 'moment' import { CustomizedAccordion, CustomizedPanel } from '../../common/CustomizedAccordion' import { AllInfo } from '../../krav/ViewKrav' @@ -69,10 +69,10 @@ export const EtterlevelseEditFields = ({ setEtterlevelseMetadata, setIsFormDirty, }: EditProps) => { - const [etterlevelseStatus, setEtterlevelseStatus] = React.useState( + const [etterlevelseStatus] = React.useState( editedEtterlevelse ? editedEtterlevelse.status : etterlevelse.status || EtterlevelseStatus.UNDER_REDIGERING, ) - const [radioHover, setRadioHover] = React.useState('') + const [radioHover] = React.useState('') const [isOppfylesSenere, setOppfylesSenere] = React.useState(etterlevelseStatus === EtterlevelseStatus.OPPFYLLES_SENERE) const [isNotatfeltOpen, setIsNotatfeltOpen] = React.useState(false) diff --git a/apps/frontend/src/components/etterlevelse/Edit/SuksesskriterieBegrunnelseEdit.tsx b/apps/frontend/src/components/etterlevelse/Edit/SuksesskriterieBegrunnelseEdit.tsx index 5d50257e5..59ff2e750 100644 --- a/apps/frontend/src/components/etterlevelse/Edit/SuksesskriterieBegrunnelseEdit.tsx +++ b/apps/frontend/src/components/etterlevelse/Edit/SuksesskriterieBegrunnelseEdit.tsx @@ -17,8 +17,6 @@ import { buttonContentStyle } from '../../common/Button' import { Markdown } from '../../common/Markdown' import { ALIGN, Radio, RadioGroup, RadioGroupOverrides, RadioOverrides } from 'baseui/radio' -const paddingLeft = '30px' - const radioButtonOverrides: RadioOverrides & RadioGroupOverrides = { Root: { style: ({ $isFocused, $checked }) => ({ @@ -289,7 +287,7 @@ const KriterieBegrunnelse = ({ }, }} > - + diff --git a/apps/frontend/src/components/etterlevelse/EditEtterlevelse.tsx b/apps/frontend/src/components/etterlevelse/EditEtterlevelse.tsx index da20796ac..9f091ac63 100644 --- a/apps/frontend/src/components/etterlevelse/EditEtterlevelse.tsx +++ b/apps/frontend/src/components/etterlevelse/EditEtterlevelse.tsx @@ -351,7 +351,7 @@ export const EditEtterlevelse = ({ Hensikten med kravet - + Hensikten med kravet - + date && moment(date).format('ll') - const getHeaderText = (status: EtterlevelseStatus) => { switch (status) { case EtterlevelseStatus.IKKE_RELEVANT: @@ -306,7 +304,7 @@ export const ViewEtterlevelse = ({ }, }} > - + diff --git a/apps/frontend/src/components/etterlevelseDokumentasjon/TemaCardEtterlevelseDokumentasjon.tsx b/apps/frontend/src/components/etterlevelseDokumentasjon/TemaCardEtterlevelseDokumentasjon.tsx index fca96fca1..422cd5fb6 100644 --- a/apps/frontend/src/components/etterlevelseDokumentasjon/TemaCardEtterlevelseDokumentasjon.tsx +++ b/apps/frontend/src/components/etterlevelseDokumentasjon/TemaCardEtterlevelseDokumentasjon.tsx @@ -6,7 +6,6 @@ import { cardWidth, useKravCounter } from '../../pages/TemaPage' import { Block } from 'baseui/block' import { ParagraphXSmall } from 'baseui/typography' import { ProgressBar, SIZE } from 'baseui/progress-bar' -import React from 'react' import { HeaderContent } from './HeaderContent' import { isFerdigUtfylt } from '../../pages/BehandlingTemaPage' import moment from 'moment' @@ -26,14 +25,13 @@ export const TemaCardEtterlevelseDokumentasjon = (props: TemaCardEtterlevelseDok const lovcodes = lover.map((c) => c.code) const krav = stats.filter((k) => k.regelverk.map((r: any) => r.lov.code).some((r: any) => lovcodes.includes(r))) const utgaattKrav = utgaattStats.filter((k) => k.regelverk.map((r: any) => r.lov.code).some((r: any) => lovcodes.includes(r))) - const { data, loading } = useKravCounter({ lover: lover.map((c) => c.code) }, { skip: !lover.length }) + const { data } = useKravCounter({ lover: lover.map((c) => c.code) }, { skip: !lover.length }) let nyttKravCounter = 0 let nyttKravVersjonCounter = 0 let utfylt = 0 let underArbeid = 0 - let tilUtfylling = 0 krav.forEach((k) => { const kravActivatedDate = moment(k.aktivertDato).toDate() @@ -48,8 +46,6 @@ export const TemaCardEtterlevelseDokumentasjon = (props: TemaCardEtterlevelseDok utfylt += 1 } else if (k.etterlevelser.length && !isFerdigUtfylt(k.etterlevelser[0].status)) { underArbeid += 1 - } else { - tilUtfylling += 1 } }) diff --git a/apps/frontend/src/components/etterlevelseDokumentasjon/edit/EditEtterlevelseDokumentasjonModal.tsx b/apps/frontend/src/components/etterlevelseDokumentasjon/edit/EditEtterlevelseDokumentasjonModal.tsx index d08adb082..c4ca987ee 100644 --- a/apps/frontend/src/components/etterlevelseDokumentasjon/edit/EditEtterlevelseDokumentasjonModal.tsx +++ b/apps/frontend/src/components/etterlevelseDokumentasjon/edit/EditEtterlevelseDokumentasjonModal.tsx @@ -31,8 +31,6 @@ import { intl } from '../../../util/intl/intl' import { SelectOverrides, TYPE } from 'baseui/select' import { useSearchTeam } from '../../../api/TeamApi' import { RenderTagList } from '../../common/TagList' -import { useSearchVirkemiddel } from '../../../api/VirkemiddelApi' -import { Checkbox, LABEL_PLACEMENT } from 'baseui/checkbox' import { useNavigate } from 'react-router-dom' import { updateBehandlingNameWithNumber } from '../common/utils' @@ -84,7 +82,6 @@ export const EditEtterlevelseDokumentasjonModal = (props: EditEtterlevelseDokume const [hover, setHover] = useState() const [isEtterlevelseDokumentasjonerModalOpen, setIsEtterlevelseDokumntasjonerModalOpen] = useState(false) const [behandlingSearchResult, setBehandlingSearchResult, loadingBehandlingSearchResult] = useSearchBehandling() - const [virkemiddelSearchResult, setVirkemiddelSearchResult, loadingVirkemiddelSearchResult] = useSearchVirkemiddel() const [selectedVirkemiddel, setSelectedVirkemiddel] = useState() const [teamSearchResult, setTeamSearchResult, loadingTeamSearchResult] = useSearchTeam() const navigate = useNavigate() diff --git a/apps/frontend/src/components/krav/EditKrav.tsx b/apps/frontend/src/components/krav/EditKrav.tsx index 746e43b17..95cfb5f8e 100644 --- a/apps/frontend/src/components/krav/EditKrav.tsx +++ b/apps/frontend/src/components/krav/EditKrav.tsx @@ -32,7 +32,6 @@ import { Modal as BaseModal, ModalBody, ModalHeader } from 'baseui/modal' import { EditKravRelasjoner } from './Edit/EditKravRelasjoner' import AlertUnsavedPopup from '../common/AlertUnsavedPopup' import _ from 'lodash' -import { EditVirkemidler } from './Edit/KravEditVirkemidler' type EditKravProps = { krav: KravQL diff --git a/apps/frontend/src/components/krav/Etterlevelser.tsx b/apps/frontend/src/components/krav/Etterlevelser.tsx index b80c1afef..e2551a1f7 100644 --- a/apps/frontend/src/components/krav/Etterlevelser.tsx +++ b/apps/frontend/src/components/krav/Etterlevelser.tsx @@ -4,7 +4,7 @@ import { HeadingXLarge, HeadingXXLarge, LabelLarge, LabelSmall, ParagraphMedium import _ from 'lodash' import moment from 'moment' import { useState } from 'react' -import { Etterlevelse, EtterlevelseQL, EtterlevelseStatus, ExternalCode, Krav, KravQL, SuksesskriterieStatus } from '../../constants' +import { Etterlevelse, EtterlevelseQL, EtterlevelseStatus, Krav, KravQL, SuksesskriterieStatus } from '../../constants' import { kravNumView } from '../../pages/KravPage' import { theme } from '../../util' import { ettlevColors, maxPageWidth, responsivePaddingExtraLarge } from '../../util/theme' @@ -59,7 +59,7 @@ export const Etterlevelser = ({ loading, krav, modalVersion }: { loading: boolea t.productAreaName = 'Ingen produktområde' } }) - + return e }) diff --git a/apps/frontend/src/components/krav/Suksesskriterie.tsx b/apps/frontend/src/components/krav/Suksesskriterie.tsx index a58e9ab99..7c6e2d134 100644 --- a/apps/frontend/src/components/krav/Suksesskriterie.tsx +++ b/apps/frontend/src/components/krav/Suksesskriterie.tsx @@ -32,7 +32,7 @@ export const SuksesskriterieCard = (props: { suksesskriterie: Suksesskriterie; n Suksesskriterium {num} av {totalt} {suksesskriterie.navn} - + ) diff --git a/apps/frontend/src/components/krav/ViewKrav.tsx b/apps/frontend/src/components/krav/ViewKrav.tsx index a606e5440..d8c7ad42b 100644 --- a/apps/frontend/src/components/krav/ViewKrav.tsx +++ b/apps/frontend/src/components/krav/ViewKrav.tsx @@ -1,13 +1,12 @@ -import { AdresseType, Begrep, Krav, KravQL, KravVersjon, Virkemiddel } from '../../constants' +import { AdresseType, Begrep, Krav, KravQL, KravVersjon } from '../../constants' import { Block, Responsive } from 'baseui/block' import React from 'react' -import { kravStatus } from '../../pages/KravPage' import { theme } from '../../util' import moment from 'moment' import { DotTag, DotTags } from '../common/DotTag' import { ListName } from '../../services/Codelist' import { Label, LabelAboveContent } from '../common/PropertyLabel' -import { ExternalLink, ObjectLink } from '../common/RouteLink' +import { ExternalLink } from '../common/RouteLink' import { slackLink, slackUserLink, termUrl } from '../../util/config' import { user } from '../../services/User' import { LovViewList } from '../Lov' @@ -43,17 +42,6 @@ export const ViewKrav = ({ krav, alleKravVersjoner }: { krav: KravQL; alleKravVe ) } -const MediumInfo = ({ krav }: { krav: KravQL }) => ( - <> - - - -) - export const AllInfo = ({ krav, alleKravVersjoner }: { krav: KravQL; alleKravVersjoner: KravVersjon[] }) => { const hasKravExpired = () => { return krav && krav.kravVersjon < parseInt(alleKravVersjoner[0].kravVersjon.toString()) @@ -134,6 +122,7 @@ export const AllInfo = ({ krav, alleKravVersjoner }: { krav: KravQL; alleKravVer ) } + return null })} {krav.versjonEndringer && ( @@ -228,12 +217,6 @@ const BegrepView = ({ begrep }: { begrep: Begrep }) => ( ) -const VirkemiddelView = ({ virkemiddel }: { virkemiddel: Virkemiddel }) => ( - - {virkemiddel.navn} - -) - const KravRelasjonView = ({ kravRelasjon }: { kravRelasjon: Partial }) => ( diff --git a/apps/frontend/src/components/krav/tilbakemelding/Tilbakemelding.tsx b/apps/frontend/src/components/krav/tilbakemelding/Tilbakemelding.tsx index 34ab6066b..17b1b2ca6 100644 --- a/apps/frontend/src/components/krav/tilbakemelding/Tilbakemelding.tsx +++ b/apps/frontend/src/components/krav/tilbakemelding/Tilbakemelding.tsx @@ -1,4 +1,4 @@ -import { Krav, Tilbakemelding, TilbakemeldingMeldingStatus, TilbakemeldingRolle, TilbakemeldingType } from '../../../constants' +import { Krav, Tilbakemelding, TilbakemeldingMeldingStatus, TilbakemeldingRolle } from '../../../constants' import { tilbakemeldingNewMelding, TilbakemeldingNewMeldingRequest, @@ -69,7 +69,7 @@ export const Tilbakemeldinger = ({ krav, hasKravExpired }: { krav: Krav; hasKrav {tilbakemeldinger.slice(0, count).map((t) => { const focused = focusNr === t.id - const { status, ubesvartOgKraveier, melderOrKraveier, sistMelding } = getMelderInfo(t) + const { status, ubesvartOgKraveier, melderOrKraveier } = getMelderInfo(t) const statusView = (icon: React.ReactNode) => ( @@ -295,7 +295,7 @@ type TilbakemeldingSvarProps = { const TilbakemeldingSvar = ({ tilbakemelding, setFocusNummer, close, ubesvartOgKraveier, remove, replace }: TilbakemeldingSvarProps) => { const melderInfo = getMelderInfo(tilbakemelding) const [response, setResponse] = useState('') - const [replyRole, z] = useState(melderInfo.rolle) + const [replyRole] = useState(melderInfo.rolle) const [error, setError] = useState() const [loading, setLoading] = useState(false) const [deleteModal, setDeleteModal] = useState(false) @@ -488,23 +488,4 @@ const TilbakemeldingSvar = ({ tilbakemelding, setFocusNummer, close, ubesvartOgK )} ) -} - -const rolleText = (rolle: TilbakemeldingRolle) => { - switch (rolle) { - case TilbakemeldingRolle.KRAVEIER: - return 'kraveier' - case TilbakemeldingRolle.MELDER: - return 'melder' - } -} -const typeText = (type: TilbakemeldingType) => { - switch (type) { - case TilbakemeldingType.GOD: - return 'God kravbeskrivelse' - case TilbakemeldingType.UKLAR: - return 'Uklar kravbeskrivelse' - case TilbakemeldingType.ANNET: - return 'Annet' - } -} +} \ No newline at end of file diff --git a/apps/frontend/src/components/krav/tilbakemelding/edit/NyTilbakemeldingModal.tsx b/apps/frontend/src/components/krav/tilbakemelding/edit/NyTilbakemeldingModal.tsx index b15d75977..5db34c5c8 100644 --- a/apps/frontend/src/components/krav/tilbakemelding/edit/NyTilbakemeldingModal.tsx +++ b/apps/frontend/src/components/krav/tilbakemelding/edit/NyTilbakemeldingModal.tsx @@ -155,7 +155,7 @@ export const NyTilbakemeldingModal = ({ open, close, krav }: NyTilbakemeldingMod } > - + ) diff --git a/apps/frontend/src/components/kravList/AllKrav.tsx b/apps/frontend/src/components/kravList/AllKrav.tsx index f12b7f2b1..042316b88 100644 --- a/apps/frontend/src/components/kravList/AllKrav.tsx +++ b/apps/frontend/src/components/kravList/AllKrav.tsx @@ -24,8 +24,7 @@ type KravFilter = { export const AllKrav = () => { const pageSize = 20 - const [pageNumber, setPage] = useState(0) - const [sorting, setSorting] = useState('sist') + const [sorting] = useState('sist') const [filter, setFilter] = useState({ status: [{ label: 'Alle statuser', id: 'alle' }], relevans: [{ label: 'Alle relevans', id: 'alle' }], diff --git a/apps/frontend/src/components/kravList/SisteRedigertKrav.tsx b/apps/frontend/src/components/kravList/SisteRedigertKrav.tsx index f605fb49a..08fee2952 100644 --- a/apps/frontend/src/components/kravList/SisteRedigertKrav.tsx +++ b/apps/frontend/src/components/kravList/SisteRedigertKrav.tsx @@ -11,7 +11,7 @@ import { KravPanels, sortKrav } from '../../pages/KravListPage' const responsiveDisplay: Responsive = ['block', 'block', 'block', 'flex', 'flex', 'flex'] export const SistRedigertKrav = () => { - const [sorting, setSorting] = useState('sist') + const [sorting] = useState('sist') const [sortedKravList, setSortedKravList] = useState([]) const res = useKravFilter({ sistRedigert: 10, @@ -20,7 +20,7 @@ export const SistRedigertKrav = () => { pageSize: 10, }) - const { variables, data, loading, error } = res + const { data, loading, error } = res const kravene = data?.krav || emptyPage diff --git a/apps/frontend/src/components/kravList/TemaList.tsx b/apps/frontend/src/components/kravList/TemaList.tsx index 8175c4404..22388b3ec 100644 --- a/apps/frontend/src/components/kravList/TemaList.tsx +++ b/apps/frontend/src/components/kravList/TemaList.tsx @@ -19,7 +19,6 @@ import { getAllKravPriority } from '../../api/KravPriorityApi' export const TemaList = () => { const [allActiveKrav, setAllActiveKrav] = useState([]) const [allDraftKrav, setAllDraftKrav] = useState([]) - const tema = codelist.getCodes(ListName.TEMA) useEffect(() => { fetchKrav() @@ -34,6 +33,7 @@ export const TemaList = () => { const priority = allKravPriority.filter((kp) => kp.kravNummer === k.kravNummer && kp.kravVersjon === k.kravVersjon) k.prioriteringsId = priority.length ? priority[0].prioriteringsId : '' k.kravPriorityUID = priority.length ? priority[0].id : '' + return k }) setAllActiveKrav(kraver.filter((k) => k.status === KravStatus.AKTIV)) diff --git a/apps/frontend/src/components/scaffold/Page.tsx b/apps/frontend/src/components/scaffold/Page.tsx index 5276b652d..1957eeee1 100644 --- a/apps/frontend/src/components/scaffold/Page.tsx +++ b/apps/frontend/src/components/scaffold/Page.tsx @@ -97,12 +97,6 @@ export const Narrow = (props: { children: React.ReactNode }) => ( ) -const ChevronLeft = (props: { fill?: string }) => ( - - - -) - export const Layout2 = (props: { backBtnColor?: string backBtnUrl?: string diff --git a/apps/frontend/src/index.tsx b/apps/frontend/src/index.tsx index 52d22223c..eb32bb8c6 100644 --- a/apps/frontend/src/index.tsx +++ b/apps/frontend/src/index.tsx @@ -1,8 +1,7 @@ import 'react-app-polyfill/ie11' import 'react-app-polyfill/stable' -import React from 'react' import Main from './main' -import './main.css'; +import './main.css' import { createRoot } from 'react-dom/client' const container = document.getElementById('root') diff --git a/apps/frontend/src/pages/BehandlingTemaPage.tsx b/apps/frontend/src/pages/BehandlingTemaPage.tsx index 432cb946e..e4d2a0d9b 100644 --- a/apps/frontend/src/pages/BehandlingTemaPage.tsx +++ b/apps/frontend/src/pages/BehandlingTemaPage.tsx @@ -1,14 +1,14 @@ -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { Block } from 'baseui/block' -import { useLocation, useNavigate, useParams } from 'react-router-dom' +import { useLocation, useParams } from 'react-router-dom' import { HeadingXLarge, ParagraphMedium } from 'baseui/typography' import { ettlevColors } from '../util/theme' import { codelist, ListName, TemaCode } from '../services/Codelist' import { useBehandling } from '../api/BehandlingApi' import { Layout2 } from '../components/scaffold/Page' -import { Etterlevelse, EtterlevelseStatus, Krav, KRAV_FILTER_TYPE, KravEtterlevelseData, KravPrioritering, KravQL, KravStatus, PageResponse } from '../constants' +import { Etterlevelse, EtterlevelseStatus, KRAV_FILTER_TYPE, KravEtterlevelseData, KravPrioritering, KravQL, KravStatus, PageResponse } from '../constants' import { useQuery } from '@apollo/client' -import { behandlingKravQuery, getAllKrav } from '../api/KravApi' +import { behandlingKravQuery } from '../api/KravApi' import { breadcrumbPaths } from '../components/common/CustomizedBreadcrumbs' import { KravPanelHeaderWithSorting } from '../components/behandling/KravPanelHeader' import { Helmet } from 'react-helmet' @@ -49,15 +49,13 @@ export const isFerdigUtfylt = (status: EtterlevelseStatus | undefined) => { export const BehandlingTemaPage = () => { const params = useParams<{ id?: string; tema?: string; filter?: string }>() const temaData: TemaCode | undefined = codelist.getCode(ListName.TEMA, params.tema) - const [behandling, setBehandling] = useBehandling(params.id) + const [behandling] = useBehandling(params.id) const lovListe = codelist.getCodesForTema(temaData?.code) const lover = lovListe.map((c) => c.code) - const [allKrav, setAllKrav] = useState([]) const variables = { behandlingId: params.id, lover: lover, gjeldendeKrav: true, behandlingIrrevantKrav: false, status: KravStatus.AKTIV } const [allKravPriority, setAllKravPriority] = useState([]) const location = useLocation() - const [temaPageUrl, setTemaPageUrl] = useState(location.pathname) - const navigate = useNavigate() + const [temaPageUrl] = useState(location.pathname) const { data: relevanteKraverGraphQLResponse, loading: relevanteKraverGraphQLLoading } = useQuery<{ krav: PageResponse }>(behandlingKravQuery, { variables, @@ -84,7 +82,6 @@ export const BehandlingTemaPage = () => { useEffect(() => { ;(async () => { - setAllKrav(await getAllKrav()) setAllKravPriority(await getAllKravPriority()) })() }, []) diff --git a/apps/frontend/src/pages/DokumentasjonPage.tsx b/apps/frontend/src/pages/DokumentasjonPage.tsx index a70acc96c..7743916af 100644 --- a/apps/frontend/src/pages/DokumentasjonPage.tsx +++ b/apps/frontend/src/pages/DokumentasjonPage.tsx @@ -2,15 +2,14 @@ import React, { useState } from 'react' import { Block } from 'baseui/block' import { useParams } from 'react-router-dom' import { LoadingSkeleton } from '../components/common/LoadingSkeleton' -import { HeadingXLarge, LabelSmall, ParagraphMedium, ParagraphXSmall } from 'baseui/typography' +import { HeadingXLarge, ParagraphMedium } from 'baseui/typography' import { ettlevColors, theme } from '../util/theme' import { Layout2 } from '../components/scaffold/Page' -import { arkPennIcon, ellipse80, saveArchiveIcon, warningAlert } from '../components/Images' +import { arkPennIcon, ellipse80, saveArchiveIcon } from '../components/Images' import { EtterlevelseDokumentasjonQL, EtterlevelseDokumentasjonStats, KravQL, KravStatus, PageResponse } from '../constants' import { gql, useQuery } from '@apollo/client' import { Code, codelist, ListName } from '../services/Codelist' import { Button, KIND, SIZE } from 'baseui/button' -import { marginZero } from '../components/common/Style' import { breadcrumbPaths } from '../components/common/CustomizedBreadcrumbs' import { ampli } from '../services/Amplitude' @@ -19,7 +18,6 @@ import { user } from '../services/User' import { useArkiveringByEtterlevelseDokumentasjonId } from '../api/ArkiveringApi' import { useEtterlevelseDokumentasjon } from '../api/EtterlevelseDokumentasjonApi' import { TemaCardEtterlevelseDokumentasjon } from '../components/etterlevelseDokumentasjon/TemaCardEtterlevelseDokumentasjon' -import EditEtterlevelseDokumentasjonModal from '../components/etterlevelseDokumentasjon/edit/EditEtterlevelseDokumentasjonModal' import { ArkiveringModal } from '../components/etterlevelseDokumentasjon/ArkiveringModal' import ExportEtterlevelseModalV2 from '../components/export/ExportEtterlevelseModalV2' import { isFerdigUtfylt } from './EtterlevelseDokumentasjonTemaPage' @@ -41,10 +39,7 @@ export const DokumentasjonPage = () => { variables: { etterlevelseDokumentasjonId: etterlevelseDokumentasjon?.id }, }) - const [edit, setEdit] = useState(false) - const [relevanteStats, setRelevanteStats] = useState([]) - const [irrelevanteStats, setIrrelevanteStats] = useState([]) const [utgaattStats, setUtgaattStats] = useState([]) const [arkivModal, setArkivModal] = useState(false) @@ -58,7 +53,6 @@ export const DokumentasjonPage = () => { | undefined, ) => { const relevanteStatusListe: any[] = [] - const irrelevanteStatusListe: any[] = [] const utgaattStatusListe: any[] = [] unfilteredData?.etterlevelseDokumentasjon.content.forEach(({ stats }) => { @@ -78,22 +72,10 @@ export const DokumentasjonPage = () => { }) }) - unfilteredData?.etterlevelseDokumentasjon.content.forEach(({ stats }) => { - stats.irrelevantKrav.forEach((k) => { - if (k.regelverk.length && k.status === KravStatus.AKTIV) { - irrelevanteStatusListe.push({ ...k, etterlevelser: k.etterlevelser.filter((e) => e.etterlevelseDokumentasjonId === etterlevelseDokumentasjon?.id) }) - } - }) - }) - relevanteStatusListe.sort((a, b) => { return a.kravNummer - b.kravNummer }) - irrelevanteStatusListe.sort((a, b) => { - return a.kravNummer - b.kravNummer - }) - utgaattStatusListe.sort((a, b) => { if (a.kravNummer === b.kravNummer) { return a.kravVersjon - b.kravVersjon @@ -101,13 +83,12 @@ export const DokumentasjonPage = () => { return a.kravNummer - b.kravNummer }) - return [relevanteStatusListe, irrelevanteStatusListe, utgaattStatusListe] + return [relevanteStatusListe, utgaattStatusListe] } React.useEffect(() => { - const [relevanteStatusListe, irrelevanteStatusListe, utgaattStatusListe] = filterData(relevanteData) + const [relevanteStatusListe, utgaattStatusListe] = filterData(relevanteData) setRelevanteStats(relevanteStatusListe) - setIrrelevanteStats(irrelevanteStatusListe) setUtgaattStats(utgaattStatusListe) }, [relevanteData]) @@ -130,8 +111,6 @@ export const DokumentasjonPage = () => { } }) - const getPercentageUtfylt = relevanteStats && relevanteStats.length && (antallFylttKrav / relevanteStats.length) * 100 - const getRelevansContent = (etterlevelseDokumentasjon: EtterlevelseDokumentasjonQL) => { const emptyRelevans = etterlevelseDokumentasjon.irrelevansFor.length === options.length ? true : false diff --git a/apps/frontend/src/pages/EtterlevelseDokumentasjonPage.tsx b/apps/frontend/src/pages/EtterlevelseDokumentasjonPage.tsx index ff2367ddc..717a35f3e 100644 --- a/apps/frontend/src/pages/EtterlevelseDokumentasjonPage.tsx +++ b/apps/frontend/src/pages/EtterlevelseDokumentasjonPage.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { Block } from 'baseui/block' import { useParams } from 'react-router-dom' import { ettlevColors } from '../util/theme' @@ -29,7 +29,7 @@ export const getFilterType = (id: string | number | undefined): KRAV_FILTER_TYPE export const EtterlevelseDokumentasjonPage = () => { const params = useParams<{ id: string; tema: string; kravNummer: string; kravVersjon: string; filter: string }>() const temaData: TemaCode | undefined = codelist.getCode(ListName.TEMA, params.tema?.replace('i', '')) - const [behandling, setBehandling] = useBehandling(params.id) + const [behandling] = useBehandling(params.id) const lovListe = codelist.getCodesForTema(temaData?.code) const [kravId, setKravId] = useState() diff --git a/apps/frontend/src/pages/EtterlevelseDokumentasjonPageV2.tsx b/apps/frontend/src/pages/EtterlevelseDokumentasjonPageV2.tsx index e46eea363..5c2a94cbf 100644 --- a/apps/frontend/src/pages/EtterlevelseDokumentasjonPageV2.tsx +++ b/apps/frontend/src/pages/EtterlevelseDokumentasjonPageV2.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { Block } from 'baseui/block' import { useParams } from 'react-router-dom' import { ettlevColors } from '../util/theme' @@ -11,7 +11,6 @@ import { ampli } from '../services/Amplitude' import { KRAV_FILTER_TYPE } from '../constants' import { useEtterlevelseDokumentasjon } from '../api/EtterlevelseDokumentasjonApi' import { getMainHeader } from '../components/etterlevelseDokumentasjon/common/utils' -import { EtterlevelseSecondaryHeaderV2 } from '../components/etterlevelse/EtterlevelseSecondaryHeaderV2' import { KravView } from '../components/EtterlevelseDokumentasjonTema/KravView' export type Section = 'dokumentasjon' | 'etterlevelser' | 'tilbakemeldinger' @@ -29,8 +28,7 @@ export const getFilterType = (id: string | number | undefined): KRAV_FILTER_TYPE export const EtterlevelseDokumentasjonPageV2 = () => { const params = useParams<{ id: string; tema: string; kravNummer: string; kravVersjon: string; filter: string }>() const temaData: TemaCode | undefined = codelist.getCode(ListName.TEMA, params.tema?.replace('i', '')) - const [etterlevelseDokumentasjon, setEtterkevekseDokumentasjon] = useEtterlevelseDokumentasjon(params.id) - const lovListe = codelist.getCodesForTema(temaData?.code) + const [etterlevelseDokumentasjon] = useEtterlevelseDokumentasjon(params.id) const [kravId, setKravId] = useState() diff --git a/apps/frontend/src/pages/EtterlevelseDokumentasjonTemaPage.tsx b/apps/frontend/src/pages/EtterlevelseDokumentasjonTemaPage.tsx index f13531f98..0ec46b769 100644 --- a/apps/frontend/src/pages/EtterlevelseDokumentasjonTemaPage.tsx +++ b/apps/frontend/src/pages/EtterlevelseDokumentasjonTemaPage.tsx @@ -1,13 +1,13 @@ -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { Block } from 'baseui/block' -import { useLocation, useNavigate, useParams } from 'react-router-dom' +import { useLocation, useParams } from 'react-router-dom' import { HeadingXLarge, ParagraphMedium } from 'baseui/typography' import { ettlevColors } from '../util/theme' import { codelist, ListName, TemaCode } from '../services/Codelist' import { Layout2 } from '../components/scaffold/Page' -import { Etterlevelse, EtterlevelseStatus, Krav, KRAV_FILTER_TYPE, KravEtterlevelseData, KravPrioritering, KravQL, KravStatus, PageResponse } from '../constants' +import { Etterlevelse, EtterlevelseStatus, KRAV_FILTER_TYPE, KravEtterlevelseData, KravPrioritering, KravQL, KravStatus, PageResponse } from '../constants' import { useQuery } from '@apollo/client' -import { etterlevelseDokumentasjonKravQuery, getAllKrav } from '../api/KravApi' +import { etterlevelseDokumentasjonKravQuery } from '../api/KravApi' import { breadcrumbPaths } from '../components/common/CustomizedBreadcrumbs' import { Helmet } from 'react-helmet' @@ -51,16 +51,14 @@ export const isFerdigUtfylt = (status: EtterlevelseStatus | undefined) => { export const EtterlevelseDokumentasjonTemaPage = () => { const params = useParams<{ id?: string; tema?: string; filter?: string }>() const temaData: TemaCode | undefined = codelist.getCode(ListName.TEMA, params.tema) - const [etterlevelseDokumentasjon, setEtterlevelseDokumentasjon] = useEtterlevelseDokumentasjon(params.id) + const [etterlevelseDokumentasjon] = useEtterlevelseDokumentasjon(params.id) const lovListe = codelist.getCodesForTema(temaData?.code) const lover = lovListe.map((c) => c.code) - const [allKrav, setAllKrav] = useState([]) const variables = { etterlevelseDokumentasjonId: params.id, lover: lover, gjeldendeKrav: true, etterlevelseDokumentasjonIrelevantKrav: false, status: KravStatus.AKTIV } const [allKravPriority, setAllKravPriority] = useState([]) const location = useLocation() - const [temaPageUrl, setTemaPageUrl] = useState(location.pathname) - const navigate = useNavigate() - + const [temaPageUrl] = useState(location.pathname) + const { data: relevanteKraverGraphQLResponse, loading: relevanteKraverGraphQLLoading } = useQuery<{ krav: PageResponse }>(etterlevelseDokumentasjonKravQuery, { variables, skip: !params.id || !lover.length, @@ -87,7 +85,6 @@ export const EtterlevelseDokumentasjonTemaPage = () => { useEffect(() => { ;(async () => { - setAllKrav(await getAllKrav()) setAllKravPriority(await getAllKravPriority()) })() }, []) diff --git a/apps/frontend/src/pages/EtterlevelsePage.tsx b/apps/frontend/src/pages/EtterlevelsePage.tsx index 2d66e8b3b..476374d2c 100644 --- a/apps/frontend/src/pages/EtterlevelsePage.tsx +++ b/apps/frontend/src/pages/EtterlevelsePage.tsx @@ -2,7 +2,7 @@ import { Block } from 'baseui/block' import { HeadingXXLarge, LabelSmall } from 'baseui/typography' import { useParams } from 'react-router-dom' import { useEtterlevelse } from '../api/EtterlevelseApi' -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { Etterlevelse, Krav } from '../constants' import { ViewEtterlevelse } from '../components/etterlevelse/ViewEtterlevelse' import { LoadingSkeleton } from '../components/common/LoadingSkeleton' @@ -23,7 +23,7 @@ export const kravLink = (kravNummer: string) => { export const EtterlevelsePage = () => { const params = useParams<{ id?: string }>() const [etterlevelse, setEtterlevelse] = useEtterlevelse(params.id) - const [edit, setEdit] = useState(etterlevelse && !etterlevelse.id) + const [edit] = useState(etterlevelse && !etterlevelse.id) const [krav, setKrav] = useState() const [kravTema, setKravTema] = useState() diff --git a/apps/frontend/src/pages/FAQ.tsx b/apps/frontend/src/pages/FAQ.tsx index 094fbd2c3..cb6289d9c 100644 --- a/apps/frontend/src/pages/FAQ.tsx +++ b/apps/frontend/src/pages/FAQ.tsx @@ -1,4 +1,3 @@ -import * as React from 'react' import { useEffect, useState } from 'react' import { ettlevColors, maxPageWidth, responsivePaddingLarge, responsiveWidthLarge, theme } from '../util/theme' import { HeadingXLarge, HeadingXXLarge, ParagraphLarge, ParagraphSmall } from 'baseui/typography' @@ -13,19 +12,16 @@ import moment from 'moment' import { user } from '../services/User' export const FAQ = () => { - const [isLoading, setLoading] = useState(false) const [melding, setMelding] = useState() useEffect(() => { ;(async () => { - setLoading(true) const response = await getMeldingByType(MeldingType.OM_ETTERLEVELSE) if (response.numberOfElements > 0) { setMelding(response.content[0]) } else { setMelding(mapMeldingToFormValue({ meldingType: MeldingType.OM_ETTERLEVELSE })) } - setLoading(false) })() }, []) @@ -69,7 +65,7 @@ export const FAQ = () => { {melding?.secondaryTittel} - + {/**/} {/* Siden er under arbeid, og vi tar gjerne imot innspill på Slack #etterlevelse.*/} diff --git a/apps/frontend/src/pages/KravListPage.tsx b/apps/frontend/src/pages/KravListPage.tsx index 9f6ea40d9..6c1f1eb21 100644 --- a/apps/frontend/src/pages/KravListPage.tsx +++ b/apps/frontend/src/pages/KravListPage.tsx @@ -1,6 +1,6 @@ -import { Block, Responsive } from 'baseui/block' +import { Block } from 'baseui/block' import { HeadingXXLarge, LabelSmall, ParagraphMedium } from 'baseui/typography' -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import Button from '../components/common/Button' import CustomizedBreadcrumbs from '../components/common/CustomizedBreadcrumbs' import CustomizedTabs from '../components/common/CustomizedTabs' @@ -15,7 +15,6 @@ import { Krav, KravQL } from '../constants' import { SkeletonPanel } from '../components/common/LoadingSkeleton' import { codelist, ListName } from '../services/Codelist' import { borderColor, borderRadius, borderStyle, borderWidth } from '../components/common/Style' -import { Option } from 'baseui/select' import { AllKrav } from '../components/kravList/AllKrav' import { SistRedigertKrav } from '../components/kravList/SisteRedigertKrav' import { TemaList } from '../components/kravList/TemaList' @@ -27,14 +26,6 @@ import { ampli } from '../services/Amplitude' type Section = 'siste' | 'alle' | 'tema' const tabMarginBottom = '10px' -const responsiveDisplay: Responsive = ['block', 'block', 'block', 'flex', 'flex', 'flex'] - -type KravFilter = { - status: Option[] - relevans: Option[] - tema: Option[] - lover: Option[] -} export const sortKrav = (kravene: KravQL[]) => { return [...kravene].sort((a, b) => { diff --git a/apps/frontend/src/pages/KravPage.tsx b/apps/frontend/src/pages/KravPage.tsx index c198faf9c..033058eb3 100644 --- a/apps/frontend/src/pages/KravPage.tsx +++ b/apps/frontend/src/pages/KravPage.tsx @@ -14,7 +14,7 @@ import { DeleteItem } from '../components/DeleteItem' import { borderColor, borderRadius, borderStyle, borderWidth, padding } from '../components/common/Style' import { useQuery } from '@apollo/client' import { Tilbakemeldinger } from '../components/krav/tilbakemelding/Tilbakemelding' -import { editIcon, informationIcon, pageIcon, plusIcon } from '../components/Images' +import { informationIcon } from '../components/Images' import { CustomizedTabs } from '../components/common/CustomizedTabs' import { ettlevColors, maxPageWidth, pageWidth, responsivePaddingSmall, responsiveWidthSmall } from '../util/theme' import { useLocationState, useQueryParam } from '../util/hooks' @@ -287,7 +287,7 @@ export const KravPage = () => { Hensikten med kravet - + @@ -362,23 +362,6 @@ export const KravPage = () => { ) } -const PageIcon = (props: { hover: boolean }) => ( - - {'Page - -) export const query = gql` query getKravWithEtterlevelse($id: ID, $kravNummer: Int, $kravVersjon: Int) { diff --git a/apps/frontend/src/pages/LovPage.tsx b/apps/frontend/src/pages/LovPage.tsx index 5a92275d5..352cf93aa 100644 --- a/apps/frontend/src/pages/LovPage.tsx +++ b/apps/frontend/src/pages/LovPage.tsx @@ -136,7 +136,7 @@ const LovSide = ({ lov }: { lov: LovCode }) => { Loven i sin helhet - + {lov.shortName} i lovdata diff --git a/apps/frontend/src/pages/MainPage.tsx b/apps/frontend/src/pages/MainPage.tsx index 46c2d652a..cef625c64 100644 --- a/apps/frontend/src/pages/MainPage.tsx +++ b/apps/frontend/src/pages/MainPage.tsx @@ -126,7 +126,7 @@ export const MainPage = () => { marginBottom: '64px', }} > - + )} diff --git a/apps/frontend/src/pages/MyEtterlevelseDokumentasjonerPage.tsx b/apps/frontend/src/pages/MyEtterlevelseDokumentasjonerPage.tsx index d068d5a59..588bae125 100644 --- a/apps/frontend/src/pages/MyEtterlevelseDokumentasjonerPage.tsx +++ b/apps/frontend/src/pages/MyEtterlevelseDokumentasjonerPage.tsx @@ -18,7 +18,7 @@ import moment from 'moment' import { useDebouncedState } from '../util/hooks' import { SkeletonPanel } from '../components/common/LoadingSkeleton' import { user } from '../services/User' -import { useNavigate, useParams, useSearchParams } from 'react-router-dom' +import { useNavigate, useParams } from 'react-router-dom' import { faExternalLinkAlt, faPlus } from '@fortawesome/free-solid-svg-icons' import { borderWidth } from '../components/common/Style' import CustomizedBreadcrumbs from '../components/common/CustomizedBreadcrumbs' @@ -298,7 +298,7 @@ const Alle = () => { } useEffect(() => { - if (sok && pageNumber != 0) setPage(0) + if (sok && pageNumber !== 0) setPage(0) }, [sok]) const getEtterlevelseDokumentasjonerWithoutDuplicates = () => { diff --git a/apps/frontend/src/pages/QuestionAndAnswerLogPage.tsx b/apps/frontend/src/pages/QuestionAndAnswerLogPage.tsx index 8433c7774..8e51df484 100644 --- a/apps/frontend/src/pages/QuestionAndAnswerLogPage.tsx +++ b/apps/frontend/src/pages/QuestionAndAnswerLogPage.tsx @@ -3,7 +3,7 @@ import { Block } from 'baseui/block' import { HeadingXXLarge, ParagraphMedium } from 'baseui/typography' import moment from 'moment' import * as React from 'react' -import { useEffect, useState } from 'react' +import { ReactNode, useEffect, useState } from 'react' import { Helmet } from 'react-helmet' import { getAllKrav, kravMapToFormVal } from '../api/KravApi' import { getTilbakemeldingForKrav } from '../api/TilbakemeldingApi' @@ -18,7 +18,6 @@ import { ettlevColors, maxPageWidth } from '../util/theme' import { codelist, ListName } from '../services/Codelist' import { ampli } from '../services/Amplitude' import { Spinner } from '../components/common/Spinner' -import { ReactNode } from 'react-markdown/lib/react-markdown' type SporsmaalOgSvarKrav = { kravNavn: string diff --git a/apps/frontend/src/pages/TemaPage.tsx b/apps/frontend/src/pages/TemaPage.tsx index da897d107..8dd377dc2 100644 --- a/apps/frontend/src/pages/TemaPage.tsx +++ b/apps/frontend/src/pages/TemaPage.tsx @@ -60,7 +60,7 @@ export const getTemaMainHeader = (tema: TemaCode, lover: LovCode[], expand: bool maskImage: expand ? undefined : `linear-gradient(${ettlevColors.black} 40%, transparent)`, }} > - + {expand && ( @@ -116,6 +116,7 @@ const TemaSide = ({ tema }: { tema: TemaCode }) => { kraver.map((k) => { const priority = allKravPriority.filter((kp) => kp.kravNummer === k.kravNummer && kp.kravVersjon === k.kravVersjon) k.prioriteringsId = priority.length ? priority[0].prioriteringsId : '' + return k }) setKravList(sortKraverByPriority(kraver, tema.shortName)) })() @@ -330,7 +331,7 @@ export const TemaCard = ({ tema, relevans, setNum }: { tema: TemaCode; relevans: - + ) diff --git a/apps/frontend/src/services/Codelist.ts b/apps/frontend/src/services/Codelist.ts index bf0052f69..bef718da7 100644 --- a/apps/frontend/src/services/Codelist.ts +++ b/apps/frontend/src/services/Codelist.ts @@ -267,8 +267,7 @@ export const filterLovCodeListForRelevans = (codeList: LovCode[], relevantFor: L } else if (code.data.relevantFor === LovCodeRelevans.KRAV_OG_VIRKEMIDDEL || code.data.relevantFor === relevantFor) { return true } - } else { - return false } + return false }) } diff --git a/apps/frontend/src/util/intl/intl.ts b/apps/frontend/src/util/intl/intl.ts index b7761d296..9018ddf73 100644 --- a/apps/frontend/src/util/intl/intl.ts +++ b/apps/frontend/src/util/intl/intl.ts @@ -58,7 +58,7 @@ export const useLang = () => { if (lang !== momentlocale) console.warn('moment locale missing', lang) localStorageAvailable && localStorage.setItem('tcat-lang', lang) update() - }, [lang]) + }, [lang, update]) return setLang } diff --git a/apps/frontend/src/util/intl/lang.ts b/apps/frontend/src/util/intl/lang.ts index aeea9822d..91ae9f6dd 100644 --- a/apps/frontend/src/util/intl/lang.ts +++ b/apps/frontend/src/util/intl/lang.ts @@ -84,7 +84,7 @@ export const en: IStrings = { mailLog: 'Mail log', nextButton: 'Next', prevButton: 'Prev', - pageNotFound: "Oops 404! couldn't find page", + pageNotFound: 'Oops 404! couldn\'t find page', rows: 'Rows', save: 'Save', searchId: 'Search for id',