From 022cde4333a8424f40e3d9e46d1b71ca47cccc05 Mon Sep 17 00:00:00 2001 From: ipsitabisht Date: Tue, 5 Dec 2023 13:15:14 -0800 Subject: [PATCH 1/2] added restaurant name change for landing page and link and description change --- client/src/App.js | 21 +- client/src/components/editRestaurant.jsx | 69 ++ .../src/components/landing-page/lpFooter.jsx | 12 +- .../src/components/landing-page/lpNavBar.jsx | 2 +- client/src/pages/admin-customer.js | 11 +- client/src/pages/admin-dashboard.js | 4 +- client/src/pages/landing-page.js | 13 +- package-lock.json | 667 +++++++++++++++++- package.json | 1 + 9 files changed, 771 insertions(+), 29 deletions(-) create mode 100644 client/src/components/editRestaurant.jsx diff --git a/client/src/App.js b/client/src/App.js index 1979dcb..aaf1d71 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,19 @@ 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!", + instagramLink: "https://www.instagram.com/your_instagram", + facebookLink: "https://www.facebook.com/your_facebook", + twitterLink: "https://twitter.com/your_twitter", + }); + + const updateRestaurantInfo = (newInfo) => { + setRestaurantInfo(newInfo); + }; + // Establish a connection if not already connected /*useEffect(() => { if (!WebSocketService.socket) { @@ -43,11 +56,11 @@ function App() {
- } /> - } /> + } /> + } /> } /> } /> - } /> + } /> } /> diff --git a/client/src/components/editRestaurant.jsx b/client/src/components/editRestaurant.jsx new file mode 100644 index 0000000..95c17b2 --- /dev/null +++ b/client/src/components/editRestaurant.jsx @@ -0,0 +1,69 @@ +import React, { useState } from 'react'; + +const EditRestaurant = ({ restaurantInfo, updateRestaurantInfo }) => { + //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 }); + }; + + return ( +
+
+
+ + setNewName(e.target.value)} /> +
+ +
+ +