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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor media player #183

Merged
merged 15 commits into from
Sep 18, 2019
Merged

Refactor media player #183

merged 15 commits into from
Sep 18, 2019

Conversation

jamesdools
Copy link
Contributor

@jamesdools jamesdools commented Aug 14, 2019

Is your Pull Request request related to another issue in this repository ?

Describe what the PR does

Refactoring the codebase, starting with MediaPlayer. Initially making the methods and props more succinct, will add testing and optimisations later.

Going by commit:

  • Fixed the font configuration in the storybook config. Realised we want Serif for titles and sans for body text. More readable now.
  • Fixed the loading order of the top level components and cleaned up that code. Made ES6 changes and removed many if videoRef !== null checks.
  • Fixed the webpack configuration - colours / globals were becoming really weird and hard to refactor. Now using scss variables at base, updated webpack with sass loaders (no extra packages needed).
  • The sidebar in storybook is empty - hiding for now. Better for demo.
  • Quick tidy of the demo styling and code.
  • General refactor of MediaPlayer styles
    • Many were copy and pasted entirely into different breakpoints, doubling or tripling the amount of css required, and also making it very unreadable.
    • Big cut down on duplicated and redundant / or broken css.
    • Refactored into nested scss, so more readable. Was getting difficult!
    • Added some TLC, better heading spacing, line-height, and hover states for buttons.
  • Removed PauseWhileTyping, Rollback and ScrollIntoView components. All unused.
  • Put non components into config folder

State whether the PR is ready for review or whether it needs extra work

馃憤
Additional context

@pietrop
Copy link
Contributor

pietrop commented Aug 16, 2019

@jamesdools given that in the last refactor we introduced a bug #185 (now fixed #186) I suggest that before going ahead with this the QA doc should be updated, and QA should be run as an acceptance criteria before merging PRs that do substantial refactor. #187

@pietrop pietrop mentioned this pull request Aug 16, 2019
1 task
@jamesdools jamesdools marked this pull request as ready for review August 20, 2019 10:13
@jamesdools
Copy link
Contributor Author

Done the QA on this - looks okay to me.

@@ -6,36 +6,28 @@ module.exports = {
module: {
rules: [
{
test: /\.module.css$/,
Copy link
Contributor

Choose a reason for hiding this comment

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

does this mean we are only supporting CSS modules?

@emettely emettely self-requested a review September 5, 2019 15:20
Copy link

@barneyboo barneyboo left a comment

Choose a reason for hiding this comment

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

looking good! 馃挮


.container {
height: 100vh;
font-family: ReithSerif, Fallback, sans-serif;

Choose a reason for hiding this comment

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

I don't think Fallback will resolve to anything - is this meant to be a reference to a mixin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch - I followed this from somewhere (I'm sure int-gel-matter or a component library) but I can't find it anymore - it's only us doing it!

So yeah - I think this can be removed 馃槄

}

/* desktop */
@media (min-width: 767px) {

Choose a reason for hiding this comment

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

Suggested change
@media (min-width: 767px) {
@media (min-width: 768px) {

Breakpoints can go a bit weird if the min/max are the same - better for the min-width to be max+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, I'm never quite sure on this. So we should move to 768?


return false;
shouldComponentUpdate = (nextProps) => {
return nextProps !== this.props;

Choose a reason for hiding this comment

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

I think checking for object equality here will always return true (since it only checks that they're the same reference in memory). Better to compare on the relevant props that might have changed between renders.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. Yeah this was to improve the rendering performance but without cluttering the code too much. Is there a working one-liner for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking either the lodash isEqual or perhaps this:
https://www.npmjs.com/package/react-fast-compare

have you used it before?

if (nextProps !== this.props) return true;

return false;
return nextProps !== this.props;

Choose a reason for hiding this comment

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

Same comment as above ^ re: checking props equality

@jamesdools jamesdools merged commit c06416a into master Sep 18, 2019
@jamesdools jamesdools deleted the refactor-media-player branch September 18, 2019 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants