From 92e82b07bc157007f17b2c5722a68d6469d1963b Mon Sep 17 00:00:00 2001 From: Tale Prestmo Date: Wed, 19 Mar 2025 09:08:17 +0100 Subject: [PATCH] Add alert for layerredirect --- xp-archive/client/contentView/ContentView.tsx | 4 +--- .../client/contentView/htmlView/HtmlView.tsx | 22 +++++++++++++------ xp-archive/shared/types.ts | 7 ++++++ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/xp-archive/client/contentView/ContentView.tsx b/xp-archive/client/contentView/ContentView.tsx index 4f2c5c4..a08a240 100644 --- a/xp-archive/client/contentView/ContentView.tsx +++ b/xp-archive/client/contentView/ContentView.tsx @@ -16,12 +16,10 @@ const getDisplayComponent = (viewVariant?: ViewVariant, data?: ContentServiceRes const components: Record = { html: ( v.versionId === content._versionKey)?.locale || 'no' } - versionId={content._versionKey} - originalContentTypeName={content.originalContentTypeName} /> ), filepreview: , diff --git a/xp-archive/client/contentView/htmlView/HtmlView.tsx b/xp-archive/client/contentView/htmlView/HtmlView.tsx index 22b1234..bfedac3 100644 --- a/xp-archive/client/contentView/htmlView/HtmlView.tsx +++ b/xp-archive/client/contentView/htmlView/HtmlView.tsx @@ -2,22 +2,30 @@ import React, { useState } from 'react'; import style from './HtmlView.module.css'; import { xpArchiveConfig } from '@common/shared/siteConfigs'; import { Alert, Loader } from '@navikt/ds-react'; +import { Content } from '../../../shared/types'; type Props = { - nodeId: string; + content: Content; locale: string; - versionId: string; - originalContentTypeName: string | undefined; +}; +const localeNames: Record = { + no: 'norsk (bokmål)', + nn: 'nynorsk', + en: 'engelsk', + se: 'samisk', }; -export const HtmlView = ({ nodeId, locale, versionId, originalContentTypeName }: Props) => { +export const HtmlView = ({ content, locale }: Props) => { const [isLoading, setIsLoading] = useState(true); - const htmlPath = `${xpArchiveConfig.basePath}/html/${nodeId}/${locale}/${versionId}`; + const htmlPath = `${xpArchiveConfig.basePath}/html/${content._id}/${locale}/${content._versionKey}`; return (
- {originalContentTypeName ? ( - {`Obs! Denne siden var opprinnelig en "${originalContentTypeName}" og inneholder versjonshistorikk.`} + {content.originalContentTypeName ? ( + {`Obs! Denne siden var opprinnelig en "${content.originalContentTypeName}" og inneholder versjonshistorikk.`} + ) : null} + {content.x['no-nav-navno'].redirectToLayer.locale ? ( + {`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.`} ) : null} {isLoading && (
diff --git a/xp-archive/shared/types.ts b/xp-archive/shared/types.ts index be42b88..caf0436 100644 --- a/xp-archive/shared/types.ts +++ b/xp-archive/shared/types.ts @@ -65,6 +65,13 @@ export type Content = { to?: string; }; data: Record; + x: { + 'no-nav-navno': { + redirectToLayer: { + locale: string; + }; + }; + }; attachment?: Attachment; originalContentTypeName?: string; };