-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
717 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"playlists": [ | ||
{ | ||
"id": 1, | ||
"title": "Saudade das antigas", | ||
"description": "Músicas antigas que vão te lembrar dos melhores momentos.", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/linkin_park.jpg" | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "In Too Deep", | ||
"description": "As melhores músicas do POP clássico em uma única playlist.", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/foo_fighters.jpg" | ||
}, | ||
{ | ||
"id": 3, | ||
"title": "Salad Days", | ||
"description": "Animar seu dia nunca foi tão fácil, ouça essas músicas e tenha um dia mais feliz!", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/alok.jpg" | ||
}, | ||
{ | ||
"id": 4, | ||
"title": "Só elas", | ||
"description": "As melhores cantoras POP reunidas em uma playlist pra você.", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/linkin_park.jpg" | ||
} | ||
], | ||
"songs": [ | ||
{ | ||
"id": 0, | ||
"title": "Papercut", | ||
"author": "Linkin Park", | ||
"album": "Hybrid Theory", | ||
"file": "https://s3-sa-east-1.amazonaws.com/gonative/1.mp3", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/linkin_park.jpg", | ||
"playlistId": 1 | ||
}, | ||
{ | ||
"id": 1, | ||
"title": "One Step Closer", | ||
"author": "Linkin Park", | ||
"album": "Hybrid Theory", | ||
"file": "https://s3-sa-east-1.amazonaws.com/gonative/2.mp3", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/linkin_park.jpg", | ||
"playlistId": 2 | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "With You", | ||
"author": "Linkin Park", | ||
"album": "Hybrid Theory", | ||
"file": "https://s3-sa-east-1.amazonaws.com/gonative/3.mp3", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/linkin_park.jpg", | ||
"playlistId": 3 | ||
}, | ||
{ | ||
"id": 3, | ||
"title": "Points of Authority", | ||
"author": "Linkin Park", | ||
"album": "Hybrid Theory", | ||
"file": "https://s3-sa-east-1.amazonaws.com/gonative/4.mp3", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/linkin_park.jpg", | ||
"playlistId": 4 | ||
}, | ||
{ | ||
"id": 4, | ||
"title": "Crawling", | ||
"author": "Linkin Park", | ||
"album": "Hybrid Theory", | ||
"file": "https://s3-sa-east-1.amazonaws.com/gonative/5.mp3", | ||
"thumbnail": "https://s3-sa-east-1.amazonaws.com/gonative/linkin_park.jpg", | ||
"playlistId": 4 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
import { Container, Spinner } from './styles' | ||
import LoadingIncon from '../../assets/images/loading.svg' | ||
|
||
const Loading = () => ( | ||
<Container> | ||
<Spinner src={LoadingIncon} alt="Loading" /> | ||
</Container> | ||
) | ||
|
||
export default Loading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import styled, { keyframes } from 'styled-components' | ||
|
||
const rotate360 = keyframes` | ||
from { | ||
transform: rotate(0deg) | ||
} | ||
to { | ||
transform: rotate(360deg) | ||
} | ||
` | ||
export const Container = styled.section` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
height: 100%; | ||
` | ||
export const Spinner = styled.img` | ||
animation: ${rotate360} 2s linear infinite; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,67 @@ | ||
import React from 'react' | ||
import React, { Component } from 'react' | ||
import { connect } from 'react-redux' | ||
import { bindActionCreators } from 'redux' | ||
|
||
import { Creators as PlaylistsAction } from '../../store/ducks/playlists' | ||
// Styles | ||
import { Container, Group, GroupTitle, NewPlayList, GroupItem } from './styles' | ||
|
||
// Images | ||
import add_playlist from '../../assets/images/add_playlist.svg' | ||
|
||
const Sidebar = () => ( | ||
<Container> | ||
<Group> | ||
<GroupItem>Navegar</GroupItem> | ||
<GroupItem>Radio</GroupItem> | ||
</Group> | ||
<Group> | ||
<GroupTitle>Sua biblioteca</GroupTitle> | ||
<GroupItem>Seu Daily Mix</GroupItem> | ||
<GroupItem>Tocados recentemente</GroupItem> | ||
<GroupItem>Músicas</GroupItem> | ||
<GroupItem>Albúns</GroupItem> | ||
<GroupItem>Artistas</GroupItem> | ||
<GroupItem>Estações</GroupItem> | ||
<GroupItem>Arquivos locais</GroupItem> | ||
<GroupItem>Podcasts</GroupItem> | ||
</Group> | ||
<Group> | ||
<GroupTitle>Playlists</GroupTitle> | ||
<GroupItem>AVE</GroupItem> | ||
<GroupItem>As mais braba</GroupItem> | ||
</Group> | ||
<NewPlayList> | ||
<img src={add_playlist} alt="Adicionar nova playlist" /> | ||
Nova playlist | ||
</NewPlayList> | ||
</Container> | ||
) | ||
|
||
export default Sidebar | ||
// Component | ||
import Loading from '../../components/Loading' | ||
|
||
class Sidebar extends Component { | ||
componentDidMount() { | ||
this.props.getPlaylistsRequest() | ||
} | ||
|
||
render() { | ||
return ( | ||
<Container> | ||
<Group> | ||
<GroupItem>Navegar</GroupItem> | ||
<GroupItem>Radio</GroupItem> | ||
</Group> | ||
<Group> | ||
<GroupTitle>Sua biblioteca</GroupTitle> | ||
<GroupItem>Seu Daily Mix</GroupItem> | ||
<GroupItem>Tocados recentemente</GroupItem> | ||
<GroupItem>Músicas</GroupItem> | ||
<GroupItem>Albúns</GroupItem> | ||
<GroupItem>Artistas</GroupItem> | ||
<GroupItem>Estações</GroupItem> | ||
<GroupItem>Arquivos locais</GroupItem> | ||
<GroupItem>Podcasts</GroupItem> | ||
</Group> | ||
<Group> | ||
<GroupTitle>Playlists</GroupTitle> | ||
{!!this.props.playlists.data.length ? ( | ||
this.props.playlists.data.map(playlist => ( | ||
<GroupItem key={playlist.id}>{playlist.title}</GroupItem> | ||
)) | ||
) : ( | ||
<Loading /> | ||
)} | ||
</Group> | ||
<NewPlayList> | ||
<img src={add_playlist} alt="Adicionar nova playlist" /> | ||
Nova playlist | ||
</NewPlayList> | ||
</Container> | ||
) | ||
} | ||
} | ||
|
||
const mapStateToProps = state => ({ | ||
playlists: state.playlists, | ||
}) | ||
|
||
const mapDispatchToProps = dispatch => | ||
bindActionCreators(PlaylistsAction, dispatch) | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(Sidebar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Reactotron from 'reactotron-react-js' | ||
import { reactotronRedux } from 'reactotron-redux' | ||
import sagaPlugin from 'reactotron-redux-saga' | ||
const reactotron = Reactotron.configure({ name: 'Spotify Fresattinho' }) | ||
.use(reactotronRedux()) | ||
.use(sagaPlugin()) | ||
.connect() | ||
|
||
reactotron.clear() | ||
console.tron = reactotron | ||
|
||
export default Reactotron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,49 @@ | ||
import React from 'react' | ||
import React, { Component } from 'react' | ||
import { Container, Title, List, Playlist } from './styles' | ||
import { connect } from 'react-redux' | ||
import { bindActionCreators } from 'redux' | ||
import Loading from '../../components/Loading' | ||
import { Creators as PlaylistActions } from '../../store/ducks/playlists' | ||
|
||
const Browse = () => ( | ||
<Container> | ||
<Title>Navegar</Title> | ||
class Browse extends Component { | ||
componentDidMount() { | ||
this.props.getPlaylistsRequest() | ||
} | ||
|
||
<List> | ||
<Playlist to="/playlists/1"> | ||
<img src="https://upload.wikimedia.org/wikipedia/pt/thumb/b/bf/Red_Hot_Chili_Peppers_-_Blood_Sugar_Sex_Magik.jpg/220px-Red_Hot_Chili_Peppers_-_Blood_Sugar_Sex_Magik.jpg" /> | ||
<strong>Red hot chili peppers</strong> | ||
<p>Lorem ipsum</p> | ||
</Playlist> | ||
</List> | ||
</Container> | ||
) | ||
render() { | ||
const { playlists } = this.props | ||
return ( | ||
<Container> | ||
<Title>Navegar</Title> | ||
{!!playlists.data.length ? ( | ||
<List> | ||
{playlists.data.map(playlist => ( | ||
<Playlist | ||
key={playlist.id} | ||
to={`/playlists/${playlist.id}`} | ||
> | ||
<img src={playlist.thumbnail} alt={playlist.title} /> | ||
<strong>{playlist.title}</strong> | ||
<p>{playlist.description}</p> | ||
</Playlist> | ||
))} | ||
</List> | ||
) : ( | ||
<Loading /> | ||
)} | ||
</Container> | ||
) | ||
} | ||
} | ||
|
||
export default Browse | ||
const mapStateToProps = state => ({ | ||
playlists: state.playlists, | ||
}) | ||
|
||
const mapDispatchToProps = dispatch => | ||
bindActionCreators(PlaylistActions, dispatch) | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(Browse) |
Oops, something went wrong.