Skip to content

Create a home page#4

Open
brendanator wants to merge 12 commits into
base-sha/b3fb5370aaecf29003b08ec24ed854a5b3582159from
head-sha/8fc3b08424d89352590f5c75ada0bce46e9389a3/2024-03-13T16-31-07
Open

Create a home page#4
brendanator wants to merge 12 commits into
base-sha/b3fb5370aaecf29003b08ec24ed854a5b3582159from
head-sha/8fc3b08424d89352590f5c75ada0bce46e9389a3/2024-03-13T16-31-07

Conversation

@brendanator

Copy link
Copy Markdown

No description provided.

@brendanator

Copy link
Copy Markdown
Author

This pull request was cloned from https://github.com/juanAriel/song-search/pull/2

Note: the URL is not a link to avoid triggering a notification on the original pull request.

@brendanator brendanator left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery logo Sourcery Review:

Hey @brendanator - I've reviewed your changes and they look great!

General suggestions:

  • Consider renaming the file with a typo in its name for clarity and consistency.
  • Review the handling of errors and undefined returns in asynchronous functions to ensure robust error handling.
  • Evaluate the use of inline styles for scalability and maintainability in larger applications.
  • Move static style objects outside of components to improve performance and avoid unnecessary re-renders.
Here's what I looked at during the review
  • 🟡 General issues: 5 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Docstrings: all looks good

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

const urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "client_credentials");
urlencoded.append("client_id", process.env.REACT_APP_SPOTIFY_CLIENT_ID || '' );
urlencoded.append("client_secret", process.env.REACT_APPP_SPOTIFY_CLIENT_SECRET || '');

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery logo issue (typo): There seems to be a typo in the environment variable name REACT_APPP_SPOTIFY_CLIENT_SECRET. It likely should be REACT_APP_SPOTIFY_CLIENT_SECRET (with two 'P's instead of three). This typo could prevent the application from correctly accessing the client secret from the environment variables.

const responseData = await data.json();
return responseData;
} catch (error) {
return;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery logo suggestion (code_refinement): Returning undefined in case of an error during token generation might lead to unhandled exceptions later in the code where the token is used. It could be beneficial to throw a specific error or return a more descriptive error object to facilitate error handling and debugging.

@@ -0,0 +1,38 @@
import { getToken } from "./generateToken";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery logo nitpick (typo): The file name requetsToEndpoint.ts seems to be a typo. Consider renaming it to requestsToEndpoint.ts for clarity and consistency.

@@ -0,0 +1,56 @@
import React, { useState, useEffect } from "react";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery logo suggestion (code_refinement): While the use of inline styles (e.g., style={{display:'inline-block', marginTop: '20px'}}) is acceptable for small projects or prototypes, for larger applications or components that might be reused, consider using a CSS module or styled-components for better maintainability and scalability.

@@ -0,0 +1,42 @@
import React, { useState } from 'react';

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery logo suggestion (performance): The style object defined here for InputBase could be moved outside of the component or into a separate CSS module for better separation of concerns and to avoid the style object being recreated on each render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant