diff --git a/src/Pages/Album.jsx b/src/Pages/Album.jsx index 0e41e75..6eb1f27 100644 --- a/src/Pages/Album.jsx +++ b/src/Pages/Album.jsx @@ -11,14 +11,16 @@ import '../styles/PagesStyles/Album.scss' const Album = () => { const {myId} = useParams(); + // TODO: + // localStorage is great but is limited for handle the global state I recommend use React Context or Redux const albumLocalStorage = JSON.parse( localStorage.getItem("albums")) const album = albumLocalStorage.find(item => item.spt_album_id === myId); - + //---------------FETCH songs(call to API-songs)------------------------------------// const songs = useFetchmusic(myId) //---------------storing the songs in the local storage----------------------// localStorage.setItem( "SongsList", JSON.stringify( songs )) - + return(
@@ -26,7 +28,7 @@ const Album = () => {
-
+
) } diff --git a/src/Pages/AlbumLibrary.jsx b/src/Pages/AlbumLibrary.jsx index 9e2ba93..7159036 100644 --- a/src/Pages/AlbumLibrary.jsx +++ b/src/Pages/AlbumLibrary.jsx @@ -8,6 +8,8 @@ import MenuBar from '../components/MenuBar' import '../styles/PagesStyles/AlbumLibrary.scss' const AlbumLibrary = () => { + // TODO: + // localStorage is great but is limited for handle the global state I recommend use React Context or Redux const albumLocalStorage = JSON.parse( localStorage.getItem("albums")) return ( @@ -20,14 +22,14 @@ const AlbumLibrary = () => { albumLocalStorage.map((data) => ( )) - } + } ); } - + export default AlbumLibrary; - - + + diff --git a/src/Pages/AnimationLoader.jsx b/src/Pages/AnimationLoader.jsx index c86e5c3..bb971ad 100644 --- a/src/Pages/AnimationLoader.jsx +++ b/src/Pages/AnimationLoader.jsx @@ -6,10 +6,12 @@ import LogoAnimate from '../components/LogoAnimate' const AnimationLoader = () => { const history = useHistory(); + // TODO: + // Apply a setTimeout it's a bad practice setTimeout(() => { history.push("/signin"); }, 6000); - + return( ) diff --git a/src/Pages/ArtistSection.jsx b/src/Pages/ArtistSection.jsx index 1740b42..b08cf88 100644 --- a/src/Pages/ArtistSection.jsx +++ b/src/Pages/ArtistSection.jsx @@ -8,6 +8,9 @@ import '../styles/PagesStyles/ArtistSection.scss' const ArtistSection = () => { + + // TODO: + // localStorage is great but is limited for handle the global state I recommend use React Context or Redux const albumLocalStorage = JSON.parse( localStorage.getItem("albums")) return( @@ -20,7 +23,7 @@ const ArtistSection = () => { albumLocalStorage.map((data) => ( )) - } + } diff --git a/src/Pages/Home.jsx b/src/Pages/Home.jsx index 4a03866..11d97d0 100644 --- a/src/Pages/Home.jsx +++ b/src/Pages/Home.jsx @@ -14,15 +14,19 @@ import MenuBar from '../components/MenuBar' const Home = () => { //-----------------FETCH Albums (call toAPI)------------------------------// - const albumList = useFetchAlbum('https://mastersound-backend.azurewebsites.net/api/albums/new-releases') - + // TODO: + // The API URL should be a global variable + const albumList = useFetchAlbum('https://mastersound-backend.azurewebsites.net/api/albums/new-releases') + //-----------------storing the album in the local storage----------------------// - localStorage.setItem( "albums", JSON.stringify( albumList )) + // TODO: + // localStorage is great but is limited for handle the global state I recommend use React Context or Redux + localStorage.setItem( "albums", JSON.stringify( albumList )) useEffect(() => { window.scroll(0, 0) }, []); - + return(
@@ -34,7 +38,7 @@ const Home = () => { - +
) } diff --git a/src/Pages/Register.jsx b/src/Pages/Register.jsx index 83af546..6d2c683 100644 --- a/src/Pages/Register.jsx +++ b/src/Pages/Register.jsx @@ -18,19 +18,23 @@ export default function Register () { const handleSubmit = (e) => { e.preventDefault(); - + + // TODO: + // The API URL should be a global variable fetch('https://mastersound-backend.azurewebsites.net/api/auth/signup', { method: 'post', - mode: 'cors', + mode: 'cors', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ given_name, last_name, - email, + email, password, country_id, + // TODO: + // Why this image is set by default? image_url: 'https://i.scdn.co/image/23009960c33ef08d5973440cca17985a6c70a515', sex }) @@ -41,59 +45,59 @@ export default function Register () { console.log('Success:', response); history.push('/signin'); } - } + } )}; - + return(
Logo
setGiven_name(e.target.value)} - value={given_name} + value={given_name} /> setLast_name(e.target.value)} - value={last_name} + value={last_name} /> setEmail(e.target.value)} - value={email} + value={email} /> setPassword(e.target.value)} - value={password} - /> + value={password} + /> + +
diff --git a/src/Pages/SignIn.jsx b/src/Pages/SignIn.jsx index 25b358d..8f4148e 100644 --- a/src/Pages/SignIn.jsx +++ b/src/Pages/SignIn.jsx @@ -9,8 +9,12 @@ import { useFetchAlbum } from '../hooks/useFetchAlbum'; export default function SingIn() { //-----------------FETCH Albums (call toAPI)------------------------------// - const albumList = useFetchAlbum('https://mastersound-backend.azurewebsites.net/api/albums/new-releases') + // TODO: + // The API URL should be a global variable + const albumList = useFetchAlbum('https://mastersound-backend.azurewebsites.net/api/albums/new-releases') //-----------------storing the album in the local storage----------------------// + // TODO: + // localStorage is great but is limited for handle the global state I recommend use React Context or Redux localStorage.setItem( "albums", JSON.stringify( albumList )) const history = useHistory(); @@ -19,9 +23,11 @@ export default function SingIn() { const handleSubmit = (e) => { e.preventDefault(); + // TODO: + // The API URL should be a global variable fetch('https://mastersound-backend.azurewebsites.net/api/auth/login', { method: 'post', - mode: 'cors', + mode: 'cors', headers: { 'Content-Type': 'application/json' }, @@ -33,39 +39,39 @@ export default function SingIn() { console.log('Success:', response); history.push('/home'); } - } + } )}; return( - +
Logo
setEmail(e.target.value)} - value={email} + value={email} /> setPassword(e.target.value)} - value={password} - /> + value={password} + />

Mantener la sesion abierta

-
+ - +
Olvide mi contraseña Crear una cuenta diff --git a/src/components/ArtistImage.jsx b/src/components/ArtistImage.jsx index 5854f78..02286e8 100644 --- a/src/components/ArtistImage.jsx +++ b/src/components/ArtistImage.jsx @@ -4,9 +4,14 @@ import { Link } from 'react-router-dom'; import '../styles/componentsStyles/ArtistImage.scss' const ArtistImage = ({ data }) => { + // TODO: + // nameArtists is a array but in the HTML show as string const nameArtists = data.artists.map((data) => { return data.artist_name; }) + + // TODO: + // ArtistPortrait is a array but in the HTML show as string const ArtistPortrait = data.artists.map((data) => { return data.cover_image_url; }) diff --git a/src/components/BigSquareAlbum.jsx b/src/components/BigSquareAlbum.jsx index 0db602c..060024d 100644 --- a/src/components/BigSquareAlbum.jsx +++ b/src/components/BigSquareAlbum.jsx @@ -4,6 +4,8 @@ import { Link } from 'react-router-dom'; import '../styles/componentsStyles/BigSquareAlbum.scss' const BigSquareAlbum = ({ data }) => { + // TODO: + // nameArtists is a array but in the HTML show as string const nameArtists = data.artists.map((data) => { return data.artist_name; }) @@ -19,7 +21,7 @@ const BigSquareAlbum = ({ data }) => { - + ) } diff --git a/src/components/CircleAlbum.jsx b/src/components/CircleAlbum.jsx index 4cf9369..b898fd2 100644 --- a/src/components/CircleAlbum.jsx +++ b/src/components/CircleAlbum.jsx @@ -5,6 +5,8 @@ import '../styles/componentsStyles/CircleAlbum.scss' const CircleAlbum = ({data}) => { + // TODO: + // nameArtists is a array but in the HTML show as string const nameArtists = data.artists.map((data) => { return data.artist_name; }) diff --git a/src/components/CirculeAlbumGarden.jsx b/src/components/CirculeAlbumGarden.jsx index d053876..55dfffd 100644 --- a/src/components/CirculeAlbumGarden.jsx +++ b/src/components/CirculeAlbumGarden.jsx @@ -5,6 +5,8 @@ import '../styles/componentsStyles/CircleAlbumGarden.scss' const CircleAlbumGarden = ({ SectionName }) => { + // TODO: + // localStorage is great but is limited for handle the global state I recommend use React Context or Redux const albumLocalStorage = JSON.parse( localStorage.getItem("albums")) return( diff --git a/src/components/InfoAlbum.jsx b/src/components/InfoAlbum.jsx index 26737ff..1919961 100644 --- a/src/components/InfoAlbum.jsx +++ b/src/components/InfoAlbum.jsx @@ -9,13 +9,17 @@ const size = { height: 300, }; const view = 'list'; // or 'coverart' -const theme = 'black'; // or 'white' +const theme = 'black'; // or 'white' function InfoAlbum({ data }) { + // TODO: + // nameArtists is a array but in the HTML show as string const nameArtists = data.artists.map((data) => { return data.artist_name; }) //----------------------getting songs from local storage-----------------------// + // TODO: + // localStorage is great but is limited for handle the global state I recommend use React Context or Redux const musicLocalstorage = JSON.parse( localStorage.getItem("SongsList")) const idAlbum = data.spt_album_id; @@ -28,11 +32,11 @@ function InfoAlbum({ data }) {

{data.album_name}

{nameArtists}

{data.name}

- { musicLocalstorage.map( (item) => ( @@ -44,5 +48,5 @@ function InfoAlbum({ data }) { ); } - + export default InfoAlbum; \ No newline at end of file diff --git a/src/components/ListAlbum.jsx b/src/components/ListAlbum.jsx index c23d090..43e667a 100644 --- a/src/components/ListAlbum.jsx +++ b/src/components/ListAlbum.jsx @@ -4,7 +4,7 @@ import '../styles/componentsStyles/ListAlbum.scss'; import {setPlaying} from '../actions/songActions' //******** Icons **********// -import { FavouriteIcon, DownloadItemsIcon, ShareIcon, PlusIcon } +import { FavouriteIcon, DownloadItemsIcon, ShareIcon, PlusIcon } from '../components/Icons'; @@ -17,8 +17,9 @@ const ListAlbum = (props) => { return ( + {/* The Section with OnClick it's bad practice for accessibility */}
-

{props.data.order_number}

+

{props.data.order_number}

{}
@@ -39,5 +40,5 @@ const ListAlbum = (props) => { ); } - + export default ListAlbum; \ No newline at end of file diff --git a/src/components/ListTrack.jsx b/src/components/ListTrack.jsx index c8291ea..2dd60bd 100644 --- a/src/components/ListTrack.jsx +++ b/src/components/ListTrack.jsx @@ -2,7 +2,7 @@ import React, { Fragment } from 'react'; import '../styles/componentsStyles/ListTrack.scss'; //******** Icons **********// -import { FavouriteIcon, DownloadItemsIcon, ShareIcon } +import { FavouriteIcon, DownloadItemsIcon, ShareIcon } from './Icons'; const ListTrack = ({number, song, artist, reproductions, time}) => { @@ -10,6 +10,7 @@ const ListTrack = ({number, song, artist, reproductions, time}) => {

{number}

+ {/* In these buttons there are no actions */} @@ -28,5 +29,5 @@ const ListTrack = ({number, song, artist, reproductions, time}) => { ); } - + export default ListTrack; \ No newline at end of file diff --git a/src/components/Playbar.jsx b/src/components/Playbar.jsx index 32180cd..a410a2b 100644 --- a/src/components/Playbar.jsx +++ b/src/components/Playbar.jsx @@ -21,7 +21,7 @@ class Playbar extends React.Component { super(props); this.state = { play: false }; }; - + componentWillReceiveProps() { this.setState({ play: true }); }; @@ -41,7 +41,7 @@ class Playbar extends React.Component { componentWillUnmount() { this.audio.removeEventListener("timeupdate", () => {}); } - + positionHandle = (position) => { let timelineWidth = this.timeline.offsetWidth; let handleLeft = position - this.timeline.offsetLeft; @@ -55,12 +55,12 @@ class Playbar extends React.Component { this.handle.style.offsetWidth = timelineWidth + "px"; } }; - + mouseMove = (e) => { this.positionHandle(e.pageX); this.audio.currentTime = ((e.pageX - this.timeline.offsetLeft) / this.timeline.offsetWidth) * this.audio.duration; }; - + mouseUp = (e) => { window.removeEventListener('mousemove', this.mouseMove); window.removeEventListener('mouseup', this.mouseUp); @@ -121,19 +121,20 @@ class Playbar extends React.Component { } event={()=>{document.getElementById('navbar').style.height = "80%";}} classname='play-pause__btn'/> } classname='playbar__nav-btn' /> } classname='playbar__nav-btn' /> - +
) diff --git a/src/components/SquareAlbum.jsx b/src/components/SquareAlbum.jsx index f41ebf9..87e6d64 100644 --- a/src/components/SquareAlbum.jsx +++ b/src/components/SquareAlbum.jsx @@ -4,10 +4,13 @@ import { Link } from 'react-router-dom'; import '../styles/componentsStyles/SquareAlbum.scss' const SquareAlbum = ({data}) => { + + // TODO: + // nameArtists is a array but in the HTML show as string const nameArtists = data.artists.map((data) => { return data.artist_name; }) - + return (
diff --git a/src/components/SquareAlbumGarden.jsx b/src/components/SquareAlbumGarden.jsx index d838df6..b3445df 100644 --- a/src/components/SquareAlbumGarden.jsx +++ b/src/components/SquareAlbumGarden.jsx @@ -6,7 +6,9 @@ import '../styles/componentsStyles/SquareAlbumGarden.scss' const SquareAlbumGarden = ({ SectionName }) => { - + + // TODO: + // localStorage is great but is limited for handle the global state I recommend use React Context or Redux const albumLocalStorage = JSON.parse( localStorage.getItem("albums")) return( @@ -20,7 +22,7 @@ const SquareAlbumGarden = ({ SectionName }) => { )) } - +
) diff --git a/src/hooks/useFetchmusic.jsx b/src/hooks/useFetchmusic.jsx index fc6bca1..73d119d 100644 --- a/src/hooks/useFetchmusic.jsx +++ b/src/hooks/useFetchmusic.jsx @@ -5,6 +5,8 @@ export function useFetchmusic (spt_album_id) { const [music, setMusic] = useState([]); + // TODO: + // The API URL should be a global variable const URL = `https://mastersound-backend.azurewebsites.net/api/albums/${spt_album_id}/songs` async function fetchMusic () {