-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #1220: Better error/loading handling when posts can't be loaded #1251
Changes from all commits
a131bcd
8e86fa4
f27d6c9
591565d
2601d47
16bb9f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import React from 'react'; | ||
import { useSWRInfinite } from 'swr'; | ||
|
||
import { Container } from '@material-ui/core'; | ||
import { Container, Grid } from '@material-ui/core'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import SentimentDissatisfiedRoundedIcon from '@material-ui/icons/SentimentDissatisfiedRounded'; | ||
import Timeline from './Timeline.jsx'; | ||
import useSiteMetaData from '../../hooks/use-site-metadata'; | ||
|
||
|
@@ -11,6 +12,19 @@ const useStyles = makeStyles(() => ({ | |
padding: 0, | ||
maxWidth: '785px', | ||
}, | ||
error: { | ||
position: 'center', | ||
color: '#B5B5B5', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cindyledev, @agarcia-caicedo or someone else who knows our theme code: are there theme values we should be using for these colours instead? |
||
fontFamily: 'Roboto', | ||
fontSize: '5rem', | ||
paddingBottom: '30px', | ||
}, | ||
errorIcon: { | ||
position: 'center', | ||
color: '#B5B5B5', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here re: colours/theme. |
||
fontSize: '10rem', | ||
paddingBottom: 0, | ||
}, | ||
})); | ||
|
||
const REFRESH_INTERVAL = 5 * 60 * 1000; /* refresh data every 5 minutes */ | ||
|
@@ -29,7 +43,22 @@ const Posts = () => { | |
// TODO: need proper error handling | ||
if (error) { | ||
console.error('Error loading post data', error); | ||
return null; | ||
return ( | ||
<Container className={classes.root}> | ||
<Grid | ||
container | ||
className={classes.error} | ||
justify="center" | ||
alignItems="center" | ||
direction="column" | ||
> | ||
<Grid item> | ||
<SentimentDissatisfiedRoundedIcon className={classes.errorIcon} /> | ||
</Grid> | ||
<Grid item>Blog Timeline Failed to Load!</Grid> | ||
</Grid> | ||
</Container> | ||
); | ||
} | ||
|
||
return ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"
@material-ui/icons/ErrorRounded
import should occur before import of../AdminButtons
eslintimport/order"It's a quick fix, linter will handle this for you.