Skip to content

Feature/suggestions #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/views/AppRouter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Overview from './spotify/overview/Overview';
import Landingpage from './landingpage/Landingpage';
import Tracks from './spotify/tracks/Tracks';
import Artists from './spotify/artists/Artists';
import Suggestions from './spotify/suggestions/Suggestions';
import Analyze from './spotify/analyze/Analyze';
import Genres from './spotify/genres/Genres';
import { Header, Footer } from './common';
Expand Down Expand Up @@ -42,6 +43,7 @@ const AppRouter = ({ isLoading }) => {
<Route exact path="/overview" component={Overview} />
<Route exact path="/artists" component={Artists} />
<Route exact path="/tracks" component={Tracks} />
<Route exact path="/suggestions" component={Suggestions} />
<Route exact path="/analyze" component={Analyze} />
<Route exact path="/genres" component={Genres} />
<Footer />
Expand Down
2 changes: 1 addition & 1 deletion src/views/common/header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Header = () => {
<div className="header">
<h3 className="title">
<a className="header-link" href="/">
Statify
STATIFY
</a>
</h3>
<NavBar />
Expand Down
2 changes: 2 additions & 0 deletions src/views/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export { default as UserBadge } from './user-badge/UserBadge';

export { default as ShowAt } from './defaultscreens/ShowAt';

export { default as Suggestion } from './suggestion/Suggestion';

export { default as ScreenToSmall } from './errors/ScreenToSmall';

export { default as NavBar } from './navbar/NavBar';
Expand Down
24 changes: 24 additions & 0 deletions src/views/common/suggestion/Suggestion.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

import './style.css';

const Suggestion = (suggestion, index) => {
let background = {};
if (suggestion.images[0]) {
background = {
backgroundImage: `url(${suggestion.images[0].url})`,
};
}

return (
<div key={suggestion.id} className="artist">
<div className="img-container">
<div style={background} className="artist-card-image"></div>
<p className="artist-rank">{index + 1}</p>
</div>
<p className="artist-card-name bold">{suggestion.name}</p>
</div>
);
};

export default Suggestion;
Empty file.
9 changes: 5 additions & 4 deletions src/views/common/user-badge/UserBadge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ function Userbadge() {
<div className={`fullscreen-menu ${menuActive}`}>
<a
href="/"
className={`fullscreen-navigation-item ${window.location.href.split('/')[3] === ''
? 'fullscreen-navigation-active'
: 'fullscreen-navigation-inactive'
}`}
className={`fullscreen-navigation-item ${
window.location.href.split('/')[3] === 'overview'
? 'fullscreen-navigation-active'
: 'fullscreen-navigation-inactive'
}`}
>
Overview
</a>
Expand Down
3 changes: 1 addition & 2 deletions src/views/landingpage/Landingpage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ function Landingpage() {
return (
<div className="landingpage">
<div className="login-area">
<h3 className="logo">Statify</h3>
<h3 className="logo">STATIFY</h3>
<h1 className="intro-text">Do you really know what music you listen to?</h1>
<p>
With our website you can see what your most listened artist and tracks are. You can also
create playlists with your favourite tracks directly from Statify
</p>
<p className="disclaimer">*Some functionality may be exclusive for Spotify-Users</p>
<a href="/about">About this site</a>
<div className="login-buttons">
<button
Expand Down
36 changes: 36 additions & 0 deletions src/views/spotify/suggestions/Suggestions.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
// import { fetchSuggestions } from '../../../services/spotifyservice';
// import { Suggestion, DefaultErrorMessage } from '../../common';
import './style.css';

// import { Spinner } from '../../common';
// import useDataHook from '../../../hooks/useDataHook';

function Suggestions() {
// const [baseContent, setBaseContent] = '';
// const [suggestionsRequest, setSuggestionsRequest] = useState(() => () => fetchSuggestions(baseContent));
// const { data: artists, isLoading, hasError } = useDataHook(suggestionsRequest);

// useEffect(() => {
// setSuggestionsRequest(() => () => fetchSuggestions(baseContent));
// }, [timerange]);

// if (hasError) return <DefaultErrorMessage />;
// if (!artists > 0 && isLoading !== false) return <Spinner />;

// const renderSuggestions = () => {
// return artists.map((artist, index) => {
// return Suggestion(artist, index);
// });
// };

return (
<div className="suggestions">
<h1 className="site-title">Let us show you songs you might like!</h1>

{/* <div className="suggestions-content">{renderSuggestions()}</div> */}
</div>
);
}

export default Suggestions;
Empty file.