Commit 9b4fcfd6 authored by Matija Obreza's avatar Matija Obreza

Fix: Entry page crops SSR bug

- Mismatched links and crop names
parent 11f43ac1
......@@ -345,12 +345,10 @@ const styles = (theme) => ({
},
possibleBecauseLink: {
paddingTop: '0!important',
'& > a': {
fontSize: '1.286rem',
lineHeight: 1.55,
fontWeight: 'bold' as 'bold',
color: 'white',
}
fontSize: '1.286rem',
lineHeight: 1.55,
fontWeight: 'bold' as 'bold',
color: 'white',
},
possibleBecauseCard: {
backgroundColor: '#87b842',
......@@ -408,17 +406,20 @@ class WelcomePage extends React.Component<IWelcomeProps, any> {
}
public componentWillMount() {
const { loadLastNews, lastNews, crops } = this.props;
const { loadLastNews, lastNews } = this.props;
if (!lastNews) {
loadLastNews();
}
this.randomizeCrops(crops);
}
public componentWillUnmount() {
this.setState({ ...this.state, crops: [] });
}
public componentDidMount() {
this.randomizeCrops(this.props.crops);
}
public componentWillReceiveProps(nextProps) {
const { crops } = nextProps;
this.randomizeCrops(crops);
......@@ -643,46 +644,46 @@ class WelcomePage extends React.Component<IWelcomeProps, any> {
/>
<GridContainer>
<Grid item xs={ 12 } md={ 4 } >
<Card className={ `${classes.fullHeight} ${classes.possibleBecauseCard}` }>
<CardHeader
className={ classes.iconWrapper }
avatar={ <TerrainIcon className={ classes.icon }/> }
classes={ { avatar: classes.avatar } }
/>
<CardContent className={ classes.possibleBecauseLink }>
<Link to="/iso3166">
<Link to="/iso3166">
<Card className={ `${classes.fullHeight} ${classes.possibleBecauseCard}` }>
<CardHeader
className={ classes.iconWrapper }
avatar={ <TerrainIcon className={ classes.icon }/> }
classes={ { avatar: classes.avatar } }
/>
<CardContent className={ classes.possibleBecauseLink }>
{ t('public.p.welcome.ackProvenance') }
</Link>
</CardContent>
</Card>
</CardContent>
</Card>
</Link>
</Grid>
<Grid item xs={ 12 } md={ 4 } >
<Card className={ `${classes.fullHeight} ${classes.possibleBecauseCard}` }>
<CardHeader
className={ classes.iconWrapper }
avatar={ <ChartIcon className={ classes.icon }/> }
classes={ { avatar: classes.avatar } }
/>
<CardContent className={ classes.possibleBecauseLink }>
<Link to="/partners">
<Link to="/partners">
<Card className={ `${classes.fullHeight} ${classes.possibleBecauseCard}` }>
<CardHeader
className={ classes.iconWrapper }
avatar={ <ChartIcon className={ classes.icon }/> }
classes={ { avatar: classes.avatar } }
/>
<CardContent className={ classes.possibleBecauseLink }>
{ t('public.p.welcome.ackData') }
</Link>
</CardContent>
</Card>
</CardContent>
</Card>
</Link>
</Grid>
<Grid item xs={ 12 } md={ 4 } >
<Card className={ `${classes.fullHeight} ${classes.possibleBecauseCard}` }>
<CardHeader
className={ classes.iconWrapper }
avatar={ <FavoriteIcon className={ classes.icon }/> }
classes={ { avatar: classes.avatar } }
/>
<CardContent className={ classes.possibleBecauseLink }>
<Link to="/content/about">
<Link to="/content/about">
<Card className={ `${classes.fullHeight} ${classes.possibleBecauseCard}` }>
<CardHeader
className={ classes.iconWrapper }
avatar={ <FavoriteIcon className={ classes.icon }/> }
classes={ { avatar: classes.avatar } }
/>
<CardContent className={ classes.possibleBecauseLink }>
{ t('public.p.welcome.ackDonors') }
</Link>
</CardContent>
</Card>
</CardContent>
</Card>
</Link>
</Grid>
</GridContainer>
......
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