web client v 0.1
This commit is contained in:
75
src/App.js
75
src/App.js
@@ -1,4 +1,5 @@
|
||||
import React from "react";
|
||||
import { Router, Switch, Route } from "react-router-dom";
|
||||
import "./App.scss";
|
||||
import TopBar from "./components/TopBar";
|
||||
import LogoMain from "./components/Output/logoMain";
|
||||
@@ -8,7 +9,11 @@ import SearchResults from "./components/Output/SearchResults";
|
||||
import Restaurant from "./components/Output/Restaurant";
|
||||
import Dialogs from "./components/Dialogs";
|
||||
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
|
||||
import { useSelector } from "react-redux";
|
||||
import LoginDialog from "./components/Dialogs/LoginDialog";
|
||||
import NewRestaurant from "./components/Dialogs/NewRestaurant";
|
||||
import RegisterDialog from "./components/Dialogs/RegisterDialog";
|
||||
import ForgotPassword from "./components/Dialogs/ForgotPassword";
|
||||
import ResetPassword from "./components/Dialogs/ResetPassword";
|
||||
|
||||
const theme = createMuiTheme({
|
||||
palette: {
|
||||
@@ -24,30 +29,54 @@ const theme = createMuiTheme({
|
||||
},
|
||||
});
|
||||
|
||||
function App() {
|
||||
const appMode = useSelector((store) => store.appMode);
|
||||
|
||||
function App(props) {
|
||||
return (
|
||||
<ThemeProvider theme={theme}>
|
||||
<div className="App">
|
||||
<TopBar />
|
||||
<div className="main-container">
|
||||
<LogoMain />
|
||||
{(appMode === "init" || appMode === "search results") && (
|
||||
<SearchPanel />
|
||||
)}
|
||||
{appMode === "init" && (
|
||||
<p className="darkParagraph">
|
||||
Sprawdź co serwuje Twoja ulubiona restauracja.
|
||||
</p>
|
||||
)}
|
||||
{appMode === "search results" && <SearchResults />}
|
||||
{appMode === "restaurant" && <Restaurant />}
|
||||
<Router history={props.history}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<div className="App">
|
||||
<TopBar />
|
||||
<div className="main-container">
|
||||
<Switch>
|
||||
<Route exact path="/">
|
||||
<LogoMain />
|
||||
<SearchPanel />
|
||||
<p className="darkParagraph">
|
||||
Sprawdź co serwuje Twoja ulubiona restauracja.
|
||||
</p>
|
||||
</Route>
|
||||
<Route path="/results">
|
||||
<LogoMain />
|
||||
<SearchPanel />
|
||||
<SearchResults />
|
||||
</Route>
|
||||
<Route path="/restaurant">
|
||||
<Restaurant />
|
||||
</Route>
|
||||
<Route path="/dish">
|
||||
<LogoMain />
|
||||
</Route>
|
||||
<Route path="/login">
|
||||
<LoginDialog />
|
||||
</Route>
|
||||
<Route path="/register">
|
||||
<RegisterDialog />
|
||||
</Route>
|
||||
<Route path="/newRestaurant">
|
||||
<NewRestaurant />
|
||||
</Route>
|
||||
<Route path="/forgotpassword">
|
||||
<ForgotPassword />
|
||||
</Route>
|
||||
<Route path="/resetpassword">
|
||||
<ResetPassword />
|
||||
</Route>
|
||||
</Switch>
|
||||
</div>
|
||||
<Dialogs />
|
||||
<Footer />
|
||||
</div>
|
||||
<Dialogs />
|
||||
<Footer />
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
</ThemeProvider>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user