Commit 793ad5e3 authored by Matija Obreza's avatar Matija Obreza
Browse files

Minor updates

- CountryLink accepts ISO3166 code
- Public site menus updated
parent 3f4dfc28
......@@ -186,7 +186,9 @@
"menu": {
"home": "Home",
"explore": "Explore",
"exploreAccessions": "Explore all accessions",
"exploreCountry": "PGRFA by country code",
"exploreInstitutes": "Genebanks",
"explorePartners": "Genesys partners",
"exploreOrganizations": "PGRFA networks",
"exploreCrops": "Crops and crop groups",
......
......@@ -22,6 +22,7 @@ import Card, { CardHeader, CardContent, CardActions } from 'ui/common/Card';
import Button from '@material-ui/core/Button';
import Permissions from 'ui/common/permission/Permissions';
import PageLayout from 'ui/layout/PageLayout';
import { InstituteLink, CountryLink } from 'ui/genesys/Links';
interface IPartnerPageProps extends React.ClassAttributes<any> {
classes: any;
......@@ -120,14 +121,18 @@ class PartnerPage extends React.Component<IPartnerPageProps, any> {
{ partnerInstitutes && partnerInstitutes.content && partnerInstitutes.content.length > 0 && (
<PropertiesItem title={ t('partners.common.wiewsCodes') }>
{ partnerInstitutes.content.map((institute) => (
<div key={ institute.code } style={ {marginTop: '.25em', width: '100%'} }><FaoWiewsLink wiewsCode={ institute.code }>{ institute.code }</FaoWiewsLink></div>
<div key={ institute.code }>
<InstituteLink to={ institute }><b>{ institute.code }</b> { institute.fullName }</InstituteLink>
{ ` ` }
<small><FaoWiewsLink wiewsCode={ institute.code }>({ t('View on FAO WIEWS website') })</FaoWiewsLink></small>
</div>
)) }
</PropertiesItem>
) }
{ partner.countryCodes.length > 0 && (
<PropertiesItem title={ t('partners.common.countries') }>
{ partner.countryCodes.map((countryCode) => (
<div key={ countryCode }>{ countryCode }</div>
<div key={ countryCode }><CountryLink country={ countryCode } /></div>
)) }
</PropertiesItem>
) }
......
......@@ -185,7 +185,9 @@
"menu": {
"home": "Home",
"explore": "Explore",
"exploreAccessions": "Explore all accessions",
"exploreCountry": "PGRFA by country code",
"exploreInstitutes": "Genebanks",
"explorePartners": "Genesys partners",
"exploreOrganizations": "PGRFA networks",
"exploreCrops": "Crops and crop groups",
......
......@@ -86,15 +86,24 @@ function UserLink({ to: user, edit = false, children = null }: { to: User, edit?
}
}
const CountryLink = ({ country, noflag, children }: { country: Country, noflag?: boolean, children?: any }) => {
const CountryLink = ({ country, noflag, children }: { country: Country | string, noflag?: boolean, children?: any }) => {
if (! country) {
return null;
}
let name: string = '';
let code: string = '';
if (typeof country === 'string') {
// it's a ISO3166 code
name = code = country;
} else {
name = country.name;
code = country.code3;
}
return (
<Link to={ `/iso3166/${country.code3}` }>
<Link to={ `/iso3166/${code}` }>
<div style={ {display: 'flex', alignItems: 'center'} }>
{ !noflag && <img src={ `images/flags/${country.code3}.png` } style={ {maxWidth: '1.25rem', padding: '0 0.25rem'} } /> }
{ children || country.name }
{ !noflag && <img src={ `images/flags/${code}.png` } style={ { maxWidth: '1.25rem', padding: '0 0.25rem' } } /> }
{ children || name }
</div>
</Link>
);
......
......@@ -44,7 +44,7 @@ const PUBLIC_MENUS = [
subMenus: [
{
to: '/a',
label: 'public.menu.explore',
label: 'public.menu.exploreAccessions',
},
{
to: '/c',
......@@ -62,6 +62,10 @@ const PUBLIC_MENUS = [
to: '/descriptorlists',
label: 'public.menu.exploreDescriptorLists',
},
{
to: '/wiews',
label: 'public.menu.exploreInstitutes',
},
{
to: '/iso3166',
label: 'public.menu.exploreCountry',
......
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