Skip to content

Commit 14c2b86

Browse files
committed
Merge branch 'main' into keep-open-version-selector-2
2 parents cafcab8 + 4a65e69 commit 14c2b86

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

xp-archive/client/contentView/ContentView.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ const getDisplayComponent = (viewVariant?: ViewVariant, data?: ContentServiceRes
1616
const components: Record<ViewVariant, React.ReactElement> = {
1717
html: (
1818
<HtmlView
19-
nodeId={content._id}
19+
content={content}
2020
locale={
2121
data.versions.find((v) => v.versionId === content._versionKey)?.locale || 'no'
2222
}
23-
versionId={content._versionKey}
24-
originalContentTypeName={content.originalContentTypeName}
2523
/>
2624
),
2725
filepreview: <FilePreviewWrapper content={content} />,

xp-archive/client/contentView/htmlView/HtmlView.tsx

+15-7
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,30 @@ import React, { useState } from 'react';
22
import style from './HtmlView.module.css';
33
import { xpArchiveConfig } from '@common/shared/siteConfigs';
44
import { Alert, Loader } from '@navikt/ds-react';
5+
import { Content } from '../../../shared/types';
56

67
type Props = {
7-
nodeId: string;
8+
content: Content;
89
locale: string;
9-
versionId: string;
10-
originalContentTypeName: string | undefined;
10+
};
11+
const localeNames: Record<string, string> = {
12+
no: 'norsk (bokmål)',
13+
nn: 'nynorsk',
14+
en: 'engelsk',
15+
se: 'samisk',
1116
};
1217

13-
export const HtmlView = ({ nodeId, locale, versionId, originalContentTypeName }: Props) => {
18+
export const HtmlView = ({ content, locale }: Props) => {
1419
const [isLoading, setIsLoading] = useState(true);
15-
const htmlPath = `${xpArchiveConfig.basePath}/html/${nodeId}/${locale}/${versionId}`;
20+
const htmlPath = `${xpArchiveConfig.basePath}/html/${content._id}/${locale}/${content._versionKey}`;
1621

1722
return (
1823
<div className={style.wrapper}>
19-
{originalContentTypeName ? (
20-
<Alert variant="warning">{`Obs! Denne siden var opprinnelig en "${originalContentTypeName}" og inneholder versjonshistorikk.`}</Alert>
24+
{content.originalContentTypeName ? (
25+
<Alert variant="warning">{`Obs! Denne siden var opprinnelig en "${content.originalContentTypeName}" og inneholder versjonshistorikk.`}</Alert>
26+
) : null}
27+
{content.x['no-nav-navno'].redirectToLayer.locale ? (
28+
<Alert variant="warning">{`Obs! Denne siden er satt som redirect til språkversjonen for "${localeNames[content.x['no-nav-navno'].redirectToLayer.locale]}". Husk å velge riktig språkversjon for å se korrekt historikk.`}</Alert>
2129
) : null}
2230
{isLoading && (
2331
<div className={style.loaderWrapper}>

xp-archive/shared/types.ts

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ export type Content = {
6565
to?: string;
6666
};
6767
data: Record<string, unknown>;
68+
x: {
69+
'no-nav-navno': {
70+
redirectToLayer: {
71+
locale: string;
72+
};
73+
};
74+
};
6875
attachment?: Attachment;
6976
originalContentTypeName?: string;
7077
};

0 commit comments

Comments
 (0)