Skip to content

Commit 933bc8e

Browse files
Merge pull request #1781 from navikt/sla-sammen-lokalkontor-og-kontorsider
Slå sammen lokalkontor og kontorsider
2 parents 2e8af32 + 14aa655 commit 933bc8e

22 files changed

+35
-86
lines changed

Diff for: src/components/ContentMapper.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { SituationPage } from './pages/situation-page/SituationPage';
1616
import { GuidePage } from './pages/guide-page/GuidePage';
1717
import { OverviewPage } from './pages/overview-page/OverviewPage';
1818
import { OfficeEditorialPage } from './pages/office-editorial-page/OfficeEditorialPage';
19-
import { OfficeBranchPage } from './pages/office-branch-page/OfficeBranchPage';
2019
import { ThemedArticlePage } from './pages/themed-article-page/ThemedArticlePage';
2120
import { ProductPage } from './pages/product-page/ProductPage';
2221
import { ProductDetailsPage } from './pages/product-details-page/ProductDetailsPage';
@@ -53,7 +52,6 @@ const contentToReactComponent: {
5352
[ContentType.Overview]: OverviewPage,
5453
[ContentType.GenericPage]: GenericPage,
5554
[ContentType.OfficeEditorialPage]: OfficeEditorialPage,
56-
[ContentType.OfficeBranchPage]: OfficeBranchPage,
5755
[ContentType.OfficePage]: OfficePage,
5856
[ContentType.CurrentTopicPage]: CurrentTopicPage,
5957
[ContentType.PressLandingPage]: PressLandingPage,

Diff for: src/components/pages/office-branch-page/OfficeBranchPage.module.scss

-32
This file was deleted.

Diff for: src/components/pages/office-branch-page/OfficeBranchPage.tsx

-29
This file was deleted.

Diff for: src/components/pages/office-page/OfficePage.module.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
$margin: 2rem;
44

5-
.officeBranchPage {
5+
.officePage {
66
display: flex;
77
flex-direction: column;
88
}

Diff for: src/components/pages/office-page/OfficePage.tsx

+19-4
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,38 @@ import React from 'react';
22
import { ComponentMapper } from 'components/ComponentMapper';
33
import { OfficePageProps } from 'types/content-props/dynamic-page-props';
44
import { classNames } from 'utils/classnames';
5+
import { logger } from 'srcCommon/logger';
56

6-
import { OfficePageHeader } from 'components/pages/office-branch-page/office-page-header/OfficePageHeader';
7-
import { OfficeDetails } from 'components/pages/office-branch-page/office-details/OfficeDetails';
7+
import { OfficePageHeader } from 'components/pages/office-page/office-page-header/OfficePageHeader';
8+
import { OfficeDetails } from 'components/pages/office-page/office-details/OfficeDetails';
89

910
import styles from './OfficePage.module.scss';
1011

1112
export const OfficePage = (props: OfficePageProps) => {
1213
const officeNorgData = props.data.officeNorgData.data;
14+
const isOfficeBranch = officeNorgData.type === 'LOKAL';
15+
const editorialPage = props.editorial;
16+
17+
if (!officeNorgData) {
18+
logger.error('No office data exists for this office page');
19+
return null;
20+
}
21+
22+
if (isOfficeBranch && !editorialPage) {
23+
logger.error(`No editorial page found for office branch ${props.displayName}`);
24+
return null;
25+
}
26+
27+
const page = isOfficeBranch && editorialPage ? editorialPage.page : props.page;
1328

1429
return (
15-
<div className={styles.officeBranchPage}>
30+
<div className={styles.officePage}>
1631
{officeNorgData && (
1732
<OfficePageHeader officeDetails={officeNorgData} showTimeStamp={false} />
1833
)}
1934
{officeNorgData && <OfficeDetails officeData={officeNorgData} />}
2035
<div className={classNames(styles.content, styles.pageContent)}>
21-
<ComponentMapper componentProps={props.page} pageProps={props} />
36+
<ComponentMapper componentProps={page} pageProps={props} />
2237
</div>
2338
</div>
2439
);

Diff for: src/components/pages/office-branch-page/office-details/officeInformation/OfficeInformation.tsx renamed to src/components/pages/office-page/office-details/officeInformation/OfficeInformation.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ExpansionCard, BodyShort, Heading } from '@navikt/ds-react';
22
import { usePageContentProps } from 'store/pageContext';
33
import { translator } from 'translations';
44
import { OfficeDetailsData } from 'types/content-props/office-details-props';
5-
import { officeDetailsFormatAddress } from 'components/pages/office-branch-page/office-details/utils';
5+
import { officeDetailsFormatAddress } from 'components/pages/office-page/office-details/utils';
66

77
import styles from './OfficeInformation.module.scss';
88

Diff for: src/components/pages/office-branch-page/office-details/phonePoster/AudienceChannels.tsx renamed to src/components/pages/office-page/office-details/phonePoster/AudienceChannels.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BodyShort } from '@navikt/ds-react';
22
import { LenkeBase } from 'components/_common/lenke/LenkeBase';
33
import { AudienceContact } from 'types/content-props/office-details-props';
4-
import { officeDetailsFormatPhoneNumber } from 'components/pages/office-branch-page/office-details/utils';
4+
import { officeDetailsFormatPhoneNumber } from 'components/pages/office-page/office-details/utils';
55

66
import styles from './AudienceChannels.module.scss';
77

Diff for: src/components/pages/office-branch-page/office-details/phonePoster/PhonePoster.tsx renamed to src/components/pages/office-page/office-details/phonePoster/PhonePoster.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import { BodyLong, BodyShort, Heading } from '@navikt/ds-react';
33
import { PhoneFillIcon } from '@navikt/aksel-icons';
4-
import { OfficeDetailsProps } from 'components/pages/office-branch-page/office-details/OfficeDetails';
4+
import { OfficeDetailsProps } from 'components/pages/office-page/office-details/OfficeDetails';
55
import { translator } from 'translations';
6-
import { officeDetailsFormatPhoneNumber } from 'components/pages/office-branch-page/office-details/utils';
6+
import { officeDetailsFormatPhoneNumber } from 'components/pages/office-page/office-details/utils';
77
import { usePageContentProps } from 'store/pageContext';
88
import { forceArray } from 'utils/arrays';
99
import { LenkeBase } from 'components/_common/lenke/LenkeBase';

Diff for: src/components/parts/_legacy/office-information/OfficeInformationLegacyPart.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Heading, BodyLong, BodyShort } from '@navikt/ds-react';
33
import {
44
officeDetailsFormatAddress,
55
officeDetailsFormatPhoneNumber,
6-
} from 'components/pages/office-branch-page/office-details/utils';
6+
} from 'components/pages/office-page/office-details/utils';
77
import { OfficeInfoEmail } from 'components/parts/_legacy/office-information/OfficeInfoEmail';
88
import ArtikkelDato from 'components/parts/_legacy/main-article/komponenter/ArtikkelDato';
99
import { LenkeInline } from 'components/_common/lenke/LenkeInline';

Diff for: src/components/parts/_legacy/office-information/reception/Reception.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
LegacyOfficeOpeningHoursProps,
88
} from 'types/content-props/office-information-props';
99
import { forceArray } from 'utils/arrays';
10-
import { officeDetailsFormatAddress } from 'components/pages/office-branch-page/office-details/utils';
10+
import { officeDetailsFormatAddress } from 'components/pages/office-page/office-details/utils';
1111
import { OpeningHours } from './OpeningHours';
1212

1313
import style from './Reception.module.scss';

Diff for: src/components/parts/office-editorial-detail/OfficeEditorialDetailPart.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ export const OfficeEditorialDetailPart = ({
6464
);
6565
}
6666

67-
if (pageProps.type !== ContentType.OfficeBranchPage) {
67+
if (pageProps.type !== ContentType.OfficePage) {
68+
return null;
69+
}
70+
71+
const officeData = pageProps.data.officeNorgData.data;
72+
73+
if (!officeData) {
6874
return null;
6975
}
7076

@@ -73,5 +79,5 @@ export const OfficeEditorialDetailPart = ({
7379
return null;
7480
}
7581

76-
return <DetailComponent officeData={pageProps.data} />;
82+
return <DetailComponent officeData={officeData} />;
7783
};

Diff for: src/types/content-props/_content-common.ts

-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
DynamicPageProps,
2525
GenericPageProps,
2626
GuidePageProps,
27-
OfficeBranchPageProps,
2827
OfficeEditorialPageProps,
2928
CurrentTopicPageProps,
3029
ProductDetailsProps,
@@ -72,7 +71,6 @@ export enum ContentType {
7271
ProductPage = 'no.nav.navno:content-page-with-sidemenus',
7372
ProductDetails = 'no.nav.navno:product-details',
7473
OfficeEditorialPage = 'no.nav.navno:office-editorial-page',
75-
OfficeBranchPage = 'no.nav.navno:office-branch',
7674
GuidePage = 'no.nav.navno:guide-page',
7775
ThemedArticlePage = 'no.nav.navno:themed-article-page',
7876
CurrentTopicPage = 'no.nav.navno:current-topic-page',
@@ -174,7 +172,6 @@ type SpecificContentProps =
174172
| ProductPageProps
175173
| SituationPageProps
176174
| OfficeEditorialPageProps
177-
| OfficeBranchPageProps
178175
| OfficePageProps
179176
| PictogramsProps
180177
| GlobalValuesProps

Diff for: src/types/content-props/dynamic-page-props.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,14 @@ export type OfficeEditorialPageProps = ContentCommonProps & {
6262
page: LayoutComponentProps;
6363
};
6464

65-
export type OfficeBranchPageProps = ContentCommonProps & {
66-
type: ContentType.OfficeBranchPage;
67-
data: OfficeDetailsData;
68-
editorial: OfficeEditorialPageProps;
69-
};
70-
7165
export type OfficePageProps = ContentCommonProps & {
7266
type: ContentType.OfficePage;
7367
data: {
7468
title: string;
7569
officeNorgData: OptionSetSingle<{ data: OfficeDetailsData }>;
7670
};
7771
page: LayoutComponentProps;
72+
editorial?: OfficeEditorialPageProps;
7873
};
7974

8075
export type CurrentTopicPageProps = ContentCommonProps & {

Diff for: src/utils/appearance.ts

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const contentTypesWithWhiteHeader: ReadonlySet<ContentType> = new Set([
2222
ContentType.FrontPageNested,
2323
ContentType.GenericPage,
2424
ContentType.GuidePage,
25-
ContentType.OfficeBranchPage,
2625
ContentType.OfficePage,
2726
ContentType.OfficeEditorialPage,
2827
ContentType.Overview,

0 commit comments

Comments
 (0)