Skip to content

Commit

Permalink
minor code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobcolyvan committed Jan 4, 2021
1 parent 12633aa commit 912a330
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 76 deletions.
2 changes: 1 addition & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ul {

.list-bottom {
width: 100%;

}

.drawer-list {
Expand Down
5 changes: 3 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import TopArtists from './pages/TopArtists';
import TopTracks from './pages/TopTracks';
import Playlists from './pages/Playlists';
import NavBar from './components/NavBar';

import { useTheme } from '@material-ui/core/styles';
import { Container, useMediaQuery} from '@material-ui/core';
import Paper from '@material-ui/core/Paper';
Expand All @@ -30,8 +31,8 @@ const App = () => {
<div>
<Router>
<UserContext.Provider value={{ token, setToken, isMobile, playlist, setPlaylist }}>
<NavBar
currentPage={currentPage}
<NavBar
currentPage={currentPage}
setCurrentPage={setCurrentPage}
/>
<Container maxWidth='md' id='main'>
Expand Down
65 changes: 1 addition & 64 deletions src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,67 +102,4 @@ const NavBar = ({ currentPage, setCurrentPage }) => {
);
};

export default NavBar;

// <AppBar position='static'>
// <Tabs
// variant='
// value={value}
// // onChange={handleChange}
// aria-label='nav tabs example'
// >
// <Tab label='Top Artists' onClick={history.push('/')} />
// {/* <Tab label='Top Tracks' onClick={history.push('/top-tracks')} /> */}
// {/* <Tab label='Playlists' onClick={history.push('/playlists')} /> */}
// </Tabs>
// </AppBar>;

// <header>
// <Accordion>
// <AccordionSummary
// expandIcon={<MenuIcon />}
// aria-controls='panel1a-content'
// id='panel1a-header'
// >
// <Typography variant='h3'>Spotify Metadata</Typography>
// </AccordionSummary>
// <AccordionDetails>
// <div className='header-buttons'>
// <Button
// variant='outlined'
// color={currentPage === 0 ? 'secondary' : 'primary'}
// fullWidth
// onClick={() => {
// setCurrentPage(0);
// history.push('/top-artists');
// }}
// >
// Top Artists
// </Button>
// <Button
// variant='outlined'
// color={currentPage === 1 ? 'secondary' : 'primary'}
// onClick={() => {
// setCurrentPage(1);
// history.push('/top-tracks');
// }}
// fullWidth
// >
// Top Tracks
// </Button>
// <Button
// variant='outlined'
// color={currentPage === 2 ? 'secondary' : 'primary'}
// fullWidth
// onClick={() => {
// setCurrentPage(2)
// history.push('/playlists')}
// }

// >
// Playlists
// </Button>
// </div>
// </AccordionDetails>
// </Accordion>
// </header></AppBar>
export default NavBar;
2 changes: 1 addition & 1 deletion src/components/SelectTimeRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ const SelectTimeRange = ({timeRange, setTimeRange}) => {
)
}

export default SelectTimeRange
export default SelectTimeRange
6 changes: 3 additions & 3 deletions src/pages/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ const Playlist = ({ playlist }) => {
<>
<AudioFeatures
trackIds={trackIds}
setAudioFeatures={setAudioFeatures}
setAudioFeatures={setAudioFeatures}
/>
<ArtistGenres
artistHREFs={artistHREFs}
setArtistData={setArtistData}
setArtistData={setArtistData}
/>
<Tracks
tracks={tracks}
artistData={artistData}
audioFeatures={audioFeatures}
audioFeatures={audioFeatures}
/>
</>
)}
Expand Down
9 changes: 4 additions & 5 deletions src/pages/Playlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Playlists = () => {
const history = useHistory();
const { token, playlist, setPlaylist } = useContext(UserContext);
const [playlists, setPlaylists] = useState(undefined);

const [playlistTotalAmount, setPlaylistTotalAmount] = useState(undefined)
const [playlistSearchOffset, setPlaylistSearchOffset] = useState(0)

Expand All @@ -27,7 +27,6 @@ const Playlists = () => {
}
});

// console.log(response.data.items)
setPlaylistTotalAmount(response.data.total)
setPlaylists(response.data.items);
} catch (err) {
Expand Down Expand Up @@ -64,8 +63,8 @@ const Playlists = () => {
<hr/>
</>
)}



{playlists && (
<ul>
Expand All @@ -85,7 +84,7 @@ const Playlists = () => {
)}

{playlistTotalAmount && (
<PageButtons
<PageButtons
playlistTotalAmount={playlistTotalAmount}
offset={playlistSearchOffset}
setOffset={setPlaylistSearchOffset}
Expand Down

0 comments on commit 912a330

Please sign in to comment.