diff --git a/TODO.md b/TODO.md index 85bd842..04dd657 100644 --- a/TODO.md +++ b/TODO.md @@ -1,11 +1,14 @@ # TO DO - [ ] send message after contact form validation (confirm to sender and msg+info to admin) -- [ ] Local storage of prefeernces -- [ ] Firebase +- [ ] Local storage of preferences +- [ ] Firebase firestore and functions - [ ] Breadcrumb - [ ] Cookie bar - [ ] code cleanup (props and refactoring) - [ ] Back to top button - [ ] Close Sidebar at outside click - [ ] Take a look at some components [here](http://react-materialize.github.io/react-materialize/?path=/story/css-grid--default) +- [ ] Decoupled application and data layers. Abstract such that the front end does not know where the data comes from. +- [ ] Create PageLayout component +- [ ] Use Css-in-Js diff --git a/src/App.jsx b/src/App.jsx index cf4f725..d98e9cb 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,24 +1,15 @@ import React, { useState } from "react"; import { Router } from "./utils/router"; -import { Switch, Route, Redirect } from "react-router-dom"; + +import { PreLoader } from "./components/PreLoader"; + import { useAuth0 } from "./utils/auth0-spa"; -import { SearchController } from "./controllers/SearchController"; -import { ContactPage } from "./pages/Contact"; -import { NotFoundPage } from "./pages/NotFoundPage"; -import { Navbar } from "./components/Navbar"; -import { SearchBar } from "./components/SearchBar"; -import { Footer } from "./components/Footer"; import { getData } from "./utils/methods"; import history from "./utils/history"; -import { ProfileController } from "./controllers/ProfileController"; -import { PrivateRoute } from "./components/PrivateRoute"; -import { PreLoader } from "./components/PreLoader"; -import { SideNav } from "./components/SideNav"; + import "./index.css"; -import { HomeController } from "./controllers/HomeController"; -import { MealController } from "./controllers/MealController"; -import { CategoryListController } from "./controllers/CategoryListController"; -import { CategoryController } from "./controllers/CategoryController"; +import MainLayout from "./layouts/MainLayout"; +import MainRouter from "./controllers/MainRouter"; export const App = () => { const { loading } = useAuth0(); @@ -85,6 +76,7 @@ export const App = () => { }, ], }; + const [meal, setMeal] = useState(mealDef); const getMeal = (id) => { @@ -108,114 +100,33 @@ export const App = () => { const buttonUrl = "/random"; - const [showNav, setShowNav] = useState(false); - const openNavClick = (ev) => { - ev.preventDefault(); - setShowNav(true); - document.addEventListener("keydown", handleEscKey); - // document.addEventListener("click", handleOutsideClick); - }; - const closeNavClick = (ev) => { - ev.preventDefault(); - setShowNav(false); - document.removeEventListener("keydown", handleEscKey); - }; - const handleEscKey = (ev) => { - if (ev.key === "Escape") { - setShowNav(false); - } - }; - // const handleOutsideClick = ev => { - // console.log(ev); - // }; - - const links = ["categories", "contact"]; - return loading ? (