Coder Social home page Coder Social logo

oguz3 / spotify-web-player Goto Github PK

View Code? Open in Web Editor NEW
221.0 4.0 47.0 5.03 MB

A front-end clone project of the Spotify Web Player. The project was created using React. Preview Link in Readme.

Home Page: https://www.quizrise.com

HTML 1.74% CSS 25.08% JavaScript 73.19%
reatctjs css html javascript spotify

spotify-web-player's Introduction

Spotify Web Player Clone

A front-end clone project of the Spotify Web Player. The project was created using React. This is my first big React.js project.

Preview Link

Tech/Framework Used

  • React
  • CSS

spotify-web-player's People

Contributors

oguz3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spotify-web-player's Issues

Unresponsive Page after 5 mins!

Hi oguz your react project is insane!❤❤ but there is an issue in mobile browsers which the website becomes unresponsive. How can i fix this problem?
WhatsApp Image 2021-11-01 at 1 21 42 PM

Time conversion optimizations.

Problems with convertTime():

  • Using Math.floor() is redundant, so ~~ will convert all values to the closest integer. see
  • Doing check with isNaN() is too late after doing calculations.
  • Writing minutes without padding is not correct.
  • Extra parentheses are not needed for minutes.

Source: https://github.com/oguz3/spotify-web-player/blob/master/src/functions/convertTime.js#L5

// Current function could be updated like this:
function convertTime(time) {
  if (isNaN(time)) {
    return '00:00';
  }

  let minutes = ~~(time % 3600 / 60);
  let seconds = ~~(time % 60);
  
  if (minutes < 10) {
    minutes = `0${minutes}`;
  }
  if (seconds < 10) {
    seconds = `0${seconds}`;
  }

  return `${minutes}:${seconds}`;
}

// Or it is possible to rewrite this function optimizing like this:
function convertTime2(time) {
  let ret = [0, 0];

  // Do calculations if have time (also !NaN = true).
  if (time) {
    ret = [
      ~~(time % 3600 / 60), // Minutes.
      ~~(time % 60)         // Seconds.
    ];
  }

  // Add item's paddings converting to string.
  ret = ret.map(re => `${re}`.padStart(2, '0'));

  return ret.join(':');
}

console.log(convertTime(60))  // 01:00
console.log(convertTime2(60)) // 01:00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.