Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

London10_Jan_Softa_cyf_hotel_react #615

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

softacoder
Copy link

No description provided.

@sonarcloud
Copy link

sonarcloud bot commented Jul 10, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link

@sherif98 sherif98 left a comment

Choose a reason for hiding this comment

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

Overall looks great Jan! I added a couple of comments.


const App = () => {
const contactDetails = [

Choose a reason for hiding this comment

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

Can we move the contactDetails inside the Footer component? I don't think there is a need to define contactDetails here and pass it to the Footer component as props

import Search from "./Search.js";
// import SearchResults from "./SearchResults.js";

Choose a reason for hiding this comment

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

Remove if not used


useEffect(() => {
setIsLoading(true);
fetch(`https://cyf-react.glitch.me/customers/${props.id}`)

Choose a reason for hiding this comment

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

In Bookings.js you use async, await to do the fetch, while here you use .then() (i.e. promises chaining). I suggest using async, await here as well to make sure the code is consistent.


if (!customerProfileData) {
return null; // or render a message indicating that the customer profile is not available
}

Choose a reason for hiding this comment

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

[no action] It's nice you're separating the different return statements and not putting them all into one big return.

/>
<button className="btn btn-primary">Search</button>
<SearchButton />

Choose a reason for hiding this comment

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

I feel that putting the button into a separate SearchButton component is over-engineering. The component only has a single line to declare a button and doesn't maintain any state. What do you think of just inlining the here?

) : (
<OutcomeSearch results={bookings} setCustomerId={setCustomerId} />
)}
{customerId && <CustomerProfile id={customerId} />}

Choose a reason for hiding this comment

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

Is using the CustomerProfile component here needed? I see that you render the CustomerProfile component in the SearchResult.js line 54.

I think customerId is always undefined and thus it never renders the component here. Please take a look and let me know what are your thoughts on this. Thanks

@migmow migmow added the reviewed A volunteer has reviewed this PR label Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
reviewed A volunteer has reviewed this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants