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