diff --git a/client/src/App.js b/client/src/App.js index 1979dcb..0be633a 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,5 +1,5 @@ import './App.css'; -import React from 'react'; +import React, {useState} from 'react'; import { Routes, Route, HashRouter } from 'react-router-dom'; import Menu from './pages/menu'; @@ -13,6 +13,31 @@ import Landing_page from './pages/landing-page'; import WebSocketService from './WebSocketService'; function App() { + + const [restaurantInfo, setRestaurantInfo] = useState({ + name: "115A's Diner", + description:`Welcome to 115A's Diner, where passion meets flavor! Our journey began with a simple + idea: to create a dining experience that combines the warmth of home-cooked meals with + the excitement of culinary innovation. At 115A's Diner, we source the finest ingredients + to craft delicious dishes that cater to every palate. Whether you're a fan of classic + comfort food or crave bold and adventurous flavors, our menu has something special for you. + Join us on this gastronomic journey and savor the moments at 115A's Diner. We look + forward to serving you with a smile and creating memories that last a lifetime.`, + instagramLink: "https://www.instagram.com/your_instagram", + facebookLink: "https://www.facebook.com/your_facebook", + twitterLink: "https://twitter.com/your_twitter", + }); + const [isSaved, setIsSaved] = useState(false); + + const updateRestaurantInfo = (newInfo) => { + setRestaurantInfo(newInfo); + setIsSaved(true); + + setTimeout(() => { + setIsSaved(false); + }, 3000); + }; + // Establish a connection if not already connected /*useEffect(() => { if (!WebSocketService.socket) { @@ -43,11 +68,11 @@ function App() {
- } /> - } /> + } /> + } /> } /> } /> - } /> + } /> } /> diff --git a/client/src/components/editRestaurant.jsx b/client/src/components/editRestaurant.jsx new file mode 100644 index 0000000..d20ed13 --- /dev/null +++ b/client/src/components/editRestaurant.jsx @@ -0,0 +1,94 @@ +import React, { useState } from 'react'; +import { FaFacebook, FaInstagram, FaTwitterSquare } from 'react-icons/fa'; + +const EditRestaurant = ({ restaurantInfo, updateRestaurantInfo , saved}) => { + //store edits of the fields + const [newName, setNewName] = useState(restaurantInfo.name); + const [newDescription, setNewDescription] = useState(restaurantInfo.description); + const [newInstagram, setNewInstagram] = useState(restaurantInfo.instagram); + const [newFacebook, setNewFacebook] = useState(restaurantInfo.facebook); + const [newTwitter, setNewTwitter] = useState(restaurantInfo.newTwitter); + + + const handleSave = () => { + //update restaurant info using the provided function + updateRestaurantInfo({ name: newName, description: newDescription, instagramLink: newInstagram, facebookLink: newFacebook, twitterLink: newTwitter,}); + }; + + return ( +
+
+ +
Edit Details
+
+ + setNewName(e.target.value)} /> +
+ +
+ +