The deployed version has been taken down. If you would like to try this application, send me an email!
Website link: https://find-flights.netlify.app/
FlightFinder is a React application built around the SkyScanner API. FlightFinder gives you a MaterialUI interface to search and browse through various flight options, with support for multiple currencies.
Requires NPM & Git.
- Clone the repository to your computer
- Install all dependenccies with
npm install
- Replace the API key in
.env
with your own, generated at the SkyScanner API Website. The free tier supports 50 requests a minute. npm start
will start a local development server onlocalhost:3000
FlightFinder uses React.js and material-ui for the front-end and is deployed on Netlify. The application consists of one page with a persistant search bar, and requisite results or errors are displayed once the search criteria is submitted.
This file brings the whole app together - it displayed the Header, then the search screen, and finall the footer.
This file contains and renders most of what the user will see. It contains state variables to store the following.
- Valid currencies
- User input to the search fields
- Processed user input
- PlaceId of the origin and destination
- Main flight API response
- Display settings
- Error flags
These state variables are how the custom components used in this app "communicate" with each other.
Initially, only the search component is rendered. When the user presses the submit button, input is processed, and the SkyScanner API is called. If the call returns successfully, result components are shown. If not, a helpful error message is displayed.
This component renders the persistant search bar. It is composed of 6 different elements, all of which is passed back to the main component using state.
- Dropdown menu to select currency
- Field to enter original destination
- Field to enter final destination
- Date picker to select departure date
- Date picker to select arrival date
- Search button to submit form
All of these visual components are from the material-ui component library, and I use the Grid component to position all of the elements evenly accross the screen.
Tools.js contains 2 tools to modify displayed results.
- Swap Search
- Sort by
Both of these tools allow the user to modify the way results are displayed to them. Swap Search will switch the origin and destination locations and display new results. Sort by allows the user to sort the displayed results by price.
Results.js is passed the flight data object and processes the data, then displays all flight options in individual cards.
Data is initially extracted and split into seperate objects and processed individually. Airport and Carrier data is split into a seperate object and the quotes object is sorted by price. The component then renders cards, with information about each flight (price, carrier, and airports). The flight's specific date is shown only if the component is showing information about all flight options in a month.
This file contains all interacctions with the SkyScanner API. It contains three functions.
- fetchCurrencies
- fetchPlaces
- fetchFlightWithDate
Each of these functions will call the SkyScanner API returning a status code and either an error or data.
fetchCurrencies is used to fetch the list of currencies that SkyScanner supports when the app is initially rendered.
fetchPlaces is used to fetch the 2 different PlacceIds of the locations entered by the user.
fetchFlightWithDate is used to fetch a list of flight options for the search parameters provided. It supports specific dates, and a general search over a month.
This file contains 2 functions.
- getCurrentDate
- getCurrencySymbol
getCurrentDate will return today's date, to allow for post processing of user input.
getCurrencySymbol will return the corresponding symbol for the currency the user selects.