diff --git a/apps/concept-catalog/pages/[catalogId]/change-requests/[changeRequestId]/_change-request-form.tsx b/apps/concept-catalog/pages/[catalogId]/change-requests/[changeRequestId]/_change-request-form.tsx index e8dc60a80..9fa714a77 100644 --- a/apps/concept-catalog/pages/[catalogId]/change-requests/[changeRequestId]/_change-request-form.tsx +++ b/apps/concept-catalog/pages/[catalogId]/change-requests/[changeRequestId]/_change-request-form.tsx @@ -1,6 +1,5 @@ import { Checkbox, Heading, Textfield } from '@digdir/design-system-react'; -import { BreadcrumbType, Breadcrumbs, Button, PageBanner } from '@catalog-frontend/ui'; -import { useCatalogDesign } from '../../../../context/catalog-design'; +import { Button } from '@catalog-frontend/ui'; import { localization as loc } from '@catalog-frontend/utils'; import styles from './change-request-page.module.css'; import { useState } from 'react'; @@ -19,17 +18,12 @@ const languageOptions = [ ]; export const ChangeRequestForm = ({ - FDK_REGISTRATION_BASE_URI, - organization, changeRequest, changeRequestAsConcept, originalConcept, showOriginal = false, submitHandler, }) => { - const changeRequestId = changeRequest.id; - const catalogId = organization?.organizationId; - const pageSubtitle = organization?.name ?? organization.id; const [changeRequestTitle, setChangeRequestTitle] = useState(changeRequest.title ?? ''); const [selectedLanguages, setSelectedLanguages] = useState(['nb', 'nn', 'en']); @@ -49,39 +43,8 @@ export const ChangeRequestForm = ({ setSelectedLanguages(newSelectedLangs as ISOLanguage[]); }; - const breadcrumbList = changeRequestId - ? ([ - { - href: `/${catalogId}`, - text: loc.concept.concept, - }, - { - href: `/${catalogId}/change-requests`, - text: loc.changeRequest.changeRequest, - }, - { - href: `/${catalogId}/change-requests/${changeRequestId}`, - text: changeRequestTitle, - }, - ] as BreadcrumbType[]) - : []; - - const design = useCatalogDesign(); - return ( <> - -
diff --git a/apps/concept-catalog/pages/[catalogId]/change-requests/[changeRequestId]/edit.tsx b/apps/concept-catalog/pages/[catalogId]/change-requests/[changeRequestId]/edit.tsx index 639bef3d1..64a93b063 100644 --- a/apps/concept-catalog/pages/[catalogId]/change-requests/[changeRequestId]/edit.tsx +++ b/apps/concept-catalog/pages/[catalogId]/change-requests/[changeRequestId]/edit.tsx @@ -14,6 +14,10 @@ import jsonpatch from 'fast-json-patch'; import { useUpdateChangeRequest } from '../../../../hooks/change-requests'; import { useRouter } from 'next/router'; +import { localization as loc } from '@catalog-frontend/utils'; +import { BreadcrumbType, Breadcrumbs, PageBanner } from '@catalog-frontend/ui'; +import { useCatalogDesign } from '../../../../context/catalog-design'; + const ChangeRequestEditPage = ({ FDK_REGISTRATION_BASE_URI, organization, @@ -23,11 +27,13 @@ const ChangeRequestEditPage = ({ showOriginal, }) => { const router = useRouter(); + const catalogId = organization.organizationId; + const pageSubtitle = organization?.name ?? organization.id; + const changeRequestMutateHook = useUpdateChangeRequest({ catalogId: organization.organizationId, changeRequestId: changeRequest.id, }); - const submitHandler = (values: Concept, title: string) => { const changeRequestFromConcept: ChangeRequestUpdateBody = { conceptId: changeRequest.conceptId, @@ -42,16 +48,49 @@ const ChangeRequestEditPage = ({ }); }; + const breadcrumbList = [ + { + href: `/${catalogId}`, + text: loc.concept.concept, + }, + { + href: `/${catalogId}/change-requests`, + text: loc.changeRequest.changeRequest, + }, + { + href: `/${catalogId}/change-requests/${changeRequest.id}`, + text: changeRequest.title, + }, + { + href: `/${catalogId}/change-requests/${changeRequest.id}/edit`, + text: loc.changeRequest.edit, + }, + ] as BreadcrumbType[]; + + const design = useCatalogDesign(); + return ( - + <> + + + + ); }; diff --git a/apps/concept-catalog/pages/[catalogId]/change-requests/new.tsx b/apps/concept-catalog/pages/[catalogId]/change-requests/new.tsx index c357e4e77..f0d104ca1 100644 --- a/apps/concept-catalog/pages/[catalogId]/change-requests/new.tsx +++ b/apps/concept-catalog/pages/[catalogId]/change-requests/new.tsx @@ -6,6 +6,9 @@ import { Session, getServerSession } from 'next-auth'; import { ChangeRequestForm } from './[changeRequestId]/_change-request-form'; import jsonpatch from 'fast-json-patch'; import { useCreateChangeRequest } from '../../../hooks/change-requests'; +import { localization as loc } from '@catalog-frontend/utils'; +import { BreadcrumbType, Breadcrumbs, PageBanner } from '@catalog-frontend/ui'; +import { useCatalogDesign } from '../../../context/catalog-design'; const NewConceptSuggestion = ({ FDK_REGISTRATION_BASE_URI, @@ -15,8 +18,10 @@ const NewConceptSuggestion = ({ originalConcept, showOriginal, }) => { - const changeRequestMutateHook = useCreateChangeRequest({ catalogId: organization.organizationId }); + const catalogId = organization.organizationId; + const pageSubtitle = organization?.name ?? organization.id; + const changeRequestMutateHook = useCreateChangeRequest({ catalogId: catalogId }); const submitHandler = (values: Concept, title: string) => { const changeRequestFromConcept: ChangeRequestUpdateBody = { conceptId: changeRequest.conceptId, @@ -26,16 +31,45 @@ const NewConceptSuggestion = ({ changeRequestMutateHook.mutate(changeRequestFromConcept); }; + const breadcrumbList = [ + { + href: `/${catalogId}`, + text: loc.concept.concept, + }, + { + href: `/${catalogId}/change-requests`, + text: loc.changeRequest.changeRequest, + }, + { + href: `/${catalogId}/change-requests/new`, + text: loc.suggestionForNewConcept, + }, + ] as BreadcrumbType[]; + + const design = useCatalogDesign(); + return ( - + <> + + + + ); }; diff --git a/libs/utils/src/lib/language/nb.ts b/libs/utils/src/lib/language/nb.ts index cffa2d756..1083c3710 100644 --- a/libs/utils/src/lib/language/nb.ts +++ b/libs/utils/src/lib/language/nb.ts @@ -259,6 +259,7 @@ export const nb = { proposedChange: 'Forslag til ny {fieldType} på {lang}', noValue: 'Ingen verdi', noChangeRequestsFound: 'Her var det ingen endringsforslag', + edit: 'Rediger', }, comment: {