diff --git a/README.md b/README.md
index ade2e85..022fdaa 100644
--- a/README.md
+++ b/README.md
@@ -95,13 +95,16 @@ address: [link](https://mood2food.netlify.app/).
## Built With
- [Nuxt](https://nuxt.com/) - The Intuitive Vue Framework
-- [Tailwindcss](https://tailwindcss.com) -Rapidly build modern websites without ever leaving your HTML.
-- [TheMealDb](https://www.themealdb.com/api.php) - An open, crowd-sourced database of Recipes from around the world
+- [Tailwindcss](https://tailwindcss.com) -Rapidly build modern websites without
+ ever leaving your HTML.
+- [TheMealDb](https://www.themealdb.com/api.php) - An open, crowd-sourced database
+ of Recipes from around the world
## Contributing
-Please read [CONTRIBUTING.md](https://github.com/rjNemo/meal_planner/contributors) for details on our code of conduct,
-and the process for submitting pull requests to us.
+Please read [CONTRIBUTING.md](https://github.com/rjNemo/meal_planner/contributors)
+for details on our code of conduct, and the process for submitting pull requests
+to us.
## Versioning
@@ -112,9 +115,10 @@ the [tags on this repository](https://github.com/rjNemo/meal_planner/tags).
- **Ruidy Nemausat** - _Initial work_ - [GitHub](https://github.com/rjNemo)
-See also the list of [contributors](https://github.com/rjNemo/meal_planner/contributors) who participated in this
-project.
+See also the list of [contributors](https://github.com/rjNemo/meal_planner/contributors)
+who participated in this project.
## License
-This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
+This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md)
+file for details
diff --git a/docs/homepage.png b/docs/homepage.png
index fb0d41f..0dbdad3 100644
Binary files a/docs/homepage.png and b/docs/homepage.png differ
diff --git a/docs/mealpage.png b/docs/mealpage.png
index cd22473..82021ac 100644
Binary files a/docs/mealpage.png and b/docs/mealpage.png differ
diff --git a/pages/[id].vue b/pages/[id].vue
index 16197e6..3e5d7cb 100644
--- a/pages/[id].vue
+++ b/pages/[id].vue
@@ -24,6 +24,7 @@ if (error.value) {
message: error.value.message,
});
}
+
const url = useRequestURL();
useSeoMeta({
title: `${recipe.value!.title} | Mood2Food`,
diff --git a/src/App.tsx b/src/App.tsx
deleted file mode 100644
index e02cfb6..0000000
--- a/src/App.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import "./index.css";
-import MainLayout from "./layouts/MainLayout";
-import { AppRouter, Router } from "./router";
-
-export const App = () => (
-
-
-
-
-
-);
diff --git a/src/components/CardEntry.tsx b/src/components/CardEntry.tsx
deleted file mode 100644
index bbe6195..0000000
--- a/src/components/CardEntry.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { Link } from "react-router-dom";
-import { MealSummary } from "../types/meal";
-
-type Props = {
- meal: MealSummary;
- className?: string;
-};
-
-export const CardEntry = ({
- meal: { idMeal, strMeal, strMealThumb },
- className = "col s12 m6",
-}: Props) => (
-
-
-
-
-
-
-
-
-
{strMeal}
-
-
-
-
-
-);
diff --git a/src/components/CopyrightText.tsx b/src/components/CopyrightText.tsx
deleted file mode 100644
index 8fd001f..0000000
--- a/src/components/CopyrightText.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-export const CopyrightText = () => (
-
- © {new Date().getFullYear()} - Chef's - Made with{" "}
-
- ❤️
-
-
-);
diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx
deleted file mode 100644
index 82de02f..0000000
--- a/src/components/Footer.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { links } from "../constants";
-import { CopyrightText } from "./CopyrightText";
-import { FooterLink } from "./FooterLink";
-import { GitHubLink } from "./GitHubLink";
-
-export const Footer = () => {
- const footerLinks = [...links, "random"];
- return (
-
-
-
-
-
Navigation
-
- {footerLinks.map((link, i) => (
-
- ))}
-
-
-
-
-
-
-
- );
-};
diff --git a/src/components/FooterLink.tsx b/src/components/FooterLink.tsx
deleted file mode 100644
index 381517c..0000000
--- a/src/components/FooterLink.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Link } from "react-router-dom";
-import { upFirstChar } from "../utils/string";
-
-type Props = {
- link: string;
- textColor?: string;
-};
-
-export const FooterLink = ({ link, textColor = "" }: Props) => {
- const textColorClass = `${textColor}-text`;
- return (
-
-
- {upFirstChar(link)}
-
-
- );
-};
diff --git a/src/components/GitHubLink.tsx b/src/components/GitHubLink.tsx
deleted file mode 100644
index 8e346a6..0000000
--- a/src/components/GitHubLink.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-export const GitHubLink = () => (
-
- GitHub
-
-);
diff --git a/src/components/Logo.tsx b/src/components/Logo.tsx
deleted file mode 100644
index b01b14a..0000000
--- a/src/components/Logo.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Link } from "react-router-dom";
-
-export const Logo = () => (
-
-
- Chef's
-
-);
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
deleted file mode 100644
index 5a68086..0000000
--- a/src/components/Navbar.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { MouseEventHandler } from "react";
-import { Link } from "react-router-dom";
-import { buttonURL, links } from "../constants";
-import { FooterLink } from "./FooterLink";
-import { Logo } from "./Logo";
-import { RandomButton } from "./RandomButton";
-
-type Props = { openNavClick: MouseEventHandler };
-
-export const Navbar = ({ openNavClick }: Props) => (
-
-
-
-
-
-
- {links.map((link, i) => (
-
- ))}
-
-
-
-
-
-
menu
-
-
-
-
-
-);
diff --git a/src/components/PreLoader.tsx b/src/components/PreLoader.tsx
deleted file mode 100644
index c7eab78..0000000
--- a/src/components/PreLoader.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-export const PreLoader = () => (
-
-);
diff --git a/src/components/RandomButton.tsx b/src/components/RandomButton.tsx
deleted file mode 100644
index 5f97c7d..0000000
--- a/src/components/RandomButton.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Link } from "react-router-dom";
-import { useMeal } from "../store/meal";
-import { fetchRandomMeal } from "../store/meal/async";
-
-type Props = {
- url: string;
- size?: string;
- color?: string;
-};
-
-export const RandomButton = ({ url, size = "large", color }: Props) => {
- const classString = `waves-effect waves-light btn-${size} ${color}`;
- const { dispatch } = useMeal();
- return (
-
- fetchRandomMeal(dispatch)}>
- Random Recipe
-
-
- );
-};
diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx
deleted file mode 100644
index 78a156b..0000000
--- a/src/components/SearchBar.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { ChangeEvent, MouseEventHandler, useState } from "react";
-import { Link } from "react-router-dom";
-import { useMeal } from "../store/meal";
-import { fetchSearchResults } from "../store/meal/async";
-
-export const SearchBar = () => {
- const { dispatch } = useMeal();
- const [searchString, setSearchString] = useState("");
- const getSearchResults: MouseEventHandler = (e) => {
- searchString === "" ? e.preventDefault() : fetchSearchResults(dispatch, searchString);
- };
-
- const clearSearchBar = () => {
- setSearchString("");
- dispatch({ type: "clearSearchResults" });
- };
-
- const handleChange = ({ target: { value } }: ChangeEvent) =>
- setSearchString(value);
-
- return (
-
- );
-};
diff --git a/src/components/SideNav.tsx b/src/components/SideNav.tsx
deleted file mode 100644
index 6c1d390..0000000
--- a/src/components/SideNav.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import { MouseEventHandler } from "react";
-import { Link } from "react-router-dom";
-import { buttonURL, links } from "../constants";
-import SpecialEventImage from "../images/special_event.svg";
-import { FooterLink } from "./FooterLink";
-import { RandomButton } from "./RandomButton";
-
-type Props = {
- showNav: boolean;
- closeNavClick: MouseEventHandler;
-};
-
-export const SideNav = ({ showNav, closeNavClick }: Props) => {
- let transformStyle = {
- transform: showNav ? "translateX(0%)" : "translateX(-105%)",
- transition: "0.5s",
- };
-
- return (
-
-
-
-
-
-
-
-
- close
-
-
-
-
-
-
-
-
-
-
-
-
- Navigation
-
-
- {links.map((link, i) => (
-
- ))}
-
- );
-};
diff --git a/src/constants.ts b/src/constants.ts
deleted file mode 100644
index ec872f8..0000000
--- a/src/constants.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export const apiRoot = "https://www.themealdb.com/api/json/v1/1/";
-export const buttonURL = "/random";
-export const links = ["categories", "contact"];
diff --git a/src/containers/Categories/components/CategoriesEntry.tsx b/src/containers/Categories/components/CategoriesEntry.tsx
deleted file mode 100644
index 94a1f2c..0000000
--- a/src/containers/Categories/components/CategoriesEntry.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Link, useRouteMatch } from "react-router-dom";
-
-type Props = {
- strCategory: string;
- strCategoryThumb: string;
-};
-
-const CategoriesEntry = ({ strCategory, strCategoryThumb }: Props) => {
- const { url } = useRouteMatch();
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-};
-
-export default CategoriesEntry;
diff --git a/src/containers/Categories/components/CategoriesPage.tsx b/src/containers/Categories/components/CategoriesPage.tsx
deleted file mode 100644
index cff5920..0000000
--- a/src/containers/Categories/components/CategoriesPage.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import PageLayout from "../../../layouts/PageLayout";
-import CategoriesEntry from "./CategoriesEntry";
-
-type Props = {
- categories: { strCategory: string; strCategoryThumb: string }[];
-};
-
-export const CategoriesPage = ({ categories }: Props) => (
-
-
- {categories.map(({ strCategory, strCategoryThumb }, i) => (
-
- ))}
-
-
-);
diff --git a/src/containers/Categories/index.tsx b/src/containers/Categories/index.tsx
deleted file mode 100644
index 8b16888..0000000
--- a/src/containers/Categories/index.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { useEffect, useState } from "react";
-import { PreLoader } from "../../components/PreLoader";
-import { getData } from "../../services/api";
-import { CategoriesPage } from "./components/CategoriesPage";
-
-export const Categories = () => {
- const [categories, setCategories] = useState({ categories: [] });
-
- const getCategories = () => getData("categories").then((data) => setCategories(data));
-
- useEffect(() => {
- getCategories();
- }, []);
-
- return categories.categories.length === 0 ? (
-
- ) : (
-
- );
-};
diff --git a/src/containers/Category/components/CategoryPage.tsx b/src/containers/Category/components/CategoryPage.tsx
deleted file mode 100644
index 29d68b5..0000000
--- a/src/containers/Category/components/CategoryPage.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { CardEntry } from "../../../components/CardEntry";
-import PageLayout from "../../../layouts/PageLayout";
-import { MealSummary } from "../../../types/meal";
-
-type Props = {
- meals: { meals: MealSummary[] };
- strCategory: string;
-};
-
-export const CategoryPage = ({ meals, strCategory }: Props) => (
-
-
-
-);
diff --git a/src/containers/Category/index.tsx b/src/containers/Category/index.tsx
deleted file mode 100644
index d1f931a..0000000
--- a/src/containers/Category/index.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { useEffect, useState } from "react";
-import { Redirect, useParams } from "react-router-dom";
-import { getData } from "../../services/api";
-import { CategoryPage } from "./components/CategoryPage";
-
-export const Category = () => {
- const { strCategory } = useParams<{ strCategory: string }>();
- const [meals, setMeals] = useState({ meals: [] });
-
- useEffect(() => {
- const getMeals = () => getData(strCategory, "filter");
- getMeals().then((data) => setMeals(data));
- }, [strCategory]);
-
- return !meals.meals ? (
-
- ) : (
-
- );
-};
diff --git a/src/containers/Contact/components/ContactForm.tsx b/src/containers/Contact/components/ContactForm.tsx
deleted file mode 100644
index 5d7c554..0000000
--- a/src/containers/Contact/components/ContactForm.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import { useState, FormEvent } from "react";
-import { ContactFormInput } from "./ContactFormInput";
-import { ContactFormSubmitButton } from "./ContactFormSubmitButton";
-import { ContactFormTextArea } from "./ContactFormTextArea";
-
-type Props = {
- setIsSubmitted: (value: boolean) => void;
-};
-
-export const ContactForm = ({ setIsSubmitted }: Props) => {
- const [firstName, setFirstName] = useState("");
- const [lastName, setLastName] = useState("");
- const [email, setEmail] = useState("");
- const [phone, setPhone] = useState("");
- const [message, setMessage] = useState("");
-
- const handleSubmit = (e: FormEvent) => {
- e.preventDefault();
- setIsSubmitted(true);
- };
-
- return (
-
- );
-};
diff --git a/src/containers/Contact/components/ContactFormInput.tsx b/src/containers/Contact/components/ContactFormInput.tsx
deleted file mode 100644
index 031df55..0000000
--- a/src/containers/Contact/components/ContactFormInput.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { ChangeEventHandler, Dispatch, SetStateAction } from "react";
-
-type Props = {
- id: string;
- type?: string;
- value: string;
- dispatch: Dispatch>;
-};
-
-export const ContactFormInput = ({ id, type = "text", value, dispatch }: Props) => {
- const handleChange: ChangeEventHandler = (e) => {
- e.preventDefault();
- dispatch(e.target.value);
- };
-
- return (
-
- {/* account_circle */}
-
- {id}
-
- );
-};
diff --git a/src/containers/Contact/components/ContactFormSubmitButton.tsx b/src/containers/Contact/components/ContactFormSubmitButton.tsx
deleted file mode 100644
index 42fcdde..0000000
--- a/src/containers/Contact/components/ContactFormSubmitButton.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-type Props = {
- text: string;
- color: string;
-};
-
-export const ContactFormSubmitButton = ({ text, color }: Props) => (
-
- send {text}
-
-);
diff --git a/src/containers/Contact/components/ContactFormSubmitted.tsx b/src/containers/Contact/components/ContactFormSubmitted.tsx
deleted file mode 100644
index 916e9e9..0000000
--- a/src/containers/Contact/components/ContactFormSubmitted.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-export const ContactFormSubmitted = () => (
-
-
-
Thank you for your message
-
-);
diff --git a/src/containers/Contact/components/ContactFormTextArea.tsx b/src/containers/Contact/components/ContactFormTextArea.tsx
deleted file mode 100644
index c4c6e6f..0000000
--- a/src/containers/Contact/components/ContactFormTextArea.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { ChangeEventHandler, Dispatch, FC, SetStateAction } from "react";
-
-type Props = {
- id: string;
- value: string;
- dispatch: Dispatch>;
-};
-
-export const ContactFormTextArea: FC = ({ id, value, dispatch }) => {
- const handleChange: ChangeEventHandler = (e) => {
- e.preventDefault();
- dispatch(e.target.value);
- };
-
- return (
-
- {id}
-
-
- );
-};
diff --git a/src/containers/Contact/index.tsx b/src/containers/Contact/index.tsx
deleted file mode 100644
index b0e1b1f..0000000
--- a/src/containers/Contact/index.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { useState } from "react";
-import PageLayout from "../../layouts/PageLayout";
-import { ContactForm } from "./components/ContactForm";
-import { ContactFormSubmitted } from "./components/ContactFormSubmitted";
-
-export const Contact = () => {
- const [isSubmitted, setIsSubmitted] = useState(false);
-
- return isSubmitted ? (
-
- ) : (
-
-
-
- );
-};
diff --git a/src/containers/Home/index.tsx b/src/containers/Home/index.tsx
deleted file mode 100644
index 3cbb354..0000000
--- a/src/containers/Home/index.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { RandomButton } from "../../components/RandomButton";
-import { buttonURL } from "../../constants";
-import HeroImage from "../../images/chef.svg";
-
-export const Home = () => (
-
-
-
-
Chef's Online Cookbook
-
-
-
-
-
-
-
-);
diff --git a/src/containers/Meal/components/MealIngredientList.tsx b/src/containers/Meal/components/MealIngredientList.tsx
deleted file mode 100644
index d87732f..0000000
--- a/src/containers/Meal/components/MealIngredientList.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-type Props = { ingredients: string[][] };
-
-export const MealIngredientList = ({ ingredients }: Props) => (
-
-
-
-
- Ingredient
- Quantity
-
-
-
- {ingredients.map((ing, i) => (
-
- {ing[0]}
- {ing[1]}
-
- ))}
-
-
-
-);
diff --git a/src/containers/Meal/components/MealPage.tsx b/src/containers/Meal/components/MealPage.tsx
deleted file mode 100644
index 231aff6..0000000
--- a/src/containers/Meal/components/MealPage.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { Meal } from "../../../types/meal";
-import { MealIngredientList } from "./MealIngredientList";
-import { MealPresentation } from "./MealPresentation";
-import { MealRecipe } from "./MealRecipe";
-
-type Props = {
- ingredients: string[][];
- recipe: string;
- meal: Meal;
-};
-
-export const MealPage = ({ meal, ingredients, recipe }: Props) => (
-
-);
diff --git a/src/containers/Meal/components/MealPresentation.tsx b/src/containers/Meal/components/MealPresentation.tsx
deleted file mode 100644
index 5b70ae2..0000000
--- a/src/containers/Meal/components/MealPresentation.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-import { Link } from "react-router-dom";
-import { Meal } from "../../../types/meal";
-
-type Props = {
- meal: Meal;
-};
-
-export const MealPresentation = ({
- meal: { mealName, imgAddress, videoAddress, mealCategory, mealArea },
-}: Props) => {
- return (
-
-
-
-
-
{mealName}
-
-
-
-
-
-
- );
-};
diff --git a/src/containers/Meal/components/MealRecipe.tsx b/src/containers/Meal/components/MealRecipe.tsx
deleted file mode 100644
index b73b7c0..0000000
--- a/src/containers/Meal/components/MealRecipe.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-type Props = { recipe: string };
-
-export const MealRecipe = ({ recipe }: Props) => (
-
-
-
Instructions
-
{recipe}
-
-);
diff --git a/src/containers/Meal/index.tsx b/src/containers/Meal/index.tsx
deleted file mode 100644
index 63d8d51..0000000
--- a/src/containers/Meal/index.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { useEffect } from "react";
-import { useParams } from "react-router-dom";
-import { useMeal } from "../../store/meal";
-import { fetchMeal, fetchRandomMeal } from "../../store/meal/async";
-import { NotFound } from "../NotFound";
-import { MealPage } from "./components/MealPage";
-import { buildIngredientList, buildMealProps } from "./service";
-
-export const Meal = () => {
- // hooks
- const { id } = useParams<{ id: string }>();
- const { state, dispatch } = useMeal();
- // variables
- const mealItem = state.meals?.[0];
- // effects
- /** Fetch meal from db */
- useEffect(() => {
- !id ? fetchRandomMeal(dispatch) : fetchMeal(dispatch, id);
- }, [id, dispatch]);
-
- const item = buildMealProps(mealItem);
- const ingredients = buildIngredientList(mealItem);
-
- return !!state.meals ? (
-
- ) : (
-
- );
-};
diff --git a/src/containers/Meal/service.ts b/src/containers/Meal/service.ts
deleted file mode 100644
index bdaeda4..0000000
--- a/src/containers/Meal/service.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { MealApi } from "../../types/meal";
-
-export const buildIngredientList = (mealItem: MealApi): string[][] => {
- let ingredients = [];
- for (let i = 1; i <= 20; i++) {
- let strIng = `strIngredient${i}`;
- let strMes = `strMeasure${i}`;
- // @ts-ignore
- if (!!mealItem?.[strIng] && !!mealItem?.[strIng]) {
- // @ts-ignore
- ingredients.push([mealItem?.[strIng], mealItem?.[strMes]]);
- }
- }
- return ingredients;
-};
-
-export const buildMealProps = (mealItem: MealApi) => ({
- mealName: mealItem?.strMeal,
- imgAddress: mealItem?.strMealThumb,
- videoAddress: mealItem?.strYoutube,
- mealCategory: mealItem?.strCategory,
- mealArea: mealItem?.strArea,
-});
diff --git a/src/containers/NotFound/index.tsx b/src/containers/NotFound/index.tsx
deleted file mode 100644
index 5819029..0000000
--- a/src/containers/NotFound/index.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { RandomButton } from "../../components/RandomButton";
-
-export const NotFound = () => (
-
-
-
Wrong Way!
-
-
-
-
-
-
-
-
-
-
-
-
-);
diff --git a/src/containers/Search/components/SearchPage.tsx b/src/containers/Search/components/SearchPage.tsx
deleted file mode 100644
index cbcf0a7..0000000
--- a/src/containers/Search/components/SearchPage.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import BreakfastImage from "../../../images/breakfast.svg";
-import PageLayout from "../../../layouts/PageLayout";
-import { MealSummary } from "../../../types/meal";
-import { SearchResult } from "./SearchResult";
-
-type Props = {
- searchString: string;
- searchResults: MealSummary[];
-};
-
-export const SearchPage = ({ searchString, searchResults }: Props) => (
-
- {!searchResults ? (
-
-
No results to display, instead there is a picture of my breakfast.
-
-
- ) : (
-
-
- {searchResults.map((meal, i) => (
-
- ))}
-
-
- )}
-
-);
diff --git a/src/containers/Search/components/SearchResult.tsx b/src/containers/Search/components/SearchResult.tsx
deleted file mode 100644
index 275f6c3..0000000
--- a/src/containers/Search/components/SearchResult.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import { CardEntry } from "../../../components/CardEntry";
-import { MealSummary } from "../../../types/meal";
-
-type Props = { meal: MealSummary };
-
-export const SearchResult = ({ meal }: Props) => ;
diff --git a/src/containers/Search/index.tsx b/src/containers/Search/index.tsx
deleted file mode 100644
index 7184e06..0000000
--- a/src/containers/Search/index.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { useMeal } from "../../store/meal";
-import { SearchPage } from "./components/SearchPage";
-
-export const Search = () => {
- const {
- state: { searchString, search },
- } = useMeal();
- return ;
-};
diff --git a/src/images/breakfast.svg b/src/images/breakfast.svg
deleted file mode 100644
index e4b25c7..0000000
--- a/src/images/breakfast.svg
+++ /dev/null
@@ -1 +0,0 @@
-breakfast
\ No newline at end of file
diff --git a/src/images/healthy_options.svg b/src/images/healthy_options.svg
deleted file mode 100644
index 5064089..0000000
--- a/src/images/healthy_options.svg
+++ /dev/null
@@ -1 +0,0 @@
-healthy_options
\ No newline at end of file
diff --git a/src/images/mail_sent.svg b/src/images/mail_sent.svg
deleted file mode 100644
index acf89b7..0000000
--- a/src/images/mail_sent.svg
+++ /dev/null
@@ -1 +0,0 @@
-Mail sent
\ No newline at end of file
diff --git a/src/images/special_event.svg b/src/images/special_event.svg
deleted file mode 100644
index 87e7873..0000000
--- a/src/images/special_event.svg
+++ /dev/null
@@ -1 +0,0 @@
-special_event
\ No newline at end of file
diff --git a/src/index.css b/src/index.css
deleted file mode 100644
index 077c41f..0000000
--- a/src/index.css
+++ /dev/null
@@ -1,34 +0,0 @@
-body {
- margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
- "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
- sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- display: flex;
- min-height: 100vh;
- flex-direction: column;
- background-color: #ffffff;
-}
-
-div {
- white-space: pre-wrap;
-}
-
-nav {
- background-color: #ffffff;
-}
-
-.page-footer {
- padding-top: 20px;
- color: #fff;
- background-color: #ffe0b2;
-}
-
-.logo {
- font-family: "Marck Script", cursive;
-}
-
-a>i.material-icons {
- color: #ff9800;
-}
\ No newline at end of file
diff --git a/src/index.jsx b/src/index.jsx
deleted file mode 100644
index 92bcfc6..0000000
--- a/src/index.jsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from "react";
-import ReactDOM from "react-dom";
-import "./index.css";
-import { App } from "./App";
-import * as serviceWorker from "./serviceWorker";
-import { AppProvider } from "./store/meal";
-
-ReactDOM.render(
-
-
- ,
- document.getElementById("root")
-);
-
-serviceWorker.register();
diff --git a/src/layouts/MainLayout.tsx b/src/layouts/MainLayout.tsx
deleted file mode 100644
index f56df50..0000000
--- a/src/layouts/MainLayout.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { FC, MouseEvent, MouseEventHandler, useState } from "react";
-import { Footer } from "../components/Footer";
-import { Navbar } from "../components/Navbar";
-import { SearchBar } from "../components/SearchBar";
-import { SideNav } from "../components/SideNav";
-
-const MainLayout: FC = ({ children }) => {
- const [showNav, setShowNav] = useState(false);
-
- const openNavClick: MouseEventHandler = (e) => {
- e.preventDefault();
- setShowNav(true);
- document.addEventListener("keydown", handleEscKey);
- };
-
- const closeNavClick = (e: MouseEvent) => {
- e.preventDefault();
- setShowNav(false);
- document.removeEventListener("keydown", handleEscKey);
- };
-
- const handleEscKey = ({ key }: KeyboardEvent) => {
- if (key === "Escape") {
- setShowNav(false);
- }
- };
-
- return (
- <>
-
- {children}
-
- >
- );
-};
-
-export default MainLayout;
diff --git a/src/layouts/PageLayout.tsx b/src/layouts/PageLayout.tsx
deleted file mode 100644
index 9360977..0000000
--- a/src/layouts/PageLayout.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { FC } from "react";
-
-type Props = { title: string };
-
-const PageLayout: FC = ({ title, children }) => (
-
-
{title}
- {children}
-
-);
-
-export default PageLayout;
diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts
deleted file mode 100644
index 6431bc5..0000000
--- a/src/react-app-env.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-///
diff --git a/src/router/AppRouter.tsx b/src/router/AppRouter.tsx
deleted file mode 100644
index 89bc010..0000000
--- a/src/router/AppRouter.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import { Redirect, Route, Switch } from "react-router-dom";
-import { buttonURL } from "../constants";
-import { Categories } from "../containers/Categories";
-import { Category } from "../containers/Category";
-import { Contact } from "../containers/Contact";
-import { Home } from "../containers/Home";
-import { Meal } from "../containers/Meal";
-import { NotFound } from "../containers/NotFound";
-import { Search } from "../containers/Search";
-
-export const AppRouter = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-);
diff --git a/src/router/Router.tsx b/src/router/Router.tsx
deleted file mode 100644
index 4653ffd..0000000
--- a/src/router/Router.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { FC, useEffect } from "react";
-import { Router as RouterOriginal, useLocation } from "react-router-dom";
-import history from "../utils/history";
-
-export const Router: FC = ({ children }) => (
-
-
- {children}
-
-);
-
-export const ScrollToTop: FC = () => {
- const location = useLocation();
- useEffect(() => {
- window.scrollTo(0, 0);
- }, [location.pathname]);
- return null;
-};
diff --git a/src/router/index.ts b/src/router/index.ts
deleted file mode 100644
index 20854ce..0000000
--- a/src/router/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { AppRouter } from "./AppRouter";
-export { Router } from "./Router";
diff --git a/src/serviceWorker.ts b/src/serviceWorker.ts
deleted file mode 100644
index d94c00e..0000000
--- a/src/serviceWorker.ts
+++ /dev/null
@@ -1,137 +0,0 @@
-// This optional code is used to register a service worker.
-// register() is not called by default.
-
-// This lets the app load faster on subsequent visits in production, and gives
-// it offline capabilities. However, it also means that developers (and users)
-// will only see deployed updates on subsequent visits to a page, after all the
-// existing tabs open on the page have been closed, since previously cached
-// resources are updated in the background.
-
-// To learn more about the benefits of this model and instructions on how to
-// opt-in, read https://bit.ly/CRA-PWA
-
-const isLocalhost = Boolean(
- window.location.hostname === "localhost" ||
- // [::1] is the IPv6 localhost address.
- window.location.hostname === "[::1]" ||
- // 127.0.0.0/8 are considered localhost for IPv4.
- window.location.hostname.match(
- /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
- )
-);
-
-export function register(config: any) {
- if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
- // The URL constructor is available in all browsers that support SW.
- const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
- if (publicUrl.origin !== window.location.origin) {
- // Our service worker won't work if PUBLIC_URL is on a different origin
- // from what our page is served on. This might happen if a CDN is used to
- // serve assets; see https://github.com/facebook/create-react-app/issues/2374
- return;
- }
-
- window.addEventListener("load", () => {
- const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
-
- if (isLocalhost) {
- // This is running on localhost. Let's check if a service worker still exists or not.
- checkValidServiceWorker(swUrl, config);
-
- // Add some additional logging to localhost, pointing developers to the
- // service worker/PWA documentation.
- navigator.serviceWorker.ready.then(() => {
- console.log(
- "This web app is being served cache-first by a service " +
- "worker. To learn more, visit https://bit.ly/CRA-PWA"
- );
- });
- } else {
- // Is not localhost. Just register service worker
- registerValidSW(swUrl, config);
- }
- });
- }
-}
-
-function registerValidSW(swUrl: any, config: any) {
- navigator.serviceWorker
- .register(swUrl)
- .then((registration) => {
- registration.onupdatefound = () => {
- const installingWorker = registration.installing;
- if (installingWorker == null) {
- return;
- }
- installingWorker.onstatechange = () => {
- if (installingWorker.state === "installed") {
- if (navigator.serviceWorker.controller) {
- // At this point, the updated precached content has been fetched,
- // but the previous service worker will still serve the older
- // content until all client tabs are closed.
- console.log(
- "New content is available and will be used when all " +
- "tabs for this page are closed. See https://bit.ly/CRA-PWA."
- );
-
- // Execute callback
- if (config && config.onUpdate) {
- config.onUpdate(registration);
- }
- } else {
- // At this point, everything has been precached.
- // It's the perfect time to display a
- // "Content is cached for offline use." message.
- console.log("Content is cached for offline use.");
-
- // Execute callback
- if (config && config.onSuccess) {
- config.onSuccess(registration);
- }
- }
- }
- };
- };
- })
- .catch((error) => {
- console.error("Error during service worker registration:", error);
- });
-}
-
-function checkValidServiceWorker(swUrl: any, config: any) {
- // Check if the service worker can be found. If it can't reload the page.
- fetch(swUrl, {
- headers: { "Service-Worker": "script" },
- })
- .then((response) => {
- // Ensure service worker exists, and that we really are getting a JS file.
- const contentType = response.headers.get("content-type");
- if (
- response.status === 404 ||
- (contentType != null && contentType.indexOf("javascript") === -1)
- ) {
- // No service worker found. Probably a different app. Reload the page.
- navigator.serviceWorker.ready.then((registration) => {
- registration.unregister().then(() => {
- window.location.reload();
- });
- });
- } else {
- // Service worker found. Proceed as normal.
- registerValidSW(swUrl, config);
- }
- })
- .catch(() => {
- console.log(
- "No internet connection found. App is running in offline mode."
- );
- });
-}
-
-export function unregister() {
- if ("serviceWorker" in navigator) {
- navigator.serviceWorker.ready.then((registration) => {
- registration.unregister();
- });
- }
-}
diff --git a/src/services/api.ts b/src/services/api.ts
deleted file mode 100644
index 53579a6..0000000
--- a/src/services/api.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { apiRoot } from "../constants";
-
-type Option = "filter" | "lookup" | "search";
-
-const createURI = (keyword: string, option?: Option) => {
- if (!option) {
- return `${apiRoot}${keyword}.php`;
- }
-
- switch (option) {
- case "filter": {
- return `${apiRoot}${option}.php?c=${keyword}`;
- }
- case "lookup": {
- return `${apiRoot}${option}.php?i=${keyword}`;
- }
- case "search": {
- return `${apiRoot}${option}.php?s=${keyword}`;
- }
- default: {
- throw Error("Unexpected URI");
- }
- }
-};
-
-export const getData = async (keyword: string, option?: Option) => {
- const URI = createURI(keyword, option);
-
- try {
- const response = await fetch(URI);
- return await response.json();
- } catch (error) {
- return console.warn(error + "url:" + URI);
- }
-};
diff --git a/src/setupTests.ts b/src/setupTests.ts
deleted file mode 100644
index 6a69409..0000000
--- a/src/setupTests.ts
+++ /dev/null
@@ -1 +0,0 @@
-import "@testing-library/jest-dom/extend-expect";
diff --git a/src/store/meal/async.ts b/src/store/meal/async.ts
deleted file mode 100644
index ab67f91..0000000
--- a/src/store/meal/async.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { getData } from "../../services/api";
-import { Dispatch } from "./reducer";
-
-export const fetchRandomMeal = async (dispatch: Dispatch) => {
- const meal = await getData("random");
- dispatch({ type: "setMeal", payload: meal?.meals });
-};
-
-export const fetchMeal = async (dispatch: Dispatch, id: string) => {
- const meal = await getData(id, "lookup");
- dispatch({ type: "setMeal", payload: meal?.meals });
-};
-
-export const fetchSearchResults = async (
- dispatch: Dispatch,
- searchString: string
-) => {
- const meals = await getData(searchString, "search");
- dispatch({
- type: "setSearchResults",
- payload: { search: meals?.meals, searchString },
- });
-};
diff --git a/src/store/meal/index.tsx b/src/store/meal/index.tsx
deleted file mode 100644
index 9e2a068..0000000
--- a/src/store/meal/index.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-//https://kentcdodds.com/blog/how-to-use-react-context-effectively
-
-import { createContext, FC, useContext, useReducer } from "react";
-import { MealApi, MealSummary } from "../../types/meal";
-import { appReducer, Dispatch } from "./reducer";
-
-export type AppState = {
- meals: MealApi[];
- search: MealSummary[];
- searchString: string;
-};
-
-const initState = {
- meals: [] as MealApi[],
- search: [] as MealSummary[],
- searchString: "",
-};
-
-type ContextType = { state: AppState; dispatch: Dispatch } | undefined;
-
-const AppContext = createContext(undefined);
-
-export const useMeal = () => {
- const context = useContext(AppContext);
- if (!context) {
- throw new Error("useMeal must be used within a AppProvider");
- }
- return context;
-};
-
-export const AppProvider: FC = ({ children }) => {
- const [state, dispatch] = useReducer(appReducer, initState);
- const value = { state, dispatch };
- return {children} ;
-};
diff --git a/src/store/meal/reducer.ts b/src/store/meal/reducer.ts
deleted file mode 100644
index 84d850c..0000000
--- a/src/store/meal/reducer.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { MealSummary } from "../../types/meal";
-import { AppState } from "./index";
-
-export const appReducer = (state: AppState, action: Action) => {
- switch (action.type) {
- case "setMeal":
- return { ...state, meals: action.payload };
- case "setSearchResults":
- return {
- ...state,
- search: action.payload.search,
- searchString: action.payload.searchString,
- };
- case "clearSearchResults":
- return { ...state, search: [] as MealSummary[] };
- default: {
- throw new Error(`Unhandled action type: ${action.type}`);
- }
- }
-};
-
-export type Action = {
- payload?: any;
- type: "setMeal" | "setSearchResults" | "clearSearchResults";
-};
-
-export type Dispatch = (action: Action) => void;
diff --git a/src/types/meal.ts b/src/types/meal.ts
deleted file mode 100644
index 9382266..0000000
--- a/src/types/meal.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-export interface Meal {
- mealName: string;
- imgAddress: string;
- videoAddress: string;
- mealCategory: string;
- mealArea: string;
- isFav?: boolean;
-}
-
-export interface MealSummary {
- idMeal: string;
- strMeal: string;
- strMealThumb: string;
-}
-
-export interface MealApi {
- idMeal: string;
- strMeal: string;
- strMealThumb: string;
- strYoutube: string;
- strCategory: string;
- strArea: string;
- strInstructions: string;
-}
diff --git a/src/utils/history.js b/src/utils/history.js
deleted file mode 100644
index 2724b5b..0000000
--- a/src/utils/history.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import { createBrowserHistory } from "history";
-export default createBrowserHistory();
diff --git a/src/utils/mail.js b/src/utils/mail.js
deleted file mode 100644
index 55041c6..0000000
--- a/src/utils/mail.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// This must be set on the server using or firebase functions
-import { createTransport } from "nodemailer";
-import { mailAdress, mailPassword } from "./secret";
-
-const myMail = mailAdress;
-const myPass = mailPassword;
-
-const handleMail = (mailTo, subject, text) => {
- let transporter = createTransport({
- service: "gmail",
- auth: {
- user: myMail,
- pass: myPass,
- },
- });
-
- let mailOptions = {
- from: myMail,
- to: mailTo,
- subject: subject,
- text: text,
- };
-
- transporter.sendMail(mailOptions, function (error, info) {
- if (error) {
- console.log(error);
- } else {
- console.log("Email sent: " + info.response);
- }
- });
-};
-
-export const confirmationMail = (
- mailTo,
- subject = "Your message has been sent",
- text = "Thanks for your message. We'll reply you soon."
-) => {
- handleMail(mailTo, subject, text);
-};
-
-export const notificationMail = (mailTo = myMail, subject, text) => {
- handleMail(mailTo, subject, text);
-};
diff --git a/src/utils/string.ts b/src/utils/string.ts
deleted file mode 100644
index 271e0a0..0000000
--- a/src/utils/string.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export const upFirstChar = (lower: string): string =>
- lower.replace(/^\w/, (c) => c.toUpperCase());