home screen changes (info button, appstore and google play buttons)

This commit is contained in:
2020-10-21 19:54:51 +02:00
parent e488827335
commit f5f758dbdc
11 changed files with 208 additions and 68 deletions

View File

@@ -24,6 +24,7 @@ import EditRestaurant from "./components/Dialogs/EditRestaurant";
import NewDish from "./components/Dialogs/NewDish"; import NewDish from "./components/Dialogs/NewDish";
import EditDish from "./components/Dialogs/EditDish"; import EditDish from "./components/Dialogs/EditDish";
import Dish from "./components/Dialogs/Dish"; import Dish from "./components/Dialogs/Dish";
import HomeScreen from "./components/Output/HomeScreen";
const theme = createMuiTheme({ const theme = createMuiTheme({
palette: { palette: {
@@ -57,11 +58,7 @@ function App(props) {
<div className="main-container"> <div className="main-container">
<Switch> <Switch>
<Route exact path="/"> <Route exact path="/">
<LogoMain /> <HomeScreen/>
<SearchPanel />
<p className="darkParagraph">
Sprawdź co serwuje Twoja ulubiona restauracja.
</p>
</Route> </Route>
<Route path="/results"> <Route path="/results">
<LogoMain /> <LogoMain />

View File

@@ -10,6 +10,7 @@
@import "./styles/NewRestaurant.scss"; @import "./styles/NewRestaurant.scss";
@import "./styles/EditRestaurant.scss"; @import "./styles/EditRestaurant.scss";
@import "./styles/Dish.scss"; @import "./styles/Dish.scss";
@import "./styles/Home.scss";
.App { .App {
background-image: url("./public/bg_tile.jpg"); background-image: url("./public/bg_tile.jpg");

View File

@@ -24,8 +24,12 @@ import { useSelector, useDispatch } from "react-redux";
import { notification, refreshUserData } from "../../actions"; import { notification, refreshUserData } from "../../actions";
import { showBackdrop, hideBackdrop } from "../../actions/toggles.js"; import { showBackdrop, hideBackdrop } from "../../actions/toggles.js";
import InputWorkingHours from "../Input/InputWorkingHours"; import InputWorkingHours from "../Input/InputWorkingHours";
import InputWorkingHoursSingle from "../Input/InputWorkingHoursSingle"; import InputLunchMenuHours from "../Input/InputLunchMenuHours";
import { backend } from "../../config"; import { backend, restaurantTypes } from "../../config";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import InputLabel from "@material-ui/core/InputLabel";
// ICONS // ICONS
import FastfoodIcon from "@material-ui/icons/Fastfood"; import FastfoodIcon from "@material-ui/icons/Fastfood";
import LocationCityIcon from "@material-ui/icons/LocationCity"; import LocationCityIcon from "@material-ui/icons/LocationCity";
@@ -84,6 +88,24 @@ const useStyles = makeStyles((theme) => ({
color: "#bbbbbb", color: "#bbbbbb",
}, },
}, },
formControl: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
minWidth: 100,
maxHeight: 400,
"& .MuiInputBase-root": {
color: "#bbbbbb",
},
"$ .MuiSelect-root": {
color: "#bbbbbb",
},
"& .MuiInputLabel-root": {
color: "#bbbbbb",
},
},
selectEmpty: {
marginTop: theme.spacing(2),
},
})); }));
export default function NewRestaurant() { export default function NewRestaurant() {
@@ -97,7 +119,7 @@ export default function NewRestaurant() {
adress: "", adress: "",
coordinates: [52.354293, 19.42377], coordinates: [52.354293, 19.42377],
placesId: "", placesId: "",
type: "", type: "polska",
imgUrl: "", imgUrl: "",
workingHours: { workingHours: {
pn: "8:00 - 22:00", pn: "8:00 - 22:00",
@@ -121,7 +143,6 @@ export default function NewRestaurant() {
cityError: false, cityError: false,
adressError: false, adressError: false,
descriptionError: false, descriptionError: false,
typeError: false,
charLeft: 400, charLeft: 400,
}; };
const steps = ["Informacje", "Zdjęcie", "Lokalizacja"]; const steps = ["Informacje", "Zdjęcie", "Lokalizacja"];
@@ -140,6 +161,10 @@ export default function NewRestaurant() {
const history = useHistory(); const history = useHistory();
const token = useSelector((state) => state.data.userData.jwt); const token = useSelector((state) => state.data.userData.jwt);
const availableTypes = restaurantTypes.map((type) => {
return <MenuItem key={type} value={type}>{type}</MenuItem>
});
// HANDLERS // HANDLERS
const sendForm = () => { const sendForm = () => {
@@ -244,7 +269,6 @@ export default function NewRestaurant() {
nameValid: validator.isLength(state.name, { min: 1, max: 40 }), nameValid: validator.isLength(state.name, { min: 1, max: 40 }),
cityValid: validator.isLength(state.city, { min: 1, max: 40 }), cityValid: validator.isLength(state.city, { min: 1, max: 40 }),
adressValid: validator.isLength(state.name, { min: 1, max: 40 }), adressValid: validator.isLength(state.name, { min: 1, max: 40 }),
typeValid: validator.isLength(state.type, { min: 1, max: 40 }),
descriptionValid: validator.isLength(state.description, { descriptionValid: validator.isLength(state.description, {
min: 1, min: 1,
max: 400, max: 400,
@@ -254,7 +278,6 @@ export default function NewRestaurant() {
...state, ...state,
nameError: !validation.nameValid, nameError: !validation.nameValid,
cityError: !validation.cityValid, cityError: !validation.cityValid,
typeError: !validation.typeValid,
adressError: !validation.adressValid, adressError: !validation.adressValid,
descriptionError: !validation.descriptionValid, descriptionError: !validation.descriptionValid,
}); });
@@ -263,8 +286,7 @@ export default function NewRestaurant() {
validation.nameValid && validation.nameValid &&
validation.cityValid && validation.cityValid &&
validation.adressValid && validation.adressValid &&
validation.descriptionValid && validation.descriptionValid
validation.typeValid
); );
}; };
@@ -320,25 +342,23 @@ export default function NewRestaurant() {
/> />
</div> </div>
<div className="newRestaurant-content-fullwidth"> <div className="newRestaurant-content-fullwidth">
<TextField <FormControl
className={styles.textInputFullWidth} variant="outlined"
fullWidth required
fullWidth
className={styles.formControl}
>
<InputLabel id="category-select">Kuchnia</InputLabel>
<Select
labelId="category-select"
id="category"
value={state.type} value={state.type}
error={state.typeError} required
label="Kuchnia" onChange={(event) => setState({ ...state, type: event.target.value })}
placeholder="np. Meksykańska" >
variant="outlined" {availableTypes}
onChange={(event) => </Select>
setState({ ...state, type: event.target.value }) </FormControl>
}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<FastfoodIcon color="primary" />
</InputAdornment>
),
}}
/>
</div> </div>
<div className="newRestaurant-content"> <div className="newRestaurant-content">
<TextField <TextField
@@ -387,7 +407,7 @@ export default function NewRestaurant() {
/> />
<div className="newRestaurant-content-fullwidth"> <div className="newRestaurant-content-fullwidth">
<div className="workingHours-container" style={{ marginTop: 14 }}> <div className="workingHours-container" style={{ marginTop: 14 }}>
<InputWorkingHoursSingle nieczynne={!state.lunchHours} hours={state.lunchHours} changeValue={(value) => setLunchHours(value)} day="Lunch hours" /></div> <InputLunchMenuHours nieczynne={!state.lunchHours} hours={state.lunchHours} changeValue={(value) => setLunchHours(value)}/></div>
</div> </div>
<div className="newRestaurant-content-fullwidth"> <div className="newRestaurant-content-fullwidth">
<TextField <TextField

View File

@@ -13,7 +13,6 @@ import InstagramIcon from "@material-ui/icons/Instagram";
import LanguageIcon from "@material-ui/icons/Language"; import LanguageIcon from "@material-ui/icons/Language";
import FastfoodIcon from "@material-ui/icons/Fastfood"; import FastfoodIcon from "@material-ui/icons/Fastfood";
import LocationCityIcon from "@material-ui/icons/LocationCity"; import LocationCityIcon from "@material-ui/icons/LocationCity";
import InputWorkingHoursSingle from "../Input/InputWorkingHoursSingle";
import Divider from "@material-ui/core/Divider"; import Divider from "@material-ui/core/Divider";
import Link from "@material-ui/core/Link"; import Link from "@material-ui/core/Link";
import { decodeTags } from "../../Services"; import { decodeTags } from "../../Services";
@@ -24,8 +23,12 @@ import { showBackdrop, hideBackdrop } from "../../actions/toggles.js";
import { prepareTags } from "../../Services.js"; import { prepareTags } from "../../Services.js";
import axios from "axios"; import axios from "axios";
import PasswordConfirmation from "../Dialogs/PasswordConfirmation"; import PasswordConfirmation from "../Dialogs/PasswordConfirmation";
import { backend } from "../../config"; import { backend, restaurantTypes } from "../../config";
import InputLunchMenuHours from "../Input/InputLunchMenuHours"; import InputLunchMenuHours from "../Input/InputLunchMenuHours";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import InputLabel from "@material-ui/core/InputLabel";
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
textInput: { textInput: {
@@ -53,6 +56,24 @@ const useStyles = makeStyles((theme) => ({
link: { link: {
cursor: "pointer", cursor: "pointer",
}, },
formControl: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
minWidth: 100,
maxHeight: 400,
"& .MuiInputBase-root": {
color: "#bbbbbb",
},
"$ .MuiSelect-root": {
color: "#bbbbbb",
},
"& .MuiInputLabel-root": {
color: "#bbbbbb",
},
},
selectEmpty: {
marginTop: theme.spacing(2),
},
})); }));
const calculateCharLeft = (from) => { const calculateCharLeft = (from) => {
@@ -130,6 +151,10 @@ export default function EditRestaurantInfo(props) {
); );
}; };
const availableTypes = restaurantTypes.map((type) => {
return <MenuItem key={type} value={type}>{type}</MenuItem>
});
const cancelChanges = () => { const cancelChanges = () => {
setState(initialState); setState(initialState);
}; };
@@ -243,28 +268,24 @@ export default function EditRestaurantInfo(props) {
/> />
</div> </div>
<div className="editRestaurant-fullWidth"> <div className="editRestaurant-fullWidth">
<TextField <FormControl
className={styles.textInputFullWidth} variant="outlined"
fullWidth required
value={state.type} fullWidth
error={state.typeError} className={styles.formControl}
onChange={(event) => >
setState({ ...state, type: event.target.value }) <InputLabel id="category-select">Kuchnia</InputLabel>
} <Select
InputLabelProps={{ shrink: true }} labelId="category-select"
InputProps={{ id="category"
startAdornment: ( value={state.type}
<InputAdornment position="start"> required
<FastfoodIcon color="primary" /> onChange={(event) => setState({ ...state, type: event.target.value })}
</InputAdornment> >
), {availableTypes}
}} </Select>
label="Kuchnia" </FormControl>
placeholder="np. Meksykańska"
variant="outlined"
/>
</div> </div>
<TextField <TextField
className={styles.textInput} className={styles.textInput}
value={state.city} value={state.city}
@@ -341,10 +362,6 @@ export default function EditRestaurantInfo(props) {
setHours={(hours) => setState({ ...state, workingHours: hours })} setHours={(hours) => setState({ ...state, workingHours: hours })}
hours={state.workingHours} hours={state.workingHours}
/> />
<div className="newRestaurant-content-fullwidth">
<div className="workingHours-container" style={{ marginTop: 14 }}>
<InputWorkingHoursSingle nieczynne={!state.lunchHours} hours={state.lunchHours} changeValue={(value) => setLunchHours(value)} day="Lunch hours" /></div>
</div>
<div className="editRestaurant-sectiontitle"> <div className="editRestaurant-sectiontitle">
<h4>Dane kontaktowe</h4> <h4>Dane kontaktowe</h4>
<Divider /> <Divider />
@@ -427,9 +444,9 @@ export default function EditRestaurantInfo(props) {
<h4>Lunch menu</h4> <h4>Lunch menu</h4>
<Divider /> <Divider />
<InputLunchMenuHours <InputLunchMenuHours
off={!state.lunchHours} nieczynne={!state.lunchHours}
hours={state.lunchHours} hours={state.lunchHours}
changeValue={(value) => setState({ ...state, lunchHours: value })} changeValue={setLunchHours}
/> />
</div> </div>
<div className="editRestaurant-sectiontitle"> <div className="editRestaurant-sectiontitle">

View File

@@ -27,17 +27,17 @@ export default function InputWorkingHoursSingle(props) {
props.changeValue(event.target.value); props.changeValue(event.target.value);
}; };
const handleCheckbox = () => { const handleCheckbox = () => {
if (!props.off) { if (!props.nieczynne) {
props.changeValue(""); props.changeValue("");
} else { } else {
props.changeValue("13:00 - 15:00"); props.changeValue("12:30 - 13:30");
} }
}; };
const classes = useStyles(); const classes = useStyles();
return ( return (
<div className="workingHours-day"> <div className="workingHours-day">
<h5>Lunch menu</h5> <h5>Lunch hours</h5>
<TextField <TextField
value={props.hours} value={props.hours}
variant="outlined" variant="outlined"
@@ -48,9 +48,13 @@ export default function InputWorkingHoursSingle(props) {
<FormControlLabel <FormControlLabel
className={classes.checkbox} className={classes.checkbox}
control={ control={
<Checkbox onClick={handleCheckbox} checked={props.off} name="brak" /> <Checkbox
onClick={handleCheckbox}
checked={props.nieczynne}
name="nieczynne"
/>
} }
label="Wyłącz" label="Brak"
/> />
</div> </div>
); );

View File

@@ -0,0 +1,29 @@
import React from 'react';
import LogoMain from "../Output/logoMain";
import SearchPanel from "../Input/SearchPanel";
import HelpIcon from '@material-ui/icons/Help';
import appstore from "../../public/appstore.png";
import googleplay from "../../public/googleplay.png";
export default function HomeScreen() {
return <div className="hs">
<div className="hs-top">
<h5>Dowiedz się czym właściwie jest Menui</h5>
<div className="hs-top-icon"><HelpIcon/></div>
</div>
<div className="hs-center">
<LogoMain />
<SearchPanel />
<p className="darkParagraph">
Sprawdź co serwuje Twoja ulubiona restauracja.
</p>
</div>
<div className="hs-bottom">
<h4>Pobierz na telefon</h4>
<div>
<img className="hs-bottom-icon" src={appstore} alt="Get Menui from App Store" />
<img className="hs-bottom-icon" src={googleplay} alt="Get Menui from Google Play"/>
</div>
</div>
</div>
}

View File

@@ -1 +1,37 @@
export const backend = "https://menui.azurewebsites.net/"; export const backend = "https://menui.azurewebsites.net/";
export const restaurantTypes = [
"afrykańska",
"arabska",
"bałkańska",
"belgijska",
"brytyjska",
"chińska",
"chorwacka",
"czeska",
"dietetyczna",
"francuska",
"grecka",
"gruzińska",
"hiszpańska",
"indyjska",
"irlandzka",
"japońska",
"koreańska",
"koszerna",
"meksykańska",
"międzynarodowa",
"polska",
"rosyjska",
"skandynawska",
"śródziemnomorska",
"tajska",
"turecka",
"ukraińska",
"węgierska",
"wietnamska",
"włoska",
"żydowska",
"mieszane",
"inna",
];

View File

@@ -20,7 +20,7 @@ const store = createStore(
rootReducer(history), rootReducer(history),
compose( compose(
applyMiddleware(routerMiddleware(history), thunk), applyMiddleware(routerMiddleware(history), thunk),
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() : f => f
) )
); );

BIN
src/public/appstore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
src/public/googleplay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

36
src/styles/Home.scss Normal file
View File

@@ -0,0 +1,36 @@
.hs {
height: 100%;
display: flex;
flex-flow: column;
justify-content: space-around;
align-items: center;
}
.hs-top {
display: flex;
cursor: pointer;
width: fit-content;
justify-content: center;
background-color: rgba(0, 0, 0, 0.315);
color: rgb(184, 184, 184);
border-radius: 8px;
h5 {
font-weight: 500;
margin-left: 18px;
}
transition: background-color 0.2s;
}
.hs-top:hover {
background-color: rgba(71, 71, 71, 0.315);
}
.hs-top-icon {
margin: 18px;
}
.hs-bottom-icon {
height: 3rem;
margin: 10px;
cursor: pointer;
}