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

Ch 92 create a tips section component for recipe detail page #89

Conversation

timDeHof
Copy link
Contributor

@timDeHof timDeHof commented Nov 6, 2023

created tips API call and rendered them in a tips card in a carousel

A new file, tips.js, has been added to the API directory. This file contains a function to fetch
tips from the Tasty API. This function is asynchronous and uses axios to make a GET request to the
Tasty API. The function takes in three parameters: id, from, and size, with default values for from
and size. The function returns the data received from the API or logs an error if the request fails.
This addition will allow the application to fetch and display tips from the Tasty API, enhancing the
user experience.
The new file fetch-tips-by-id.js is added to fetch tips related to a specific recipe by its id. This
feature enhances the user experience by providing relevant tips for each recipe. The function is
exported in the index.js file for easy access and use in other parts of the application.
…out unused useEffect

The CSS classes have been reordered to follow a consistent pattern, improving readability and
maintainability. The useEffect hook that was previously used to fetch favorites from local storage
has been commented out as it is currently not in use, reducing unnecessary operations and improving
performance.
…package

The react-responsive-carousel package was added to the project to provide carousel functionality in
the application. This will enhance the user interface by allowing for a more dynamic display of
content. In the global.css file, unnecessary blank lines were removed to maintain clean and readable
code.
…on to improve data structure

Previously, the fetchTips function was returning the entire data object, which could include
unnecessary information. Now, it directly returns the results property of the data object, which is
the actual data we need. This change simplifies the data structure and makes it easier to handle the
returned data.
…mponent

The Tips component now receives the recipeId instead of the entire tips object. This change was made
to reduce the amount of data being passed around and to allow the Tips component to fetch the tips
it needs by itself, thereby improving data encapsulation and component independence.
A new file, tips.json, has been added to the mirageServer/endpoints/tips directory. This file
contains a list of tips related to recipes. The server.js file has been updated to include a new
endpoint that serves the tips.json data. This change allows the application to provide users with
helpful tips related to the recipes, enhancing the user experience.
…usel

The Tips component has been significantly enhanced. Instead of a static placeholder, it now fetches
tips related to a specific recipe from the API and displays them in a carousel. This change provides
a more interactive and informative user experience. The component also handles loading and error
states, improving the robustness of the application. A new TipCard component has been introduced to
display individual tips in a structured format.
Copy link

netlify bot commented Nov 6, 2023

Deploy Preview for yumyumyesdev ready!

Name Link
🔨 Latest commit 1fb3aab
🔍 Latest deploy log https://app.netlify.com/sites/yumyumyesdev/deploys/654b8697c8f62d0007aab924
😎 Deploy Preview https://deploy-preview-89--yumyumyesdev.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Nov 6, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link
Contributor

@joekotvas joekotvas 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

@joekotvas joekotvas merged commit c3d4a35 into development Nov 8, 2023
5 checks passed
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.

2 participants