Skip to content

Commit 01b6560

Browse files
authored
Merge pull request #118 from navikt/alert-migrert-innholdstype
Alert migrert innholdstype
2 parents 2e08fbd + ddd8d38 commit 01b6560

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

xp-archive/client/contentView/ContentView.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const getDisplayComponent = (viewVariant?: ViewVariant, data?: ContentServiceRes
1616
nodeId={data.json._id}
1717
locale={data.json.language}
1818
versionId={data.json._versionKey}
19+
originalContentTypeName={data.json.originalContentTypeName}
1920
/>
2021
),
2122
filepreview: <FilePreviewWrapper content={data.json} />,
@@ -34,5 +35,6 @@ export const ContentView = ({ selectedView, isLoading, data }: Props) => {
3435
if (isLoading) {
3536
return <Loader size="xlarge" />;
3637
}
38+
3739
return <div className={style.main}>{getDisplayComponent(selectedView, data)}</div>;
3840
};

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

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
import React, { useState } from 'react';
22
import style from './HtmlView.module.css';
33
import { xpArchiveConfig } from '@common/shared/siteConfigs';
4-
import { Loader } from '@navikt/ds-react';
4+
import { Alert, Loader } from '@navikt/ds-react';
55

66
type Props = {
77
nodeId: string;
88
locale: string;
99
versionId: string;
10+
originalContentTypeName: string | undefined;
1011
};
1112

1213
const localesToOverwrite = ['uk', 'ru'];
1314

14-
export const HtmlView = ({ nodeId, locale: langLocale, versionId }: Props) => {
15+
export const HtmlView = ({
16+
nodeId,
17+
locale: langLocale,
18+
versionId,
19+
originalContentTypeName,
20+
}: Props) => {
1521
const [isLoading, setIsLoading] = useState(true);
1622
const locale = localesToOverwrite.includes(langLocale) ? 'no' : langLocale;
1723
const htmlPath = `${xpArchiveConfig.basePath}/html/${nodeId}/${locale}/${versionId}`;
1824

1925
return (
2026
<div className={style.wrapper}>
27+
{originalContentTypeName ? (
28+
<Alert variant="warning">{`Obs! Denne siden var opprinnelig en "${originalContentTypeName}" og inneholder versjonshistorikk.`}</Alert>
29+
) : null}
2130
{isLoading && (
2231
<div className={style.loaderWrapper}>
2332
<Loader size="xlarge" />

xp-archive/shared/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export type Content = {
6666
};
6767
data: Record<string, unknown>;
6868
attachment?: Attachment;
69+
originalContentTypeName?: string;
6970
};
7071

7172
export type SearchResponse = {

0 commit comments

Comments
 (0)