Commit fdb9d2ca authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

Overview data for crop

parent bc09ab66
......@@ -371,7 +371,11 @@
"display": {
"title": "Crop details",
"generalInformation": "General information",
"otherNames": "Other names"
"otherNames": "Other names",
"holdingInstitutes": "Holding institutes",
"countryOfInstitutes": "Country of holding institute",
"representedGenera": "Most represented Genera",
"representedSpecies": "Most represented Species"
},
"browse": {
"title": "Crop list",
......
......@@ -13,7 +13,11 @@
"display": {
"title": "Crop details",
"generalInformation": "General information",
"otherNames": "Other names"
"otherNames": "Other names",
"holdingInstitutes": "Holding institutes",
"countryOfInstitutes": "Country of holding institute",
"representedGenera": "Most represented Genera",
"representedSpecies": "Most represented Species"
},
"browse": {
"title": "Crop list",
......
......@@ -21,6 +21,8 @@ import Section from 'ui/common/layout/Section';
import Loading from 'ui/common/Loading';
import PropertiesCard from 'ui/common/PropertiesCard';
import Number from 'ui/common/Number';
import GridContainer from 'ui/layout/GridContainer';
import PieChart from 'ui/common/pie-chart';
/*tslint:disable*/
const styles = (theme) => ({
......@@ -110,6 +112,85 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
</Properties>
</PageSection>
{ crop.overview &&
<GridContainer className="pb-1rem">
{ crop.overview['institute.code'] && crop.overview['institute.code'].terms &&
<PropertiesCard
title={ t('crop.public.p.display.holdingInstitutes') }
propertiesList={ crop.overview['institute.code'].terms.slice(0, 5).map((term) => ({ title: term.term, value: term.count })) }
small
>
<PieChart
data={
crop.overview['institute.code'].terms.map(
(term) => ({
value: term.count,
label: term.term,
}),
)
}
/>
</PropertiesCard>
}
{ crop.overview['institute.country.code3'] && crop.overview['institute.country.code3'].terms &&
<PropertiesCard
title={ t('crop.public.p.display.countryOfInstitutes') }
propertiesList={ crop.overview['institute.country.code3'].terms.slice(0, 5).map((term) => ({ title: term.term, value: term.count })) }
small
>
<PieChart
data={
crop.overview['institute.country.code3'].terms.map(
(term) => ({
value: term.count,
label: term.term,
}),
)
}
/>
</PropertiesCard>
}
{ crop.overview['taxonomy.genus'] && crop.overview['taxonomy.genus'].terms &&
<PropertiesCard
title={ t('crop.public.p.display.representedGenera') }
propertiesList={ crop.overview['taxonomy.genus'].terms.slice(0, 5).map((term) => ({ title: term.term, value: term.count })) }
small
>
<PieChart
data={
crop.overview['taxonomy.genus'].terms.map(
(term) => ({
value: term.count,
label: term.term,
}),
)
}
/>
</PropertiesCard>
}
{ crop.overview['taxonomy.genusSpecies'] && crop.overview['taxonomy.genusSpecies'].terms &&
<PropertiesCard
title={ t('crop.public.p.display.representedSpecies') }
propertiesList={ crop.overview['taxonomy.genusSpecies'].terms.slice(0, 5).map((term) => ({ title: term.term, value: term.count })) }
small
>
<PieChart
data={
crop.overview['taxonomy.genusSpecies'].terms.map(
(term) => ({
value: term.count,
label: term.term,
}),
)
}
/>
</PropertiesCard>
}
</GridContainer >
}
<PropertiesCard title={ t(`crop.public.p.display.otherNames`) } propertiesList={ crop.otherNames.map((otherName) => ({title: otherName})) } propertyItemProps={ {keepEmpty: true, small: true} }/>
</PageContents>
......
Supports Markdown
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