A front-end clone project of the Spotify Web Player. The project was created using React. This is my first big React.js project.
- React
- CSS
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
A front-end clone project of the Spotify Web Player. The project was created using React. This is my first big React.js project.
Problems with convertTime()
:
Math.floor()
is redundant, so ~~
will convert all values to the closest integer. seeisNaN()
is too late after doing calculations.minutes
without padding is not correct.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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.