|
@@ -1,36 +1,34 @@
|
|
import * as action from '../../actions'
|
|
import * as action from '../../actions'
|
|
|
|
+import plugPic from '../../assets/default.png'
|
|
|
|
|
|
import { useState, useEffect, useCallback } from 'react';
|
|
import { useState, useEffect, useCallback } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { connect } from 'react-redux';
|
|
import { Link } from 'react-router-dom';
|
|
import { Link } from 'react-router-dom';
|
|
-import { history, backendURL } from '../../App';
|
|
|
|
|
|
+import { backendURL } from '../../App';
|
|
import { useDropzone } from 'react-dropzone'
|
|
import { useDropzone } from 'react-dropzone'
|
|
|
|
+import { faPlus, faBan, faSignOutAlt, faUpload} from "@fortawesome/free-solid-svg-icons";
|
|
|
|
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
|
|
const LogoutBtn = ({ onLogout }) =>
|
|
const LogoutBtn = ({ onLogout }) =>
|
|
- <div
|
|
|
|
- style={{ border: '1px solid black', backgroundColor: 'red', color: 'white' }}
|
|
|
|
- onClick={() => { onLogout(); history.push('/login') }}
|
|
|
|
- >log-out[X]</div>
|
|
|
|
|
|
+ <Link
|
|
|
|
+ to='/login'
|
|
|
|
+ className='sidebar__link highlightRed'
|
|
|
|
+ onClick={() => onLogout()}
|
|
|
|
+ >LOG-OUT <FontAwesomeIcon icon={faSignOutAlt}/></Link>
|
|
|
|
|
|
-export const LogoutBtnConnect = connect(null, { onLogout: action.actionAuthLogout })(LogoutBtn)
|
|
|
|
|
|
+//export const LogoutBtnConnect = connect(null, { onLogout: action.actionAuthLogout })(LogoutBtn)
|
|
|
|
+export const LogoutBtnConnect = connect(null, { onLogout: action.actionFullLogout })(LogoutBtn)
|
|
|
|
|
|
const ProfileWindow = ({ user }) => {
|
|
const ProfileWindow = ({ user }) => {
|
|
let [userInfo, setUserInfo] = useState(user.payload)
|
|
let [userInfo, setUserInfo] = useState(user.payload)
|
|
-
|
|
|
|
- useEffect(() => {
|
|
|
|
- setUserInfo(user.payload)
|
|
|
|
- }, [user, userInfo])
|
|
|
|
|
|
+ useEffect(() => setUserInfo(user.payload), [user, userInfo])
|
|
|
|
|
|
return (
|
|
return (
|
|
- <section>
|
|
|
|
|
|
+ <section >
|
|
<h3>{userInfo?.login || 'user'}</h3>
|
|
<h3>{userInfo?.login || 'user'}</h3>
|
|
- <img
|
|
|
|
- width={150}
|
|
|
|
- height={'auto'}
|
|
|
|
- style={{ border: '1px solid black', display: 'block', margin: '5% auto', marginBottom: '2px' }}
|
|
|
|
- src={userInfo?.avatar?.url ? backendURL + '/' + userInfo?.avatar?.url : ''}
|
|
|
|
- alt='avatar'
|
|
|
|
- />
|
|
|
|
|
|
+ {userInfo?.avatar?.url ?
|
|
|
|
+ <img src={backendURL + '/' + userInfo?.avatar?.url} alt='avatar'/> :
|
|
|
|
+ <img src={plugPic} alt='avatar' />}
|
|
</section>
|
|
</section>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
@@ -43,10 +41,13 @@ const ProfileWindowDropzone = ({ onLoad }) => {
|
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop })
|
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop })
|
|
|
|
|
|
return (
|
|
return (
|
|
- <div {...getRootProps()} style={isDragActive ? { border: '1px solid mediumseagreen' } : { border: '1px solid black' }}>
|
|
|
|
|
|
+ <div {...getRootProps()}
|
|
|
|
+ className='sidebar__profile'
|
|
|
|
+ style={isDragActive ? { backgroundColor: '#0e6147' } : { backgroundColor: 'transparent' }}
|
|
|
|
+ >
|
|
<input {...getInputProps()} />
|
|
<input {...getInputProps()} />
|
|
<ProfileWindowConnect />
|
|
<ProfileWindowConnect />
|
|
- {isDragActive ? <small>drag here...</small> : <small>change avatar</small>}
|
|
|
|
|
|
+ <small className='lightText'>{isDragActive ? '...drop here' : 'change avatar'}</small>
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
@@ -59,18 +60,7 @@ const UserTracksBtn = ({ userId }) => {
|
|
setId(userId)
|
|
setId(userId)
|
|
}, [userId])
|
|
}, [userId])
|
|
|
|
|
|
- return (
|
|
|
|
- <Link
|
|
|
|
- to={`/player/tracks/:${_id}`}
|
|
|
|
- style={{
|
|
|
|
- display: 'block',
|
|
|
|
- backgroundColor: 'purple',
|
|
|
|
- color: 'white',
|
|
|
|
- margin: '5px',
|
|
|
|
- padding: '5px'
|
|
|
|
- }}
|
|
|
|
- >MY UPLOADS</Link>
|
|
|
|
- )
|
|
|
|
|
|
+ return (<Link to={`/player/tracks/:${_id}`} className='sidebar__link highlightYellow'>UPLOADS <FontAwesomeIcon icon={faUpload}/></Link>)
|
|
}
|
|
}
|
|
export const UserTracksBtnConnect = connect(state => ({ userId: state.promise.userData?.payload?._id || '' }))(UserTracksBtn)
|
|
export const UserTracksBtnConnect = connect(state => ({ userId: state.promise.userData?.payload?._id || '' }))(UserTracksBtn)
|
|
|
|
|
|
@@ -82,28 +72,28 @@ const PlaylistAdd = ({ addPlaylist }) => {
|
|
{
|
|
{
|
|
!clicked ?
|
|
!clicked ?
|
|
<button
|
|
<button
|
|
- style={{ border: '1px solid black', backgroundColor: 'mediumseagreen', width: '95%', padding: '5px', margin: '5px' }}
|
|
|
|
|
|
+ className='sidebar__button highlightPaleGreen'
|
|
onClick={() => setClicked(true)}
|
|
onClick={() => setClicked(true)}
|
|
>NEW PLAYLIST</button>
|
|
>NEW PLAYLIST</button>
|
|
:
|
|
:
|
|
- <div style={{ width: '95%', margin: '0 auto' }}>
|
|
|
|
|
|
+ <div className='sidebar__addpanel'>
|
|
<input
|
|
<input
|
|
- style={{ width: '72%', padding: '5px' }}
|
|
|
|
- placeholder='Playlist name'
|
|
|
|
|
|
+ placeholder='NEW PLATLIST NAME'
|
|
value={name}
|
|
value={name}
|
|
onChange={(e) => setName(e.target.value)}
|
|
onChange={(e) => setName(e.target.value)}
|
|
/>
|
|
/>
|
|
|
|
+ <div className='sidebar__addpanel btnWrapper'>
|
|
|
|
+ <button
|
|
|
|
+ disabled={!name}
|
|
|
|
+ className='highlightGreen'
|
|
|
|
+ onClick={() => { addPlaylist(name); setClicked(false); setName(''); }}
|
|
|
|
+ ><FontAwesomeIcon icon={faPlus} /></button>
|
|
|
|
|
|
- <button
|
|
|
|
- disabled={!name}
|
|
|
|
- style={{ padding: '5px', backgroundColor: 'mediumseagreen' }}
|
|
|
|
- onClick={() => { addPlaylist(name); setClicked(false); setName(''); }}
|
|
|
|
- >+</button>
|
|
|
|
-
|
|
|
|
- <button
|
|
|
|
- style={{ padding: '5px', backgroundColor: 'red' }}
|
|
|
|
- onClick={() => { setClicked(false); setName('') }}
|
|
|
|
- >X</button>
|
|
|
|
|
|
+ <button
|
|
|
|
+ className='highlightRed'
|
|
|
|
+ onClick={() => { setClicked(false); setName('') }}
|
|
|
|
+ ><FontAwesomeIcon icon={faBan} /></button>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
@@ -111,16 +101,13 @@ const PlaylistAdd = ({ addPlaylist }) => {
|
|
}
|
|
}
|
|
export const PlaylistAddConnect = connect(null, { addPlaylist: action.actionAddPlaylist })(PlaylistAdd)
|
|
export const PlaylistAddConnect = connect(null, { addPlaylist: action.actionAddPlaylist })(PlaylistAdd)
|
|
|
|
|
|
-const Playlists = ({ playlists }) => {
|
|
|
|
|
|
+const Playlists = ( { playlists }) => {
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
{
|
|
{
|
|
playlists?.payload ? playlists.payload.map(item => {
|
|
playlists?.payload ? playlists.payload.map(item => {
|
|
return (
|
|
return (
|
|
- <Link
|
|
|
|
- style={{ display: 'block', backgroundColor:'darkcyan', color: 'cyan', margin: '5px', padding: '5px' }}
|
|
|
|
- to={`/player/playlist/:${item._id}`}
|
|
|
|
- >{item.name}</Link>
|
|
|
|
|
|
+ <Link className='sidebar__link' to={`/player/playlist/:${item._id}`}>{item.name}</Link>
|
|
)
|
|
)
|
|
}).reverse() : ''
|
|
}).reverse() : ''
|
|
}
|
|
}
|