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

BAKI TUNCER/LONDON-10/CFY HOTEL #618

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

Conversation

batuncer
Copy link

No description provided.

@sonarqubecloud
Copy link

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

@BGIvanG BGIvanG left a comment

Choose a reason for hiding this comment

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

Great Work on working with the Apis and handling the error. Just a few comments mostly about moving components out into their own file. its normally best as it keeps the project clean and makes the components more reusable.


const App = () => {
const addresses = [
Copy link

Choose a reason for hiding this comment

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

This variable makes it seem like the list contains only addresses. However it has an email and a phone number. It might be better to rename it to something like details.

useEffect(() => {
console.log("Page loaded");
setIsLoading(true);
setError(null);
Copy link

Choose a reason for hiding this comment

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

Really nice use of error handling here on page load. However, you shouldnt need this since you already have the default set to null.

);
};

const CustomerProfile = ({ customerId }) => {
Copy link

Choose a reason for hiding this comment

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

You used the Id really well here to allow for searching. Only suggestion would be to move this into a separate file so it becomes its own reusable component if it needs to be used elsewhere. Similar to the other components in the app.

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

const Order = ({ orderType }) => {
Copy link

Choose a reason for hiding this comment

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

This is great separation making them all into smaller components however it still might be best to split them into separate files to keep them smaller and easier to read.

<th>Email</th>
<th>Room ID</th>
<th>Check-in Date</th>
<th>Check-out Date</th>
Copy link

Choose a reason for hiding this comment

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

For task 6 to add the difference of nights You installed moment library which is great. The docs provide some guidance on calculating the difference here https://momentjs.com/docs/#/displaying/difference/

</thead>
<tbody>
{bookings.map((booking) => (
<tr key={booking.id}>
Copy link

Choose a reason for hiding this comment

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

The map works perfectly here and it seems to function as expected. It just seems to be missing lesson 2 task 15. You can achieve it by adding a onClick here and a function to change its class

fetch(`https://cyf-react.glitch.me/customers/${customerId}`)
.then((response) => response.json())
.then((data) => {
setCustomerProfile(data);
Copy link

Choose a reason for hiding this comment

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

Would be good to add a catch here aswell and some error handling similar to the other api requests. Then you can use that to display an error message.

@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