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
18 changes: 18 additions & 0 deletions 05-UI-ReactJS/spoti/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env
npm-debug.log*
yarn-debug.log*
yarn-error.log*

1,623 changes: 1,623 additions & 0 deletions 05-UI-ReactJS/spoti/README.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions 05-UI-ReactJS/spoti/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "spoti",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^3.3.7",
"react": "^15.5.4",
"react-bootstrap": "^0.31.0",
"react-dom": "^15.5.4",
"spotify-web-api-node": "^2.4.0"
},
"devDependencies": {
"react-scripts": "0.9.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
56 changes: 56 additions & 0 deletions 05-UI-ReactJS/spoti/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
<link rel="stylesheet" href="../src/index.css">
<title>Spotify App</title>
<script type="text/jsx" src='lib/react.js'></script>
<script type="text/jsx" src='lib/react-dom.js'></script>
</head>
<body>
<header class='container-fluid spoti' background-color="black">
<div class='row'>
<div class='col-md-12'>
<img src="spotilogo2.jpg" class="img-rounded center-block" alt="Logo Spotify" width="100" height="50">
</div>
</div>
</header>


<!-- HERE BEGINS THE REACT APP !-->

<div id="root"></div>

<!-- THATS IT!! !-->


<footer class= "navbar-fixed-bottom spoti">
<div class="container ">
<div class="row">
<div class="col-sm-6">
<ul>
<li>
<a href='#'>&copy; 2017 Bootcamp GLOBANT. All Rights Reserved.</a>
</li>
</ul>
</div>
<div class="col-sm-6">
<ul class="pull-right">
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
</div>
</div>
</footer>

<script type="text/jsx" src='build/Releases.js'></script>
<script type="text/jsx" src='build/Artists.js'></script>
<script type="text/jsx" src='build/Albums.js'></script>
<script type="text/jsx" src='build/Tracks.js'></script>
<script type="text/jsx" src='build/index.js'></script>
</body>
</html>
Binary file added 05-UI-ReactJS/spoti/public/spotilogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 05-UI-ReactJS/spoti/public/spotilogo2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions 05-UI-ReactJS/spoti/src/Albums.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';

export default class Albums extends React.Component {
constructor(){
super()
this.state= {
AlbumList: [],
AlbumShow: true
}
this.searchAlbum= this.searchAlbum.bind(this)
this.handleAlbum= this.handleAlbum.bind(this)
}

searchAlbum(){
var prom= this.props.id;
fetch('https://api.spotify.com/v1/artists/' + prom + '/albums')
.then((data) => {
return data.json();
})
.then((data) => {
this.state.AlbumList.push(data.items)
this.setState({
AlbumList: this.state.AlbumList[0],
AlbumShow: false
})
})
.catch((err) => {
console.log(err);
})
}

handleAlbum(e){
this.props.getAlbum(e.target);
}

render(){
return(
<div className='container fadein'>
{this.state.AlbumShow ? this.searchAlbum() : null}
<div className='row'>
<div className='col-md-12'>
<h2 className='text-center'>Albums</h2>
</div>
</div>
{this.state.AlbumList.map((data, number) =>{
return (
<div key={number} className='col-md-3'>
<a className='link'>
<img onClick={this.handleAlbum} id={data.id} className='img-thumbnail img-responsive imagen center-block' alt={data.name} src={data.images[0] ? data.images[0].url : 'https://cdn.shopify.com/s/files/1/0972/6232/files/no-image-placeholder.png'} />
<div className='caption'>
<p className='text-center link'>{data.name}</p>
</div>
</a>
</div>
)})}
</div>
)
}
}
53 changes: 53 additions & 0 deletions 05-UI-ReactJS/spoti/src/Artists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';

export default class Artists extends React.Component {
constructor(){
super()
this.state= {
ArtistList: [],
ArtistShow: true,
}
this.searchArtist= this.searchArtist.bind(this)
this.handleArtist= this.handleArtist.bind(this)
}

searchArtist(){
var prom= this.props.name;
fetch('https://api.spotify.com/v1/search?q=' + prom + '&type=artist')
.then((data) => {
return data.json();
})
.then((data) => {
this.state.ArtistList.push(data.artists.items)
this.setState({
ArtistList: this.state.ArtistList[0],
ArtistShow: false
})
})
.catch((err) => {
console.log(err);
})
}

handleArtist(e){
this.props.getArtist(e.target.id);
}
render(){
return(
<div className='container fadein'>
{this.state.ArtistShow ? this.searchArtist() : null}
{this.state.ArtistList.map((data, number) =>{
return (
<div key={number} className='col-md-3'>
<a className='link'>
<img onClick={this.handleArtist} id={data.id} className='img-thumbnail img-responsive imagen center-block' alt={data.name} src={data.images[0] ? data.images[0].url : 'https://cdn.shopify.com/s/files/1/0972/6232/files/no-image-placeholder.png'} />
<div className='caption'>
<p className='text-center link'>{data.name}</p>
</div>
</a>
</div>
)})}
</div>
)
}
}
61 changes: 61 additions & 0 deletions 05-UI-ReactJS/spoti/src/Releases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React from 'react';

//====================================================

// This class is still in progress. I need Authorization. Some ID and a redirect URI.

//====================================================


export default class Releases extends React.Component {

constructor(){
super()
this.state= {
ReleasesList: [],
ReleasesShow: true,
}
this.searchReleases= this.searchReleases.bind(this)
this.handleRelease= this.handleRelease.bind(this)
}

searchReleases(){
fetch('https://accounts.spotify.com/authorize/?client_id=fcecfc72172e4cd267473117a17cbd4d&response_type=code&redirect_uri=http://www.example.com/callback' )
.then((data) => {
return data.json();
})
.then((data) => {
this.state.ReleasesList.push(data)
console.log(this.state.ReleasesList);
/*this.setState({
ReleasesList: this.state.ReleasesList[0],
ReleasesShow: false
})*/
})
.catch((err) => {
console.log(err);
})
}

handleRelease(e){
this.props.getReleases(e.target.id);
}
render(){
return(
<div className='container fadein'>
{this.state.ReleasesShow ? this.searchReleases() : null}
{this.state.ReleasesList.map((data, number) =>{
return (
<div key={number} className='col-md-3'>
<a className='link'>
<img onClick={this.handleRelease} id={data.id} className='img-thumbnail img-responsive imagen center-block' alt={data.name} src={data.images[0] ? data.images[0].url : 'https://cdn.shopify.com/s/files/1/0972/6232/files/no-image-placeholder.png'} />
<div className='caption'>
<p className='text-center link'>{data.name}</p>
</div>
</a>
</div>
)})}
</div>
)
}
}
62 changes: 62 additions & 0 deletions 05-UI-ReactJS/spoti/src/Tracks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';

export default class Tracks extends React.Component {
constructor(){
super()
this.state= {
TrackList: [],
TrackShow: true
}
this.searchTrack= this.searchTrack.bind(this)
}

searchTrack(){
var prom= this.props.id;
fetch('https://api.spotify.com/v1/albums/' + prom + '/tracks')
.then((data) => {
return data.json();
})
.then((data) => {
this.state.TrackList.push(data.items)
this.setState({
TrackList: this.state.TrackList[0],
TrackShow: false
})
})
.catch((err) => {
console.log(err);
})
}

render(){
return(
<div className='container fadein'>
{this.state.TrackShow ? this.searchTrack() : null}
<div className='row'>
<div className='col-md-12'>
<h2 className='text-center'>Songs</h2>
<img className='img-responsive center-block'
alt={'k'}
src={this.props.url} />
</div>
</div>
<div className='row'>
{this.state.TrackList.map((data, number) =>{
return (
<ul key={number} className='col-md-12'>
<a href={data.external_urls.spotify} target="_blank" className='link'>

<li className='caption'>
<p className='link'>{data.name}</p>

</li>
</a>
<audio className='audio' controls="controls" src={data.preview_url}>
hol</audio>
</ul>
)})}
</div>
</div>
)
}
}
Loading