|
@@ -50,7 +50,7 @@ const TrackConnect = connect(
|
|
|
)(Track)
|
|
|
|
|
|
const SortableItem = sortableElement(TrackConnect);
|
|
|
-const SortableContainer = sortableContainer(({ children }) => { return <ul>{children}</ul> });
|
|
|
+const SortableContainer = sortableContainer(({ children }) => <ul>{children}</ul> );
|
|
|
|
|
|
const Playlist = ({ player, playlist, setPlaylist, updPlaylist, setIndex }) => {
|
|
|
let [_tracks, setTracks] = useState()
|
|
@@ -73,7 +73,7 @@ const Playlist = ({ player, playlist, setPlaylist, updPlaylist, setIndex }) => {
|
|
|
<>
|
|
|
<h2 className='highlightGreen'>{playlist[0]?.name || 'Playlist'}</h2>
|
|
|
<SortableContainer onSortEnd={onSortEnd}>
|
|
|
- {(_tracks || []).map((track, index) => <SortableItem index={index} track={track} playlist={playlist[0]} />)}
|
|
|
+ { (_tracks || []).map((track, index) => <SortableItem key={track._id} index={index} track={track} playlist={playlist[0]} />) }
|
|
|
</SortableContainer>
|
|
|
</>
|
|
|
)
|
|
@@ -98,7 +98,7 @@ const PlaylistTrackDropzone = ({ playlist, uploadTrack }) => {
|
|
|
}, [playlist])
|
|
|
|
|
|
const onDrop = useCallback(acceptedFiles => {
|
|
|
- uploadTrack(acceptedFiles[0], playlistId)
|
|
|
+ if(acceptedFiles[0].type === 'audio/mpeg') uploadTrack(acceptedFiles[0], playlistId)
|
|
|
}, [uploadTrack, playlistId])
|
|
|
const { getRootProps, isDragActive } = useDropzone({ onDrop })
|
|
|
return (
|
|
@@ -128,7 +128,7 @@ const UserTracks = ({ user, tracks }) => {
|
|
|
return (
|
|
|
<>
|
|
|
<h2 className='highlightYellow'>{user.login || 'My'} uploaded tracks:</h2>
|
|
|
- <ul>{(tracksRev || []).map(track => <TrackConnect track={track} playlist={tracksRev} />)}</ul>
|
|
|
+ <ul>{(tracksRev || []).map(track => <TrackConnect key={track._id} track={track} playlist={tracksRev} />)}</ul>
|
|
|
</>
|
|
|
)
|
|
|
}
|
|
@@ -140,8 +140,9 @@ const UserTracksConnect = connect(state => ({
|
|
|
|
|
|
const UserTracksDropzone = ({ onLoad }) => {
|
|
|
const onDrop = useCallback(acceptedFiles => {
|
|
|
- onLoad(acceptedFiles[0])
|
|
|
+ if(acceptedFiles[0].type === 'audio/mpeg') onLoad(acceptedFiles[0])
|
|
|
}, [onLoad])
|
|
|
+
|
|
|
const { getRootProps, isDragActive } = useDropzone({ onDrop })
|
|
|
return (
|
|
|
<div
|