Skip to content
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

DocConnect v1 FrontEnd PR #19

Merged
merged 145 commits into from
Oct 3, 2023
Merged

DocConnect v1 FrontEnd PR #19

merged 145 commits into from
Oct 3, 2023

Conversation

misalazeem
Copy link
Collaborator

@misalazeem misalazeem commented Oct 2, 2023

Note to Reviewer # 2: I didn't realize the deployment didn't reset on the latest change. so could be kind enough to check on local. My partner isn't available to redeploy. Thank you

Link To Backend PR: Click here

Hi Code Reviewer,

Following are the tasks completed in this Pull Request:

  • The user logs in to the website, only by typing the username (a proper authenticated login is a requirement if your group is made of 5 people).

In the navigation panel, the user can see links to:

  • Motorcycles/doctors/classes/items that you selected as a theme.
  • "Reserve" form.
  • "My reservations".
  • "Add motorcycle/doctor/class/item that you selected as a theme" (the link is visible to everybody).
  • "Delete motorcycle/doctor/class/item that you selected as a theme" (the link is visible to everybody).
  • On the main page, the user can see a [list of motorcycles/doctors/classes/items that you selected as a theme]

(https://www.behance.net/gallery/26425031/Vespa-Responsive-Redesign/modules/173005577).
List

  • When the user selects a specific item, they can see the details page with its full description (skip the "Rotate image" button).
  • In the details page, the user can click the "Reserve" button (in the design you can see the "Configure" button - please replace it with the "Reserve" button).

Details

  • When the user clicks the "Add item" link in the navigation panel they can see a form for adding a new item.
  • Make the app responsive, creating both mobile and desktop versions.

Additional features - Required for teams with 3-4 & 5 members (optional for others)

  • When the user clicks the "Delete item" link in the navigation panel they can see a list of all items with title and "Delete" button.

  • When the user clicks the "Delete" button, the selected item is marked as removed and does not show on the main list anymore.

  • To reserve an appointment, the user has to select a date and city (username and selected item are autofilled).

  • Use the design based on the "Book a vespa test-ride" and add all necessary inputs.

  • The user can also access the "Reserve" page from the navigation panel. In that case only username is autofilled.

  • Booking

  • When the user clicks the "My reservations" link in the navigation panel they can see a list of their reservations (with information about item name, date and city).

  • Add full documentation for your API.

Additional features - Required only for teams with 5 members (optional for others)

  • Implement proper user authentication from the front-end to the server.
  • Make sure that the "Add item" and "Delete item" links are accessible only by users who are admins.

Copy link

@Meltrust Meltrust left a comment

Choose a reason for hiding this comment

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

Hi @misalazeem,

Good job so far!
There are some issues that you still need to work on to prepare your project for the final evaluation, but you are almost there!

You are really close to finishing the Microverse program!! Keep it up! 👍👍👍

You can do it

After implementing the requested changes, please submit another review request. ♻️

Check the comments under the review.

Cheers and Happy coding!👏👏👏

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the previous reviews unless it is requested otherwise.


src/App.js Outdated

const queryClient = new QueryClient();

function App() {
Copy link

Choose a reason for hiding this comment

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

  • Please, kindly refactor this and all other functions in your project to ES6 arrow functions, so your code complies with the latest standards.

Refactoring is easy:

const App = () => {
  // ...
}

Explanation

The function keyword has been soft deprecated in almost all the software industry in favor of ES6 arrow functions. This means, almost nobody uses it anymore, so much that it's considered a non-best practice.

You can do a search in Vscode for the "function" word, and correct as needed. Shouldn't take you more than 5-10 min so don't worry (I found 4):

image

That way, your code will meet the latest standards. 💪

import Input from '../components/Input';
import Button from '../components/Button';

const SignUp = () => {
Copy link

Choose a reason for hiding this comment

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

  • Every time I sign up or login, I get this error:

image

I can get into the app, but the error always shows up "Couldn't find an active session"

Kindly, fix this error so your app behaves correctly. 👍

import Input from '../components/Input';
import Button from '../components/Button';

const SignUp = () => {
Copy link

Choose a reason for hiding this comment

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

  • When I try to use the provided admin credentials, I get this error:

image

Kindly, take a look at this issue so the "add" and "delete" can be accessed.

note: This may be working on your end because your browser's local storage is already populated, which is not the case for new users. In order to correctly debug this, kindly test it on an incognito tab.

note 2: This means I couldn't get into the admin functionality. This will be taken a look in the next review.

Copy link

@mcrd25 mcrd25 left a comment

Choose a reason for hiding this comment

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

Hi Team,

Great work on making the changes requested by a previous reviewer 👏
You've done well implementing some of the requested changes, but there are still some which aren't addressed yet.

Highlights

  • Good job implementing requested changes 👍

Required Changes ♻️

Check the comments under the review.
Now, i totally get if you ignore my requested changes since they were not mentioned before, but please consider for final evaluation, you are also free to ignore.

  • There are some candidates to make some of these html components reusable.

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.

Hope all is well, and that my comments were helpful. 😸

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.
Also, you do not have to implement all requested changes, as this is up to you in the end, but I strongly recommend you implement them.

<div className="relative h-10 w-full min-w-[200px]">
<input
type={type}
className="peer h-full w-full rounded-[7px] border border-gray-400 border-t-transparent bg-transparent px-3 py-2.5 font-sans text-sm font-normal text-blue-gray-700 outline outline-0 transition-all placeholder-shown:border placeholder-shown:border-blue-gray-200 placeholder-shown:border-t-gray-400 focus:border-2 focus:border-green-400 focus:border-t-transparent focus:outline-0 disabled:border-0 disabled:bg-blue-gray-50"
Copy link

Choose a reason for hiding this comment

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

[OPTIONAL] these class names are pretty long, consider using styled components or variables for long className, it makes code much cleaner.

{...register(name)}
/>
<label
className="before:content[' '] after:content[' '] pointer-events-none absolute left-0 -top-1.5 flex h-full w-full select-none text-[11px] font-normal leading-tight text-blue-gray-400 transition-all before:pointer-events-none before:mt-[6.5px] before:mr-1 before:box-border before:block before:h-1.5 before:w-2.5 before:rounded-tl-md before:border-t before:border-l before:border-gray-400 before:transition-all after:pointer-events-none after:mt-[6.5px] after:ml-1 after:box-border after:block after:h-1.5 after:w-2.5 after:flex-grow after:rounded-tr-md after:border-t after:border-r after:border-gray-400 after:transition-all peer-placeholder-shown:text-sm peer-placeholder-shown:leading-[3.75] peer-placeholder-shown:text-blue-gray-500 peer-placeholder-shown:before:border-transparent peer-placeholder-shown:after:border-transparent peer-focus:text-[11px] peer-focus:leading-tight peer-focus:text-green-400 peer-focus:before:border-t-2 peer-focus:before:border-l-2 peer-focus:before:border-green-400 peer-focus:after:border-t-2 peer-focus:after:border-r-2 peer-focus:after:border-green-400 peer-disabled:text-transparent peer-disabled:before:border-transparent peer-disabled:after:border-transparent peer-disabled:peer-placeholder-shown:text-blue-gray-500"
Copy link

Choose a reason for hiding this comment

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

[OPTIONAL] these class names are pretty long, consider using styled components or variables for long className, it makes code much cleaner.

<div className="relative h-10 min-w-[200px]">
<select
{...register(name)}
className="peer h-full w-full rounded-[7px] border border-gray-400 border-t-transparent bg-transparent px-3 py-2.5 font-sans text-sm font-normal text-blue-gray-700 outline outline-0 transition-all placeholder-shown:border placeholder-shown:border-blue-gray-200 placeholder-shown:border-t-blue-gray-200 empty:!bg-red-500 focus:border-2 focus:border-green-400 focus:border-t-transparent focus:outline-0 disabled:border-0 disabled:bg-blue-gray-50"
Copy link

Choose a reason for hiding this comment

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

[OPTIONAL] these class names are pretty long, consider using styled components or variables for long className, it makes code much cleaner.

))}
</select>
<label
className="before:content[' '] after:content[' '] pointer-events-none absolute left-0 -top-1.5 flex h-full w-full select-none text-[11px] font-normal leading-tight text-blue-gray-400 transition-all before:pointer-events-none before:mt-[6.5px] before:mr-1 before:box-border before:block before:h-1.5 before:w-2.5 before:rounded-tl-md before:border-t before:border-l before:border-gray-400 before:transition-all after:pointer-events-none after:mt-[6.5px] after:ml-1 after:box-border after:block after:h-1.5 after:w-2.5 after:flex-grow after:rounded-tr-md after:border-t after:border-r after:border-gray-400 after:transition-all peer-placeholder-shown:text-sm peer-placeholder-shown:leading-[3.75] peer-placeholder-shown:text-blue-gray-500 peer-placeholder-shown:before:border-transparent peer-placeholder-shown:after:border-transparent peer-focus:text-[11px] peer-focus:leading-tight peer-focus:text-green-400 peer-focus:before:border-t-2 peer-focus:before:border-l-2 peer-focus:before:border-green-400 peer-focus:after:border-t-2 peer-focus:after:border-r-2 peer-focus:after:border-green-400 peer-disabled:text-transparent peer-disabled:before:border-transparent peer-disabled:after:border-transparent peer-disabled:peer-placeholder-shown:text-blue-gray-500"
Copy link

Choose a reason for hiding this comment

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

[OPTIONAL] these class names are pretty long, consider using styled components or variables for long className, it makes code much cleaner.

Comment on lines 45 to 101
<button
type="button"
onClick={() => directLink('/doctors')}
className="block w-full"
>
List of Doctors
</button>
</li>
<li className="px-8 py-4 transition-colors border-b cursor-pointer border-white-700 hover:text-green-400">
<button
type="button"
onClick={() => directLink('/appointment-list')}
className="block w-full"
>
Check your Appointments
</button>
</li>
<li className="px-8 py-4 transition-colors border-b cursor-pointer border-white-700 hover:text-green-400">
<button
type="button"
onClick={() => directLink('/create-appointment')}
className="block w-full"
>
Schedule a new Appointment
</button>
</li>
{ userInfo.role === 'admin' ? (
<>
<li className="px-8 py-4 transition-colors border-b cursor-pointer border-white-700 hover:text-green-400">
<button
type="button"
onClick={() => directLink('/add-docs')}
className="block w-full"
>
Add a new Doctor
</button>
</li>
<li className="px-8 py-4 transition-colors border-b cursor-pointer border-white-700 hover:text-green-400">
<button
type="button"
onClick={() => directLink('/delete-docs')}
className="block w-full"
>
Delete a Doctor
</button>
</li>
</>
) : (<></>)}
<li className="px-8 py-4 transition-colors border-b cursor-pointer border-white-700 hover:text-green-400">
<button
type="button"
onClick={() => directLink('/logout')}
className="block w-full"
>
Sign out
</button>
</li>
Copy link

Choose a reason for hiding this comment

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

These button list items could be abstracted into a subcomponent and you can clean up the code by using some sort of array/map combination. I strongly recommend this.

Comment on lines 127 to 178
<li className="w-full px-4 py-4 transition-all rounded-xl text-start hover:text-white hover:bg-green-400">
<Link
to="/doctors"
className="block w-full "
>
Doctors
</Link>
</li>
<li className="w-full px-4 py-4 transition-all rounded-xl text-start hover:text-white hover:bg-green-400">
<Link
to="/appointment-list"
className="block w-full"
>
Check your Appointments
</Link>
</li>
<li className="w-full px-4 py-4 transition-all rounded-xl text-start hover:text-white hover:bg-green-400">
<Link
to="/create-appointment"
className="block w-full"
>
Schedule a new Appointment
</Link>
</li>
{ userInfo.role === 'admin' ? (
<>
<li className="w-full px-4 py-4 transition-all rounded-xl text-start hover:text-white hover:bg-green-400">
<Link
to="/add-docs"
className="block w-full"
>
Add a new Doctor
</Link>
</li>
<li className="w-full px-4 py-4 transition-all rounded-xl text-start hover:text-white hover:bg-green-400">
<Link
to="/delete-docs"
className="block w-full"
>
Delete a Doctor
</Link>
</li>
</>
) : (<></>)}
<li className="w-full px-4 py-4 transition-all rounded-xl text-start hover:text-white hover:bg-green-400">
<Link
to="/logout"
className="block w-full"
>
Sign out
</Link>
</li>
Copy link

Choose a reason for hiding this comment

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

[OPTIONAL] Consider same as above for the Link / List item to make code cleaner

<div className="relative w-full min-w-[200px]">
<textarea
{...register(name)}
className="peer h-full min-h-[100px] w-full resize-none rounded-[7px] border border-gray-400 border-t-transparent bg-transparent px-3 py-2.5 font-sans text-sm font-normal text-blue-gray-700 outline outline-0 transition-all placeholder-shown:border placeholder-shown:border-blue-gray-200 placeholder-shown:border-t-gray-400 focus:border-2 focus:border-green-400 focus:border-t-transparent focus:outline-0 disabled:resize-none disabled:border-0 disabled:bg-blue-gray-50"
Copy link

Choose a reason for hiding this comment

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

[OPTIONAL] these class names are pretty long, consider using styled components or variables for long className, it makes code much cleaner.

placeholder=" "
/>
<label
className="before:content[' '] after:content[' '] pointer-events-none absolute left-0 -top-1.5 flex h-full w-full select-none text-[11px] font-normal leading-tight text-blue-gray-400 transition-all before:pointer-events-none before:mt-[6.5px] before:mr-1 before:box-border before:block before:h-1.5 before:w-2.5 before:rounded-tl-md before:border-t before:border-l before:border-gray-400 before:transition-all after:pointer-events-none after:mt-[6.5px] after:ml-1 after:box-border after:block after:h-1.5 after:w-2.5 after:flex-grow after:rounded-tr-md after:border-t after:border-r after:border-gray-400 after:transition-all peer-placeholder-shown:text-sm peer-placeholder-shown:leading-[3.75] peer-placeholder-shown:text-blue-gray-500 peer-placeholder-shown:before:border-transparent peer-placeholder-shown:after:border-transparent peer-focus:text-[11px] peer-focus:leading-tight peer-focus:text-green-400 peer-focus:before:border-t-2 peer-focus:before:border-l-2 peer-focus:before:border-green-400 peer-focus:after:border-t-2 peer-focus:after:border-r-2 peer-focus:after:border-green-400 peer-disabled:text-transparent peer-disabled:before:border-transparent peer-disabled:after:border-transparent peer-disabled:peer-placeholder-shown:text-blue-gray-500"
Copy link

Choose a reason for hiding this comment

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

[OPTIONAL] these class names are pretty long, consider using styled components or variables for long className, it makes code much cleaner.

Copy link

@Meltrust Meltrust left a comment

Choose a reason for hiding this comment

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

Hi team,

Wow, you did it 🎉

Brilliant

Thank you for implementing the changes requested by the previous reviewer 💪 🥇 ㊗️

Well done!

Your project is complete! There is nothing else to say other than... it's time to merge it :shipit:
Congratulations! 🎉

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

@andrianarivo andrianarivo merged commit 1544e62 into main Oct 3, 2023
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.

6 participants