Giter Club home page Giter Club logo

react-recipe-app's Introduction

The World's Food

Table of contents

Overview

This is a real-time Recipe App made with React, Firebase and Firestore.

Users are able to:

  • View the optimal layout for each page depending on their device's screen size
  • Search for any food recipes with its own name or product name
  • Filter results by meal type, dish type, health preferences, diet preferences, calories, ingridients and time
  • See their last selections on the form and recipe results on their next visit
  • See the recipe details
  • See 404 Error message if they try to go to unexisting part of the website
  • Sign up by creating their own account or with their google account
  • Get error message if they try to sign up with invalid email or password with under 6 characters
  • Sign in with their account on the app or their google account
  • Get error message if they try to sign up with invalid email or password
  • Do these if they have an account:
    • Save the recipes and see them by their account for every user, on Saved Recipes tab under my account
    • See their last selections on the form,recipe results and saved recipes by their own account on their next visit
    • See their own personal info on the personal info tab under my account
    • Change their password if they want to, on the change password tab under my account
    • Reset their password if they forget it, on forgot password tab under sign in tab

Screenshot

-๐Ÿ’ป Desktop-View(Please wait until the videos are uploaded,if not please refresh the page!)

-Part1

desktop-view-part1.mp4

-Part2

desktop-view-part2.mp4

-๐Ÿ“ฑ Mobile-View (Please wait until the videos are uploaded,if not please refresh the page!)

mobile-view.mp4

Links

Built with

  • HTML5 markup
  • CSS custom properties
  • Styled Components
  • MUI
  • React JS
  • Context API
  • Local Storage
  • React Router
  • Firebase Authentication
  • Firestore
  • React Spinners,React Lazy Load
  • Dotenv
  • Netlify

What I learned

I used the Edamam API as a developer for free and because of it I can`t use the API fully and can only make a call with one filter on diet and health preferences. Firstly, I changed the input types to radio, so with the same name user could choose only one option but the problem is that radio buttons can not be unchecked and I learned that it is not possible to set the states multiple time in a map function.So I had to make my own radio button with check button and set the state one time and lastly. Here is my code:

const handleRadio = (e) => {
  let array = input[e.target.name];

  const health = [
    "alcohol-free",
    "vegan",
    "vegetarian",
    "kidney-friendly",
    "pork-free",
  ];
  const diet = [
    "balanced",
    "high-protein",
    "low-carb",
    "low-fat",
    "low-sodium",
  ];
  if (e.target.checked) {
    array = [];
    array.push(e.target.value);

    const object = {};

    if (health.indexOf(e.target.value) !== -1) {
      health
        .filter((element) => element !== e.target.value)
        .map((element) => (object[element] = false));
      setCheck({ ...check, ...object, [e.target.value]: e.target.checked });
    } else {
      diet
        .filter((element) => element !== e.target.value)
        .map((element) => (object[element] = false));
      setCheck({ ...check, ...object, [e.target.value]: e.target.checked });
    }
  } else {
    array = [];
    setCheck({ ...check, [e.target.value]: false });
  }
  return setInput({ ...input, [e.target.name]: array });
};

I also learned how to useNavigate hook with useParams and use recipe id in a link to make an API call with it, so I can show to recipe details to the user and user can go to that recipe detail every time with the same link (It is not possible if you send the data with state in useNavigate hook.). Additionally, I learned that you have to encode the "#" in a link like this "owl%23$".

  const { id } = useParams();
  const get = async () => {
  const response = await axios(
    `https://api.edamam.com/search?app_id=${process.env.REACT_APP_EDAMAM_APP_ID}&app_key=${process.env.REACT_APP_EDAMAM_APP_KEY}&r=http://www.edamam.com/ontologies/edamam.owl%23${id}`
  );

I also learned how to use Context API, Firebase Authentication, Firestore, React Spinners ,React Lazy Load.

Useful resources

Author

react-recipe-app's People

Contributors

alpsabre avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.