Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create an add rest page. #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/components/ApplicationViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { SingleReview } from "./review/SingleReview";
import { ReviewRestaurants } from "./review/ReviewRestaurants";
import { ReviewMenuItems } from "./review/ReviewMenuItems";
import { Review } from "./review/Review";
import { AddRest } from "./review/AddRest"

export const ApplicationViews = () => {
return (
Expand All @@ -34,6 +35,7 @@ export const ApplicationViews = () => {
/>

<ReviewProvider>

<Route
exact
path="/review/menuitem/:menuitemId"
Expand All @@ -57,14 +59,14 @@ export const ApplicationViews = () => {
}}
/>

<Route

<Route
exact
path="/review/restaurants/:restaurantId"
path="/review/restaurants/create"
render={(props) => {
return <ReviewMenuItems {...props} />;
return <AddRest {...props} />;
}}
/>

<Route
exact
path="/reviews"
Expand All @@ -79,6 +81,13 @@ export const ApplicationViews = () => {
return <SingleReview {...props} />;
}}
/>
<Route
exact
path="/review/menuItems/:restaurantId"
render={(props) => {
return <ReviewMenuItems {...props} />;
}}
/>
</ReviewProvider>
</ProfileProvider>
</>
Expand Down
9 changes: 9 additions & 0 deletions src/components/review/AddRest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

export const AddRest = () => {
return (
<div>
<h1>hello</h1>
</div>
);
}
4 changes: 3 additions & 1 deletion src/components/review/ReviewRestaurants.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export const ReviewRestaurants = (props) => {
}, []);
console.log("these are rests", restaurants);
return (

<div className="restaurant-list text-center justify-center align-items-center ">

<h1>Please select a restaurant:</h1>
<Tooltip title="back" aria-label="back">
<Fab size="small" href="/reviews" color="primary" aria-label="back">
Expand All @@ -52,7 +54,7 @@ export const ReviewRestaurants = (props) => {
{restaurants && restaurants.length > 0
? restaurants.map((restaurant) => (
<Button
href={`/review/restaurants/${restaurant.id}`}
href={`/review/menuItems/${restaurant.id}`}
variant="outlined"
className="button-menu-item"
>
Expand Down
8 changes: 6 additions & 2 deletions src/components/review/Reviews.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { React, useContext, useEffect } from "react";
import { React, useContext, useEffect, useState } from "react";
import { ReviewContext } from "./ReviewProvider";

import { Card, Button } from "react-bootstrap";
Expand All @@ -15,6 +15,10 @@ import "./review.css";

export const Reviews = (props) => {
const { reviews, getReviewsByUserId } = useContext(ReviewContext);
const [show, setShow] = useState(false);

const handleClose = () => setShow(false);
const handleShow = () => setShow(true);

useEffect(() => {
const userId = localStorage.getItem("user_id");
Expand All @@ -38,7 +42,7 @@ export const Reviews = (props) => {
color="primary"
aria-label="add"
>
<AddIcon />
<AddIcon/>
</Fab>
</Tooltip>
<Tooltip title="back" aria-label="back">
Expand Down