1
1
import React from 'react' ;
2
- import { classNames } from '../../utils/classnames' ;
3
- import {
4
- ContentProps ,
5
- ContentType ,
6
- } from '../../types/content-props/_content-common' ;
7
- import { getContentLanguages } from '../../utils/languages' ;
2
+ import { classNames } from 'utils/classnames' ;
3
+ import { ContentProps , ContentType } from 'types/content-props/_content-common' ;
4
+ import { getContentLanguages } from 'utils/languages' ;
8
5
import { VersionHistory } from './version-history/VersionHistory' ;
9
6
import { PageWarning } from './page-warning/PageWarning' ;
7
+ import { translator } from 'translations' ;
10
8
11
9
import style from './TopContainer.module.scss' ;
12
10
@@ -25,27 +23,41 @@ type Props = {
25
23
} ;
26
24
27
25
export const TopContainer = ( { content } : Props ) => {
28
- const { __typename, breadcrumbs, isFailover, isPagePreview } = content ;
26
+ const {
27
+ __typename,
28
+ breadcrumbs,
29
+ isFailover,
30
+ isPagePreview,
31
+ originalType,
32
+ language,
33
+ } = content ;
29
34
const hasDecoratorWidgets =
30
35
breadcrumbs ?. length > 0 || getContentLanguages ( content ) ?. length > 0 ;
31
36
const hasWhiteHeader = contentTypesWithWhiteHeader [ __typename ] ;
32
37
// Should be shown in Content Studio only (except the edit view)
33
38
const showVersionPicker =
34
39
! ! content . editorView && content . editorView !== 'edit' ;
35
40
41
+ const warningLabels = translator ( 'pageWarnings' , language ) ;
42
+
36
43
return (
37
44
< >
38
45
{ isPagePreview && (
39
- < PageWarning
40
- labelKey = { 'draftWarning' }
41
- whiteBg = { hasWhiteHeader }
42
- />
46
+ < PageWarning whiteBg = { hasWhiteHeader } >
47
+ { warningLabels ( 'draftWarning' ) }
48
+ </ PageWarning >
43
49
) }
44
50
{ isFailover && (
45
- < PageWarning
46
- labelKey = { 'failoverWarning' }
47
- whiteBg = { hasWhiteHeader }
48
- />
51
+ < PageWarning whiteBg = { hasWhiteHeader } >
52
+ { warningLabels ( 'failoverWarning' ) }
53
+ </ PageWarning >
54
+ ) }
55
+ { originalType && content . editorView && (
56
+ < PageWarning whiteBg = { hasWhiteHeader } > { `${ warningLabels (
57
+ 'contentTypeChangedWarningPre'
58
+ ) } "${ originalType } "${ warningLabels (
59
+ 'contentTypeChangedWarningPost'
60
+ ) } `} </ PageWarning >
49
61
) }
50
62
< div
51
63
className = { classNames (
0 commit comments