Skip to content
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

Merged
merged 6 commits into from
Nov 11, 2020

Conversation

zjjiang2
Copy link
Contributor

@zjjiang2 zjjiang2 commented Oct 29, 2020

Issue This PR Addresses

From Issue #1220

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

Added error handling for UX, includes:

  1. Post fails to load
    Error
  2. Post is loading
    Loading
  3. Timeline fails to load
    PostsError

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@manekenpix manekenpix changed the title Issue 1220 Closes #1220: Better error/loading handling when posts can't be loaded Oct 29, 2020
@humphd
Copy link
Contributor

humphd commented Nov 4, 2020

Pinging some reviewers for this. I like where it's headed, but wording might need tweaks.

cindyorangis
cindyorangis previously approved these changes Nov 7, 2020
Copy link
Contributor

@cindyorangis cindyorangis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great :D

Copy link
Contributor

@PedroFonsecaDEV PedroFonsecaDEV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't forget to REBASE before and after start working on the requested changes.
Thanks.

@@ -7,6 +7,9 @@ import { Box, Grid, Typography, ListSubheader } from '@material-ui/core';
import './telescope-post-content.css';
import AdminButtons from '../AdminButtons';

import Spinner from '../Spinner/Spinner.jsx';
import ErrorRoundedIcon from '@material-ui/icons/ErrorRounded';
Copy link
Contributor

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 ../AdminButtonseslintimport/order"

It's a quick fix, linter will handle this for you.

</ListSubheader>
</Box>
);
} else if (!post) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Prettier here.
Step #1 Just a click and you will be good.
Screen Shot 2020-11-08 at 12 45 28 AM

You can use the "Quick fix..."

Screen Shot 2020-11-08 at 12 45 55 AM

After this, run Prettier to solve the following issue(Quick fix again or Prettier shortcut):
Screen Shot 2020-11-08 at 12 50 25 AM

</Box>
);
} else {
return (
Copy link
Contributor

@PedroFonsecaDEV PedroFonsecaDEV Nov 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same problem of line 114. Follow the same steps and you will be good.

@@ -1,16 +1,31 @@
import React from 'react';
import { useSWRInfinite } from 'swr';

import { Container } from '@material-ui/core';
import { Container, Typography, Grid } from '@material-ui/core';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"'Typography' is declared but its value is never read.ts(6133)
'Typography' is defined but never used.eslintno-unused-vars"

import { makeStyles } from '@material-ui/core/styles';
import Timeline from './Timeline.jsx';
import useSiteMetaData from '../../hooks/use-site-metadata';

import SentimentDissatisfiedRoundedIcon from '@material-ui/icons/SentimentDissatisfiedRounded';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"@material-ui/icons/SentimentDissatisfiedRounded import should occur before import of ./Timeline.jsxeslintimport/order"

Lint will help you with this one too ("Quick fix...")

After fixing the import order, you will notice an error, run prettier again and you will be fine.

</Container>
);
} else {
return (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Unnecessary 'else' after 'return'.eslintno-else-return"

Same as before, use "Quick fix..." and then run prettier until solve the indentation problems.

@humphd
Copy link
Contributor

humphd commented Nov 10, 2020

@zjjiang2 did you want to finish this soon? You can probably use npm run eslint-fix and npm run prettier to sort out any issues that are left.

@PedroFonsecaDEV
Copy link
Contributor

@zjjiang2 We still have some minor fixes about imports order:

1 and 2

Then I think your PR will be good to go.

Thanks.

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with one question about theme colours vs. raw colour values.

@@ -11,6 +12,19 @@ const useStyles = makeStyles(() => ({
padding: 0,
maxWidth: '785px',
},
error: {
position: 'center',
color: '#B5B5B5',
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

},
errorIcon: {
position: 'center',
color: '#B5B5B5',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here re: colours/theme.

@PedroFonsecaDEV
Copy link
Contributor

@manekenpix
It's good to go.
Should I click on "Merge pull request" or "Rebase and merge"?

@manekenpix
Copy link
Member

manekenpix commented Nov 11, 2020

Rebasing would be ideal so we can keep a linear history, but I don't trust github solving conflicts so I guess we'll have to merge it as it is.

@PedroFonsecaDEV PedroFonsecaDEV merged commit 7d97026 into Seneca-CDOT:master Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants