Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/components/ArtWork/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ import PropTypes from 'prop-types';
import './ArtWork.css';

const ArtWork = (albumArtwork) => (
<div className='album-artwork-container'>
<img alt="artwork" className='album-artwork' src={albumArtwork.albumImage} />
<div className="album-artwork-container">
<img
alt="artwork"
className="album-artwork"
src={
albumArtwork.albumImage
? albumArtwork.albumImage
: 'https://via.placeholder.com/500/000000/FFFFFF?text=Not+Playing'
}
/>
</div>
);


ArtWork.propTypes = {
albumArtwork: PropTypes.string
albumArtwork: PropTypes.string,
};

export default ArtWork;
15 changes: 9 additions & 6 deletions src/components/UserDetails/component.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import React from "react";
import PropTypes from "prop-types";
import "./UserDetails.css";
import React from 'react';
import PropTypes from 'prop-types';
import './UserDetails.css';

const UserDetails = ({ userImage, displayName }) => (
<div className="user-details-container">
<img alt="user" className="user-image" src={userImage} />
<img
alt="user"
className="user-image"
src={userImage ? userImage : 'https://via.placeholder.com/100'}
/>
<p className="user-name">{displayName}</p>
</div>
);


UserDetails.propTypes = {
userImage: PropTypes.string,
displayName: PropTypes.string
displayName: PropTypes.string,
};

export default UserDetails;
16 changes: 8 additions & 8 deletions src/components/UserPlaylists/component.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import "./UserPlaylists.css";
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './UserPlaylists.css';

class UserPlaylists extends Component {
componentWillReceiveProps(nextProps) {
if (nextProps.userId !== "" && nextProps.token !== "") {
if (nextProps.userId !== '' && nextProps.token !== '') {
this.props.fetchPlaylistsMenu(nextProps.userId, nextProps.token);
}
}

renderPlaylists() {
return this.props.playlistMenu.map(playlist => {
return this.props.playlistMenu.map((playlist) => {

Choose a reason for hiding this comment

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

Better to check if the array will be present or not.
return this.props.playlistMenu && this.props.playlistMenu.map((playlist) => {

const getPlaylistSongs = () => {
this.props.fetchPlaylistSongs(
playlist.owner.id,
Expand All @@ -25,8 +25,8 @@ class UserPlaylists extends Component {
onClick={getPlaylistSongs}
className={
this.props.title === playlist.name
? "active side-menu-item"
: "side-menu-item"
? 'active side-menu-item'
: 'side-menu-item'
}
key={playlist.id}
>
Expand All @@ -53,7 +53,7 @@ UserPlaylists.propTypes = {
playlistMenu: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
fetchPlaylistsMenu: PropTypes.func,
fetchPlaylistSongs: PropTypes.func,
updateHeaderTitle: PropTypes.func
updateHeaderTitle: PropTypes.func,
};

export default UserPlaylists;