Commit 0d308f31 authored by Matija Obreza's avatar Matija Obreza

Merge branch '344-descriptor-display'

* 344-descriptor-display:
  Added not-published warning to Descriptor Lists
  Added not-published warning to Descriptor display
parents 67e690bc 3b573067
......@@ -133,7 +133,8 @@
"basicMarkdown": "Basic markdown supported",
"fullMarkdown": "Full markdown supported",
"previewMarkdown": "Preview markdown",
"editMarkdown": "Edit Markdown"
"editMarkdown": "Edit Markdown",
"warning": "Warning"
},
"paginate": {
"numberOfItems": "{{count, number}} {{what, lowercase}}",
......
......@@ -1579,6 +1579,7 @@
"deleteDescription": "Deleting the descriptor is only possible when there is no associated data.",
"title": "Descriptor details",
"isNotPublishedAlert": "This descriptor is not yet published!",
"keyDescriptor": "Key descriptor",
"keyAlert": "This descriptor is a key descriptor for access and utilization of PGR.",
"crop": "Crop",
"version": "Version",
......
......@@ -67,6 +67,11 @@ const styles = (theme) => ({
},
},
},
warning: {
'& > div': {
backgroundColor: '#ffe2e2 !important',
},
},
});
interface IDetailInfoProps extends React.ClassAttributes<any> {
......@@ -233,9 +238,6 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
}
subheader={ <small>{ descriptorList.versionTag }</small> }/>
<CardContent className={ classes.cardContent }>
{ descriptorList.state !== PublishState.PUBLISHED &&
<h2>{ t('descriptorlists.public.c.descrListsDisplay.notPublishedAlert') }</h2>
}
{ descriptorList.description &&
<BlurbText className="mb-20">
<Markdown source={ descriptorList.description }/>
......@@ -243,6 +245,12 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
}
<Properties>
{ descriptorList.state !== PublishState.PUBLISHED &&
<PropertiesItem className={ classes.warning } title={ t('common:label.warning') }>
{ t('descriptorlists.public.c.descrListsDisplay.notPublishedAlert') }
</PropertiesItem>
}
{ descriptorList.crop &&
<PropertiesItem title={ t('descriptorlists.public.common.crop') }>
<CropChips crops={ [descriptorList.crop] }/>
......
......@@ -176,6 +176,7 @@
"deleteDescription": "Deleting the descriptor is only possible when there is no associated data.",
"title": "Descriptor details",
"isNotPublishedAlert": "This descriptor is not yet published!",
"keyDescriptor": "Key descriptor",
"keyAlert": "This descriptor is a key descriptor for access and utilization of PGR.",
"crop": "Crop",
"version": "Version",
......
......@@ -2,6 +2,7 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { translate } from 'react-i18next';
import { withStyles } from '@material-ui/core/styles';
import { log } from 'utilities/debug';
import { fixDate } from 'utilities';
......@@ -39,6 +40,14 @@ import ListItemText from '@material-ui/core/ListItemText';
import DescriptorTerms from './c/DescriptorTerms';
import BlurbText from 'cms/ui/c/BlurbText';
const styles = (theme) => ({
warning: {
'& > div': {
backgroundColor: '#ffe2e2 !important',
},
},
});
interface IDisplayPageProps extends React.ClassAttributes<any> {
classes: any;
uuid?: string;
......@@ -130,7 +139,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
}
public render() {
const { loading, descriptor, error, descriptorExtra, t } = this.props;
const { loading, descriptor, error, descriptorExtra, t, classes } = this.props;
const oneDay = 24 * 60 * 60 * 1000;
const oneDayPassed = descriptor && (fixDate(descriptor.lastModifiedDate).getTime() <= (new Date()).getTime() - oneDay);
......@@ -157,9 +166,6 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
/>
}/>
<CardContent>
{ descriptor.state !== PublishState.PUBLISHED && <h2>{ t('descriptors.public.p.display.isNotPublishedAlert') }</h2> }
{ descriptor.key && <h2>{ t('descriptors.public.p.display.keyAlert') }</h2> }
{ descriptor.description &&
<BlurbText className="mb-20">
<Markdown source={ descriptor.description }/>
......@@ -167,6 +173,11 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
}
<Properties>
{ descriptor.state !== PublishState.PUBLISHED &&
<PropertiesItem className={ classes.warning } title={ t('common:label.warning') }>
{ t('descriptors.public.p.display.isNotPublishedAlert') }
</PropertiesItem>
}
{ descriptor.crop &&
<PropertiesItem title={ t('descriptors.public.p.display.crop') }>
<CropLink code={ descriptor.crop }/>
......@@ -183,6 +194,11 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
<PartnerLink to={ descriptor.owner }/>
</PropertiesItem>
}
{ descriptor.key &&
<PropertiesItem title={ t('descriptors.public.p.display.keyDescriptor') }>
{ t('descriptors.public.p.display.keyAlert') }
</PropertiesItem>
}
</Properties>
</CardContent>
......@@ -329,4 +345,4 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
deleteDescriptor,
}, dispatch);
export default translate()(connect(mapStateToProps, mapDispatchToProps)(DisplayPage));
export default translate()(connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(DisplayPage)));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment