Skip to content

Commit

Permalink
Rendering photo url
Browse files Browse the repository at this point in the history
  • Loading branch information
avvazana committed Nov 18, 2018
1 parent 36e0d32 commit 0270ca0
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 51 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ gem 'pry-rails'
gem 'jquery-rails'
gem 'bcrypt'
gem "aws-sdk-s3", require: false
gem 'rspotify'
gem 'ez_download'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
Expand Down
40 changes: 40 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,20 @@ GEM
concurrent-ruby (1.1.3)
crass (1.0.4)
debug_inspector (0.0.3)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
erubi (1.7.1)
execjs (2.7.0)
ez_download (0.2.0)
rails (~> 5.2.0)
faraday (0.15.3)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
globalid (0.4.1)
activesupport (>= 4.2.0)
hashie (3.5.7)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.1.1)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
Expand All @@ -117,6 +126,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jwt (2.1.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
Expand All @@ -129,15 +139,33 @@ GEM
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mimemagic (0.3.2)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3)
msgpack (1.2.4)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
netrc (0.11.0)
nio4r (2.3.1)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
oauth2 (1.4.1)
faraday (>= 0.8, < 0.16.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.8.1)
hashie (>= 3.4.6, < 3.6.0)
rack (>= 1.6.2, < 3)
omniauth-oauth2 (1.3.1)
oauth2 (~> 1.0)
omniauth (~> 1.2)
pg (1.1.3)
pry (0.12.2)
coderay (~> 1.1.0)
Expand Down Expand Up @@ -183,6 +211,13 @@ GEM
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
regexp_parser (1.3.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rspotify (2.3.1)
omniauth-oauth2 (~> 1.3.1)
rest-client (~> 2.0.2)
ruby_dep (1.5.0)
rubyzip (1.2.2)
sass (3.7.2)
Expand Down Expand Up @@ -218,6 +253,9 @@ GEM
thread_safe (~> 0.1)
uglifier (4.1.19)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
Expand All @@ -243,6 +281,7 @@ DEPENDENCIES
capybara (>= 2.15)
chromedriver-helper
coffee-rails (~> 4.2)
ez_download
jbuilder (~> 2.5)
jquery-rails
listen (>= 3.0.5, < 3.2)
Expand All @@ -251,6 +290,7 @@ DEPENDENCIES
puma (~> 3.11)
rails (~> 5.2.1)
rails_12factor
rspotify
sass-rails (~> 5.0)
selenium-webdriver
spring
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Spoofify
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2

RSpotify.authenticate("306bb9a7577044d6b9e88c51de20bbe8", "ecc913d5c9574691be14548787e9b29c")
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
Expand Down
11 changes: 11 additions & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)

Album.destroy_all
Song.destroy_all
Artist.destroy_all
User.destroy_all
Playlist.destroy_all

def create_album(params, filename)
album = Album.new(params)
file = EzDownload.open("")
end
10 changes: 6 additions & 4 deletions frontend/components/main/browse_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import { fetchPlaylists } from '../../actions/playlist_actions';
import { selectAllPlaylists } from '../../reducers/selectors';
import MainContent from './main_content'

const mapStateToProps = state => ({
playlists: selectAllPlaylists(state),
path: "browse"
});
const mapStateToProps = state => {
return {
playlists: selectAllPlaylists(state),
navpath: "browse"
};
};

const mapDispatchToProps = dispatch => {
return {
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/main/collection_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import MainContent from './main_content'

const mapStateToProps = state => ({
playlists: selectAllPlaylists(state),
path: "collection"
navpath: "collection"
});

const mapDispatchToProps = dispatch => {
Expand Down
48 changes: 10 additions & 38 deletions frontend/components/main/main_content.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import PlaylistIndexItem from './playlist_index_item';
// import PlaylistIndex from './playlist_index_item';
import { NavLink, Redirect } from 'react-router-dom';
import NavBar from './navbar';

class MainContent extends React.Component {

Expand All @@ -10,6 +12,7 @@ class MainContent extends React.Component {
playlists: []
};
this.fetchPlaylists = props.fetchPlaylists.bind(this);
this.logout = props.logout.bind(this);
}

componentDidMount() {
Expand All @@ -21,47 +24,16 @@ class MainContent extends React.Component {

return (
<div className="main-container">
<nav className="nav-bar">
<div className="logo">
<img src={window.whiteLogoURL}></img>
<h1>Spoofify</h1>
</div>

<div className="icon-holder">
<NavLink activeClassName="active-link" exact to ="/search/playlists">
<span>
<img src={window.searchIcon}></img>
<h2>Search</h2>
</span>
</NavLink>

<br></br>

<NavLink activeClassName="active-link" exact to ="/browse/playlists">
<span>
<img src={window.homeIcon}></img>
<h2>Home</h2>
</span>
</NavLink>

<br></br>

<NavLink activeClassName="active-link" exact to ="/collection/playlists">
<span>
<img src={window.libraryIcon}></img>
<h2>Your Library</h2>
</span>
</NavLink>
</div>

<div>
<button className="logout" onClick={()=>this.props.logout()}>Logout</button>
</div>
</nav>
<Redirect to={`/${this.props.path}/playlists`} />
<NavBar logout={this.logout}/>
<ul> Image Goes Here:
{playlists.map(playlist => <PlaylistIndexItem key={playlist.id} playlist={playlist} />)}
</ul>
<Redirect to={`/${this.props.navpath}/playlists`} />
</div>
);
}
}

export default MainContent;

// <PlaylistIndex playlists={playlists}/>
44 changes: 44 additions & 0 deletions frontend/components/main/navbar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import { Link, NavLink, Redirect } from 'react-router-dom';

export default (props) => {
return (
<nav className="nav-bar">
<div className="logo">
<img src={window.whiteLogoURL}></img>
<h1>Spoofify</h1>
</div>

<div className="icon-holder">
<NavLink activeClassName="active-link" exact to ="/search/playlists">
<span>
<img src={window.searchIcon}></img>
<h2>Search</h2>
</span>
</NavLink>

<br></br>

<NavLink activeClassName="active-link" exact to ="/browse/playlists">
<span>
<img src={window.homeIcon}></img>
<h2>Home</h2>
</span>
</NavLink>

<br></br>

<NavLink activeClassName="active-link" exact to ="/collection/playlists">
<span>
<img src={window.libraryIcon}></img>
<h2>Your Library</h2>
</span>
</NavLink>
</div>

<div>
<button className="logout" onClick={()=>props.logout()}>Logout</button>
</div>
</nav>
);
};
15 changes: 15 additions & 0 deletions frontend/components/main/playlist_index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// import React from 'react';
//
// class PlaylistIndex extends React.Component {
//
// render(){
// const playlists = this.props.map(playlist => {
// <PlaylistIndexItem playlist={playlist}/>
// });
// <ul>
// {playlists}
// </ul>
// }
// }
//
// export default PlaylistIndex
13 changes: 7 additions & 6 deletions frontend/components/main/playlist_index_item.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';

const PlaylistIndexItem = ({ playlist }) => (
const PlaylistIndexItem = ({ playlist }) => (
<li className="playlist-index-item">
<audio controls>
<source src={playlist.trackUrl} type="audio/mpeg"></source>
</audio>
<img src={playlist.photoUrl}></img>
</li>
);
export default PlaylistIndexItem;


export default PlaylistIndexItem;
// <audio controls>
// <source src={playlist.trackUrl} type="audio/mpeg"></source>
// </audio>
4 changes: 3 additions & 1 deletion frontend/components/main/search_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import MainContent from './main_content'

const mapStateToProps = state => ({
playlists: selectAllPlaylists(state),
path: "search"
navpath: "search",
});

const mapDispatchToProps = dispatch => {
Expand All @@ -19,3 +19,5 @@ const mapDispatchToProps = dispatch => {
};

export default connect(mapStateToProps, mapDispatchToProps)(MainContent);

// pagepath: props.pagepath || "playlists"

0 comments on commit 0270ca0

Please sign in to comment.