diff --git a/src/index.jsx b/src/index.jsx
index 512d059..cc17ff4 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -1,5 +1,5 @@
import {BrowserRouter, Switch, Route} from "react-router-dom";
-import React, {Fragment} from 'react';
+import React from 'react';
import ReactDOM from 'react-dom';
import './styles/reset.css';
@@ -16,25 +16,28 @@ import {DiscView} from "./views/Disc";
import {ReleaseView} from "./views/Release";
import {Recomended} from "./views/Recomended";
import {SongView} from "./views/Song";
+import {Grid, RowCol} from './components/Grid';
const Main = (props) => {
const navigate = (query) => props.history.push(`/search?query=${query}`);
return (
-
- Busca la musica que te gusta!
-
-
-
+
+ Busca la musica que te gusta!
+
+
+
)
}
const NoRoute = (props) => {
return (
-
-
Esa pagina no existe
+
+ Esa pagina no existe
+
-
+
+
);
}
diff --git a/src/services/utils.js b/src/services/utils.js
index d9a5b1a..0ad803d 100644
--- a/src/services/utils.js
+++ b/src/services/utils.js
@@ -10,6 +10,10 @@ export const pad2 = (n) => {
}
export const toDuration = (miliseconds) => {
+ if(!miliseconds){
+ return '';
+ }
+
const base = Math.round(miliseconds / 1000);
const hours = Math.floor(base / 3600);
diff --git a/src/views/Disc.jsx b/src/views/Disc.jsx
index 000157d..5b654b7 100644
--- a/src/views/Disc.jsx
+++ b/src/views/Disc.jsx
@@ -29,11 +29,11 @@ const Versions = (props) => {
const items = versions.map((version) => {
const cover = ();
const subtitle = (
-
- {version.date}
- {version.country}
- {capitalize(version.disambiguation)}
-
+
+
{version.date}
+
{version.country}
+
{capitalize(version.disambiguation)}
+
);
return {
diff --git a/src/views/Release.jsx b/src/views/Release.jsx
index 6444830..59d0fce 100644
--- a/src/views/Release.jsx
+++ b/src/views/Release.jsx
@@ -1,4 +1,4 @@
-import React, {Fragment, useEffect, useState} from 'react';
+import React, {useEffect, useState} from 'react';
import {Link} from "react-router-dom";
import {capitalize, toDuration} from "../services/utils";
@@ -8,6 +8,7 @@ import {CoverArt} from "../components/CoverArt";
import {Entity} from "../components/Entity";
import {EntityList} from "../components/EntityList";
import {Comments} from "../components/Comments";
+import {Grid, RowCol} from "../components/Grid";
const Recordings = (props) => {
@@ -28,10 +29,12 @@ const Recordings = (props) => {
}
for(const recording of media.recordings) {
- const subtitle =
- {recording.length &&[{toDuration(recording.length)}]
}
- {recording.disambiguation && {capitalize(recording.disambiguation)}
}
-
+ const subtitle = (
+
+
[{toDuration(recording.length)}]
+
{capitalize(recording.disambiguation)}
+
+ );
group.items.push({
id: recording.id,
@@ -44,15 +47,17 @@ const Recordings = (props) => {
list.push(group);
}
- console.log(list)
+
mediasComponent =
}
return (
-
- Canciones
- {mediasComponent}
-
+
+
+ Canciones
+ {mediasComponent}
+
+
)
}
@@ -64,11 +69,10 @@ const Release = (props) => {
{`${release.artist.name} (${release.date})`}
)
- return }/>
- }else {
- return
+ } else {
+ return null;
}
}
@@ -89,13 +93,10 @@ export const ReleaseView = (props) => {
}, [mbid])
return (
-
-
- {release &&
-
- }
-
-
+
+
+
+
+
)
}
diff --git a/src/views/Search.jsx b/src/views/Search.jsx
index 6cfde70..2b71398 100644
--- a/src/views/Search.jsx
+++ b/src/views/Search.jsx
@@ -1,4 +1,4 @@
-import React, {Fragment, useEffect, useState} from "react";
+import React, {useEffect, useState} from "react";
import {Tab, TabList, TabPanel, Tabs} from "react-tabs";
import queryString from "query-string";
@@ -8,7 +8,7 @@ import {SearchBar} from "../components/SearchBar";
import {Paginate} from "../components/Paginate";
import {CoverArt} from "../components/CoverArt";
import {EntityList} from "../components/EntityList";
-import {Grid, Col, Row} from '../components/Grid';
+import {Grid, RowCol} from '../components/Grid';
const SearchSongs = (props) => {
@@ -67,12 +67,14 @@ const SearchSongs = (props) => {
}
return (
-
-
- {paginateComponent}
-
+
+
+
+
+ {paginateComponent}
+
)
}
@@ -104,37 +106,39 @@ const SearchDiscs = (props) => {
})
};
- let discsComponent = ;
+ let discsComponent = ();
if (discs) {
const items = discs.map((disc) => ({
- 'cover': ,
- 'link': `/disc/${disc.id}`,
- 'title': disc.title,
- 'subtitle': disc.artist.name
- }));
- const list = [{
- 'items': items
- }]
- discsComponent =
-}
+ 'cover': (),
+ 'link': `/disc/${disc.id}`,
+ 'title': disc.title,
+ 'subtitle': disc.artist.name
+ }));
+ const list = [{
+ 'items': items
+ }]
+ discsComponent =
+ }
-let paginateComponent;
-if (paginate) {
- const total = paginate.total;
- const currentPage = paginate.current_page;
- const pageLimit = paginate.per_page;
+ let paginateComponent;
+ if (paginate) {
+ const total = paginate.total;
+ const currentPage = paginate.current_page;
+ const pageLimit = paginate.per_page;
- paginateComponent =
-}
+ paginateComponent =
+ }
-return (
-
-
- {paginateComponent}
-
-)
+ return (
+
+
+
+
+ {paginateComponent}
+
+ )
}
const SearchArtists = (props) => {
@@ -190,18 +194,12 @@ const SearchArtists = (props) => {
return (
-
-
-
-
-
-
-
- {paginateContent}
-
-
+
+
+
+ {paginateContent}
)
}
@@ -277,17 +275,11 @@ export const Search = (props) => {
return (
- Búsqueda
-
-
-
-
-
-
-
- {content}
-
-
+ Búsqueda
+
+
+
+ {content}
);
}
diff --git a/src/views/Song.jsx b/src/views/Song.jsx
index ea11af8..aa9648d 100644
--- a/src/views/Song.jsx
+++ b/src/views/Song.jsx
@@ -1,17 +1,16 @@
-import React, {Fragment, useEffect, useState} from 'react';
+import React, {useEffect, useState} from 'react';
import {capitalize, toDuration} from "../services/utils";
import {getSong} from "../services/entity_service";
import {Entity} from "../components/Entity";
import {Comments} from "../components/Comments";
+import {Grid, RowCol} from "../components/Grid";
const Song = (props) => {
const song = props.song;
- if(!song) {
- return
- }
+ if(!song) { return null}
let subtitle = ''
@@ -38,12 +37,9 @@ export const SongView = (props) => {
}, [mbid]);
return (
-
-
- {song &&
-
- }
-
+
+
+
+
)
-
}