diff --git a/client/src/components/Home/Home.scss b/client/src/components/Home/Home.scss new file mode 100644 index 0000000000000000000000000000000000000000..2b6b8ce98e40d34b05a120225d2fdbf9751306f8 --- /dev/null +++ b/client/src/components/Home/Home.scss @@ -0,0 +1,22 @@ +.home { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; +} + +.home-card { + display: flex; + align-items: center; + justify-content: center; + width: 80vw; + height: 90%; + min-width: 350px; + background-color: var(--light); + text-align: center; + + p { + font-size: 1.75rem; + } +} diff --git a/client/src/components/Home/Home.tsx b/client/src/components/Home/Home.tsx new file mode 100644 index 0000000000000000000000000000000000000000..9f257961ebb408f694289a3f94fd2b9bafd68326 --- /dev/null +++ b/client/src/components/Home/Home.tsx @@ -0,0 +1,18 @@ +import './Home.scss'; + +function Home() { + return ( + <> + <div className='home'> + <div className='card home-card'> + <p>Welcome to Airline Booking!</p> + <p>This website allows you to create and book domestic flights in the UK</p> + <p>If you are new please navigate to the register page via the link in the header</p> + <p>Happy flying</p> + </div> + </div> + </> + ); +} + +export default Home; diff --git a/client/src/index.scss b/client/src/index.scss index 9579f87760b28b786df570227256ab5c306bf98f..8c3d1473241b12c7744ccd1d131a011f21d26ec5 100644 --- a/client/src/index.scss +++ b/client/src/index.scss @@ -15,6 +15,7 @@ body { /* CSS Variables */ :root { --main: #000055; + --light: hsla(240, 100%, 17%, 0.299); } /* diff --git a/client/src/main.tsx b/client/src/main.tsx index 28bec0b56c893f06c731bad5b0cc430ed47c937b..e80244f83bad64b175200b71e062bfe752c34ce4 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -30,6 +30,7 @@ import CustomerProtectedRoute from "./components/ProtectedRoute/CustomerProtecte import AirlineProtectedRoute from "./components/ProtectedRoute/AirlineProtectedRoute.tsx"; import ErrorPage404 from "./components/ErrorPage/ErrorPage404.tsx"; import ErrorPage from "./components/ErrorPage/ErrorPage.tsx"; +import Home from "./components/Home/Home.tsx"; import { loadStripe } from '@stripe/stripe-js'; loadStripe('pk_test_51P5UhOExQclpActcEGkHdut1X1k6uQnEXQ2cKKTD5l9FS9a1TyB2ap1lRSQXZt35Dpd7mh8gHOwFyVb4TiqpZfJr00bDRrD4vF'); @@ -41,6 +42,10 @@ const router = createBrowserRouter([ element: <App></App>, errorElement: <ErrorPage></ErrorPage>, children: [ + { + path: "", + element: <Home></Home> + }, { element: <InverseProtectedRoute></InverseProtectedRoute>, children: [ diff --git a/client/src/services/Dashboard/CustomerDashboard.ts b/client/src/services/Dashboard/CustomerDashboard.ts index 040429f4c3e9bd7317db71d4290093ac7df78aa2..4a31774a05c4d4b460d9b34bdb81042ca9003850 100644 --- a/client/src/services/Dashboard/CustomerDashboard.ts +++ b/client/src/services/Dashboard/CustomerDashboard.ts @@ -48,7 +48,17 @@ export async function GetCustomerDashboardData(): Promise<ICustomerDashboardData flightsHistory: hData.data }; } catch (error) { - throw error; + try { + const upcomingFlights = Api.get('Booking/upcoming', { withCredentials: true }); + const flightsHistory = Api.get('Booking/history', { withCredentials: true }); + const [uData, hData] = await Promise.all([upcomingFlights, flightsHistory]); + return { + type: 'customer', + upcomingFlights: uData.data, + flightsHistory: hData.data + }; + } catch (newError) { + throw newError; + } } } -