Recomended tenia mala la indentacion, ya no

Era por que el editor no sabe que hacer con jsx dentro de un objeto
This commit is contained in:
Daniel Cortes
2020-06-19 17:32:31 -04:00
parent a8932f2c74
commit 94734a1dab

View File

@@ -5,7 +5,7 @@ import {getArtist, getDisc, getSong} from '../services/entity_service';
import {EntityList} from '../components/EntityList'; import {EntityList} from '../components/EntityList';
import {CoverArt} from '../components/CoverArt'; import {CoverArt} from '../components/CoverArt';
import {Grid, Row, Col} from '../components/Grid'; import {Grid, Row, Col, RowCol} from '../components/Grid';
const PopularArtists = () => { const PopularArtists = () => {
const artistIDs = ['fa3b825f-7c85-4377-b393-d28a2016e293', 'b2d122f9-eadb-4930-a196-8f221eeb0c66', const artistIDs = ['fa3b825f-7c85-4377-b393-d28a2016e293', 'b2d122f9-eadb-4930-a196-8f221eeb0c66',
@@ -19,19 +19,20 @@ const PopularArtists = () => {
getArtist(artistIDs[3])]) getArtist(artistIDs[3])])
.then(artists => setArtists(artists)); .then(artists => setArtists(artists));
return <EntityList placeholder={true} size={4}/> return <EntityList placeholder={true} size={4}/>
}else { } else {
const items = artists.map((artist) => ({ const items = artists.map((artist) => {
'cover': null, const widget = (<span><FaEye class='icon'/> {Math.floor(Math.random() * 1000)}</span>);
'link': `/artist/${artist.id}`, return {
'title': artist.name, 'cover': null,
'subtitle': [artist.type, artist.country].filter(Boolean).join(' - '), 'link': `/artist/${artist.id}`,
'widget': <span><FaEye class='icon'/> {Math.floor(Math.random() * 1000)}</span> 'title': artist.name,
})); 'subtitle': [artist.type, artist.country].filter(Boolean).join(' - '),
const list = [{ 'widget': widget
'items': items }
}]; });
return <EntityList list={list}/> const list = [{'items': items}];
} return <EntityList list={list}/>
}
} }
const PopularDiscs = () => { const PopularDiscs = () => {
@@ -47,18 +48,22 @@ const PopularDiscs = () => {
.then(discs => setDiscs(discs)); .then(discs => setDiscs(discs));
return <EntityList placeholder={true} size={4}/> return <EntityList placeholder={true} size={4}/>
}else { }else {
const items = discs.map((disc) => ({ const items = discs.map((disc) => {
'cover': <CoverArt disc={disc} size={2}/>, const cover = (<CoverArt disc={disc} size={2}/>);
'link': `/disc/${disc.id}`, const widget = (<span><FaEye class='icon'/> {Math.floor(Math.random() * 1000)}</span>)
'title': disc.title, return {
'subtitle': disc.artist.name, 'cover': cover,
'widget': <span><FaEye class='icon'/> {Math.floor(Math.random() * 1000)}</span> 'link': `/disc/${disc.id}`,
})); 'title': disc.title,
const list = [{ 'subtitle': disc.artist.name,
'items': items 'widget': widget
}]; }
return <EntityList list={list}/> });
} const list = [{
'items': items
}];
return <EntityList list={list}/>
}
} }
const PopularSongs = () => { const PopularSongs = () => {
@@ -74,18 +79,21 @@ const PopularSongs = () => {
.then(songs => setSongs(songs)); .then(songs => setSongs(songs));
return <EntityList placeholder={true} size={4}/> return <EntityList placeholder={true} size={4}/>
}else { }else {
const items = songs.map((song) => ({ const items = songs.map((song) => {
'cover': null, const widget = (<span><FaEye class='icon'/> {Math.floor(Math.random() * 1000)}</span>);
'link': `/song/${song.id}`, return {
'title': song.title, 'cover': null,
'subtitle': song.artist.name, 'link': `/song/${song.id}`,
'widget': <span><FaEye class='icon'/> {Math.floor(Math.random() * 1000)}</span> 'title': song.title,
})); 'subtitle': song.artist.name,
const list = [{ 'widget': widget
'items': items }
}]; });
return <EntityList list={list}/> const list = [{
} 'items': items
}];
return <EntityList list={list}/>
}
} }
export const Recomended = () => { export const Recomended = () => {
@@ -103,12 +111,10 @@ export const Recomended = () => {
<PopularSongs/> <PopularSongs/>
</Col> </Col>
</Row> </Row>
<Row> <RowCol>
<Col> <h3>Discos Populares</h3>
<h3>Discos Populares</h3> <PopularDiscs/>
<PopularDiscs/> </RowCol>
</Col>
</Row>
</Grid> </Grid>
) )
} }