Skip to content

Commit ec6440e

Browse files
committed
Hent ut riktig locale, ikke bruk language
1 parent c6968d0 commit ec6440e

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

xp-archive/client/contentView/ContentView.tsx

+10-5
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@ import style from './ContentView.module.css';
1010

1111
const getDisplayComponent = (viewVariant?: ViewVariant, data?: ContentServiceResponse | null) => {
1212
if (!data || !viewVariant) return null;
13+
14+
const { json: content } = data;
15+
1316
const components: Record<ViewVariant, React.ReactElement> = {
1417
html: (
1518
<HtmlView
16-
nodeId={data.json._id}
17-
locale={data.json.language}
18-
versionId={data.json._versionKey}
19-
originalContentTypeName={data.json.originalContentTypeName}
19+
nodeId={content._id}
20+
locale={
21+
data.versions.find((v) => v.versionId === content._versionKey)?.locale || 'no'
22+
}
23+
versionId={content._versionKey}
24+
originalContentTypeName={content.originalContentTypeName}
2025
/>
2126
),
22-
filepreview: <FilePreviewWrapper content={data.json} />,
27+
filepreview: <FilePreviewWrapper content={content} />,
2328
pdf: <PdfExport versions={data.versions} />,
2429
};
2530
return components[viewVariant];

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

+1-9
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,8 @@ type Props = {
1010
originalContentTypeName: string | undefined;
1111
};
1212

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

2517
return (

0 commit comments

Comments
 (0)