import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; import Customers from './components/Customers'; import Layout from "./components/Layout"; import React, {useEffect, useState} from 'react'; import CustomerFormContainer from "./components/CustomerFormContainer"; import CustomerDetails from "./components/CustomerDetails"; import ErrorPage from "./components/ErrorPage"; import Restaurants from "./components/Restaurants"; import Reservations from "./components/Reservations"; import RestaurantDetails from "./components/RestaurantDetails"; import ReservationConfirmation from "./components/ReservationConfirmation"; import ReservationEdit from "./components/ReservationEdit"; const App = () => { return ( } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> }/> ); } const Home = () => { const todayDate = new Date().toISOString().split('T')[0]; // Get today's date in 'YYYY-MM-DD' format const [date, setDate] = useState(todayDate); const [selectedTime, setSelectedTime] = useState(''); const [numPeople, setNumPeople] = useState(2); const [searchValue, setSearchValue] = useState(''); const [timeSlots, setTimeSlots] = useState([]); useEffect(() => { if (date) { const selectedDate = new Date(date); const today = new Date(); const isToday = selectedDate.toDateString() === today.toDateString(); const startHour = isToday ? today.getHours() : 9; const startMinute = isToday ? Math.ceil(today.getMinutes() / 15) * 15 : 0; let currentTime = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate(), startHour, startMinute); const endTime = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate(), 23, 30); const slots = []; while (currentTime <= endTime) { const option = currentTime.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false }); slots.push(option); currentTime.setMinutes(currentTime.getMinutes() + 15); // Increment by 15 minutes } setTimeSlots(slots); } }, [date]); const handleDateChange = (e) => { setDate(e.target.value); }; const handleTimeChange = (e) => { setSelectedTime(e.target.value); }; const handleNumPeopleChange = (e) => { setNumPeople(e.target.value); }; const handleInputChange = (event) => { setSearchValue(event.target.value); }; const handleSubmit = (e) => { e.preventDefault(); console.log(date); console.log(selectedTime); console.log(numPeople); console.log(searchValue); }; const today = new Date().toISOString().split('T')[0]; return (

Home

Welcome to My Awesome App!

); } export default App;