Skip to content

Commit

Permalink
Fix sidebar and page container not working side by side.
Browse files Browse the repository at this point in the history
Fix ESLint config with linebreak errors.
Add Spotify Web API Node module.
Add Spotify test code.
  • Loading branch information
SherRao committed Jul 6, 2021
1 parent f35f5c5 commit a991e6d
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
4
],
"linebreak-style": [
1,
"off",
"unix"
],
"quotes": [
Expand All @@ -44,4 +44,4 @@
}
]
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ keys
npm-debug.log*
yarn-debug.log*
yarn-error.log*
config.json
142 changes: 137 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"react-scripts": "^1.1.5",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^2.0.3",
"spotify-web-api-node": "^5.0.2",
"styled-components": "^5.3.0",
"web-vitals": "^1.1.2"
},
Expand Down
9 changes: 5 additions & 4 deletions src/components/organisms/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import { SidebarButton, MuspaceLogo } from "@atoms";
import { FaHome, FaUserFriends, FaEnvelope, FaSpotify } from "react-icons/fa";

const StyledDiv = Styled.div`
max-width: 20vw;
width: 20%;
height: 100vh;
padding: 0;
background-color: ${props => props.theme.colors.white};
border-right: 1px solid ${props => props.theme.colors.black};
display: inline-flex;
flex-direction: column;
align-items: center;
transition: all 0.25s ease;
min-width: 20vw;
border-right: 1px solid ${props => props.theme.colors.lightGrey};
padding: 20px 0;
`;

Expand Down
19 changes: 19 additions & 0 deletions src/functions/Spotify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import SpotifyWebApi from "spotify-web-api-node";

const api = new SpotifyWebApi(
{
clientId: "1e4ee4e30b23405d8643d058642dffaf",
clientSecret: "8ab0151237234a22877c4e644fa1b433",
redirectUri: "https://muspace.me/spotify-callback"
}
);

async function test() {
console.log("Testing test()");
const response = await api.getArtistAlbums("43ZHCT0cAZBISjO8DG9PnE");
console.log(response.body);
return response.body;

}

export default { test };
1 change: 1 addition & 0 deletions src/functions/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Firebase from "./Firebase";
import Spotify from "./Spotify";

export default Firebase;
46 changes: 39 additions & 7 deletions src/misc/ProtectedRoute.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,53 @@
import React from "react";
import { Route } from "react-router-dom";

import { Redirect } from "react-router-dom";
import Styled from "styled-components";
import { Route, Redirect } from "react-router-dom";
import { Sidebar } from "@organisms";

import Firebase from "@functions";

const loggedIn = Firebase.isLoggedIn();

const StyledDiv = Styled.div`
width: 100vw;
height: 100vh;
padding: 0;
background-color: ${props => props.theme.colors.white};
display: inline-flex;
flex-direction: row;
align-items: center;
transition: all 0.25s ease;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
`;

const PageContainer = Styled.div`
width: 80vw;
height: 100vh;
padding: 0;
background-color: ${props => props.theme.colors.white};
display: inline-flex;
flex-direction: row;
align-items: center;
transition: all 0.25s ease;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
`;

// eslint-disable-next-line no-unused-vars
function ProtectedRoute({ exact = false, path, component }) {
if (loggedIn)
return (
<div>
<StyledDiv>
<Sidebar />
<Route path={path} component={component} />
</div>
<PageContainer>
<Route path={path} component={component} />
</PageContainer>
</StyledDiv>
);

else
Expand Down
2 changes: 1 addition & 1 deletion src/pages/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Styled from "styled-components";

function HomePage() {
return (
<div>hey</div>
<div><p>heywhatsup</p></div>
);
}

Expand Down
Loading

0 comments on commit a991e6d

Please sign in to comment.