Skip to content

Commit

Permalink
feat(concept:changeRequests): add breadcrumbs in list page
Browse files Browse the repository at this point in the history
  • Loading branch information
terjesyl committed Oct 24, 2023
1 parent 3983616 commit 390085e
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions apps/concept-catalog/pages/[catalogId]/change-requests/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getChangeRequests, getOrganization, searchConceptsForCatalog } from '@catalog-frontend/data-access';
import { ChangeRequest, Concept, Organization, SearchConceptQuery } from '@catalog-frontend/types';
import { Button, PageBanner, Tag } from '@catalog-frontend/ui';
import { BreadcrumbType, Breadcrumbs, Button, PageBanner, Tag } from '@catalog-frontend/ui';
import {
capitalizeFirstLetter,
convertTimestampToDateAndTime,
Expand All @@ -16,7 +16,12 @@ import { Heading, Link } from '@digdir/design-system-react';
import { Session, getServerSession } from 'next-auth';
import { authOptions } from '../../api/auth/[...nextauth]';

export const ChangeRequestsPage = ({ organization, changeRequests, conceptsWithChangeRequest }) => {
export const ChangeRequestsPage = ({
organization,
changeRequests,
conceptsWithChangeRequest,
FDK_REGISTRATION_BASE_URI,
}) => {
const pageSubtitle = organization?.name ?? '';
const router = useRouter();

Expand All @@ -27,8 +32,24 @@ export const ChangeRequestsPage = ({ organization, changeRequests, conceptsWithC
}
};

const catalogId = organization.organizationId;
const breadcrumbList = [
{
href: `/${catalogId}`,
text: loc.concept.concept,
},
{
href: `/${catalogId}/change-requests`,
text: loc.changeRequest.changeRequest,
},
] as BreadcrumbType[];

return (
<>
<Breadcrumbs
baseURI={FDK_REGISTRATION_BASE_URI}
breadcrumbList={breadcrumbList}
/>
<PageBanner
title={loc.catalogType.concept}
subtitle={pageSubtitle}
Expand Down Expand Up @@ -158,12 +179,14 @@ export async function getServerSideProps({ req, res, params }) {

const response = await searchConceptsForCatalog(catalogId, searchQuery, session?.accessToken);
const conceptsWithChangeRequest: Concept[] = await response.json();
const FDK_REGISTRATION_BASE_URI = process.env.FDK_REGISTRATION_BASE_URI;

return {
props: {
organization,
changeRequests,
conceptsWithChangeRequest,
FDK_REGISTRATION_BASE_URI,
},
};
}
Expand Down

0 comments on commit 390085e

Please sign in to comment.