From c9f94370c6443fd4efeec84872f22076f117f715 Mon Sep 17 00:00:00 2001
From: lcross2002 <liamdcross@outlook.com>
Date: Sun, 7 Apr 2024 13:57:03 +0100
Subject: [PATCH] fix dashboard flight card + formatting

---
 client/src/components/BookingList/BookingList.scss        | 2 +-
 client/src/components/BookingList/BookingList.tsx         | 2 +-
 client/src/components/BookingQuery/BookingQuery.scss      | 2 +-
 client/src/components/BookingQuery/BookingQuery.tsx       | 2 +-
 client/src/components/Dashboard/FlightCard/FlightCard.tsx | 3 ++-
 client/src/helpers/Airports.ts                            | 4 ++++
 6 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/client/src/components/BookingList/BookingList.scss b/client/src/components/BookingList/BookingList.scss
index 3b68214..6f50c49 100644
--- a/client/src/components/BookingList/BookingList.scss
+++ b/client/src/components/BookingList/BookingList.scss
@@ -18,4 +18,4 @@
 
 .booking-bold {
   font-weight: bold;
-}
\ No newline at end of file
+}
diff --git a/client/src/components/BookingList/BookingList.tsx b/client/src/components/BookingList/BookingList.tsx
index d87ca26..0ec6263 100644
--- a/client/src/components/BookingList/BookingList.tsx
+++ b/client/src/components/BookingList/BookingList.tsx
@@ -33,4 +33,4 @@ function BookingList() {
   );
 }
 
-export default BookingList;
\ No newline at end of file
+export default BookingList;
diff --git a/client/src/components/BookingQuery/BookingQuery.scss b/client/src/components/BookingQuery/BookingQuery.scss
index 8615421..b401cc9 100644
--- a/client/src/components/BookingQuery/BookingQuery.scss
+++ b/client/src/components/BookingQuery/BookingQuery.scss
@@ -9,4 +9,4 @@
 .booking-query-card {
   width: 20vw;
   min-width: 350px;
-}
\ No newline at end of file
+}
diff --git a/client/src/components/BookingQuery/BookingQuery.tsx b/client/src/components/BookingQuery/BookingQuery.tsx
index 1760725..6f982aa 100644
--- a/client/src/components/BookingQuery/BookingQuery.tsx
+++ b/client/src/components/BookingQuery/BookingQuery.tsx
@@ -79,4 +79,4 @@ function BookingQuery() {
   );
 }
 
-export default BookingQuery;
\ No newline at end of file
+export default BookingQuery;
diff --git a/client/src/components/Dashboard/FlightCard/FlightCard.tsx b/client/src/components/Dashboard/FlightCard/FlightCard.tsx
index 82bb495..5de50b7 100644
--- a/client/src/components/Dashboard/FlightCard/FlightCard.tsx
+++ b/client/src/components/Dashboard/FlightCard/FlightCard.tsx
@@ -1,5 +1,6 @@
 import { Link } from 'react-router-dom';
 import { IFlight } from '../../../services/Dashboard/CustomerDashboard';
+import { airportCode } from '../../../helpers/Airports';
 import './FlightCard.scss';
 
 interface IFlightCard {
@@ -11,7 +12,7 @@ function FlightCard({ flight }: IFlightCard) {
     <>
       <div className='flight-card'>
         <span>{flight.id}</span>
-        {/* <span className='flight-path'>{flight.origin} - {flight.destination}</span> */}
+        <span className='flight-path'>{airportCode(flight.origin)} - {airportCode(flight.destination)}</span>
         <span>{flight.origin} - {flight.destination}</span>
         <Link to={'/flights/' + flight.id}>View Flight</Link>
       </div>
diff --git a/client/src/helpers/Airports.ts b/client/src/helpers/Airports.ts
index 7969723..8fbf3bc 100644
--- a/client/src/helpers/Airports.ts
+++ b/client/src/helpers/Airports.ts
@@ -14,3 +14,7 @@ airportMap.set('Liverpool', 'LPL');
 airportMap.set('Norwich', 'NWI');
 
 export const airports = [...airportMap.keys()];
+
+export function airportCode(airport: string): string {
+  return airportMap.get(airport) ?? 'unknown';
+};
\ No newline at end of file
-- 
GitLab