The Flight Tracking Application is a web-based platform built with React and Redux, designed to provide users with real-time flight status information. It allows users to search for flights, view flight details, and navigate through different sections of the application seamlessly.
To run the Flight Tracking Application locally, follow these steps:
-
Clone the repository:
git clone https://github.com/vikram0104irctc/Travelopia_Assignment.git cd flight_status_board
-
Install the required packages:
npm install
-
Run the application:
npm run dev
The application will be running at
http://localhost:3000/
. -
Test the application:
npm run test
-
Build the application:
npm run build
The build files will be generated in the
build
folder.
The project consists of the following main directories and files:
Travelopia_Assignment/
├── flight_status_board/
│ ├── src/
│ │ ├── components/
│ │ │ ├── FlightCard.tsx
│ │ │ ├── FlightTable.tsx
| | | |── FlightBoard.tsx
│ │ │ ├── Navbar.tsx
│ │ │ ├── Sidebar.tsx
│ │ ├── pages/
│ │ │ ├── FlightDetails.tsx
│ │ │ ├── notfound.tsx
│ │ ├── redux/
│ │ │ ├── action.tsx
│ │ │ ├── reducer.tsx
│ │ │ ├── store.tsx
│ │ ├── utils/
│ │ │ ├── formatDate.tsx
│ │ ├── App.tsx
│ │ ├── main.tsx
│ ├── public/
│ │ ├── favicon.ico
| |── index.html
│ ├── package.json
|── ── README.md
- src/: The main source folder containing all application code.
- components/: Contains reusable React components.
- Navbar.tsx: Navigation bar for the application.
- Sidebar.tsx: Sidebar for easy navigation between sections.
- FlightCard.tsx: Displays individual flight information in a card format.
- FlightTable.tsx: Renders a table view of all available flights.
- FlightDetails.tsx: Displays detailed information about a specific flight.
- redux/: Contains Redux setup files.
- action.ts: Defines action types and action creators for updating flight data.
- reducer.ts: Contains the reducer function to manage flight state.
- store.ts: Configures and creates the Redux store.
- utils/: Contains utility functions for formatting dates and times.
- formateDate.ts: Functions to format departure times and dates.
- App.tsx: Main application component that sets up routing.
- index.tsx: Entry point of the application.
- components/: Contains reusable React components.
Purpose: The Navbar provides a search feature for users to find flights by flight number or airline name.
Key Features:
-
Search input that triggers API calls to fetch flight data.
-
Displays the search results dynamically as the user types.
Purpose: The Sidebar offers navigation links to different sections of the application, enhancing user experience.
Links:
-
Home: Redirects to the main flight listing page.
-
History: Takes users to their flight history (to be implemented).
-
Tickets: Accesses users’ ticket information (to be implemented).
Purpose: The FlightCard component displays a summary of individual flights.
Key Features:
-
Shows the airline, status, origin, destination, and formatted departure time.
-
Visual indicators for flight status using colored badges.
Purpose: Renders a table listing all available flights with detailed information.
Key Features:
-
Clickable flight numbers redirect users to the FlightDetails page.
-
Displays flight number, airline, origin, destination, departure time, and status.
-
Color-coded status indicators for better visibility.
Purpose: Displays detailed information about a selected flight.
Key Features:
-
Shows airline name, flight duration, and detailed departure/arrival information.
-
Displays a visual representation of the flight route.
The application uses Redux for state management, facilitating efficient data handling and global state access. The state consists of:
- Flight Data: All available flight information.
- Recent Flight Data: Recently fetched flight status data.
- SET_FLIGHT_DATA: Updates the global flight data.
- SET_RECENT_FLIGHT_DATA: Updates the recent flight data.
- dataUpdate(data: dataType[]): Dispatches an action to update flight data.
- currentStatusDataUpdate(data: dataType[]): Dispatches an action to update recent flight data.
The flightStatusReducer function handles actions related to flight data updates and returns the new state accordingly.
The Redux store is created using createStore from Redux, applying the flight status reducer to manage the application's state.
- formateDate.ts: Contains utility functions for formatting flight departure times and dates, ensuring that the time is displayed in a user-friendly format.
This Flight Tracking Application effectively combines modern React features with Redux for state management, providing a robust solution for users looking to track flights. Future enhancements could include a detailed history section and ticket management functionalities.