Skip to content

A Vanilla JS Weather App that allows users to obtain live weather data via API calls for a desired location or for the user's position via geolocation. It also features a 5-day forecast, and changes color depending on whether it is daytime or nighttime in location of interest. As a fun addition, this app features a couple of festive themes for C…

Notifications You must be signed in to change notification settings

Pari-Pt/weather-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Application

About

This Application has been coded to fetch and display live weather data by means of OpenWeatherMap APIs* and Geolocation.
*API stands for Application Programming Interface, a type of software that allows applications to communicate with each other.

How to use this Application

Components

Upon launching the App, the user is presented with a default city "Porto" with its corresponding live weather data:

  • Temperature
  • Current Date and Time
  • Humidity %
  • Wind Speed in km/h
  • Sunset time (UTC)
  • A 5 day weather forecast
  • Several icons to illustrate the weather situation
  • A description regarding the weather situation e.g. "Clear Sky".

The user is also able to interact with the following on the right hand side of the Application:

  • A Search Engine
  • A "Current Location" button
  • A "°C" units button
  • A "°F" units button
  • A Theme button

Searching for a city

The user may search for a city by inputting the name of a city into the search engine and submitting/pressing enter. The city name is then called by the API, and the current weather data for that city shall be displayed. Depending on the weather, and the time of day, the Application may appear different. For example, if it has already passed sunset in the searched city, the background of the App shall be darker than if it was daytime. In addition, the icons on the Application will change depending on the weather conditions. For example, if it was raining in the searched city, the icon with a cloud and rain would be displayed.
If 0 characters are submitted into the search engine, an alert will be displayed requesting the user to search for a city.
If the city in which the user submitted is not found, the display will not change.

Currently there are a set of functions working to produce the accurate time for the searched city based on timezone calculations. This is currently undergoing testing and may not be present in the final version of this Application

"Current Location" button

The "Current Location" button, when pressed, will request permission for the user's location. In order for this facility to be executed, the user needs to grant permission. Once granted, Geolocation is used to pinpoint the coordinates (longitude and latitude) of the user's device. This information is then fed into a API call, which in turn responds and displays the current weather data for the city associated with those coordinates.

Units

The Application displays the weather data in metric units (°C for temperature and km/h for wind speed). However, if the user prefers, it is possible to display temperatures in °F by pressing the "°F" button. Temperatures can be returned to metric by pressing the "°C" button. The button corresponding to the equipped unit shall appear darker with no pointer appearing during hover. When the other unit button is pressed, the reverse shall occur.

Themes

Three festive themes were implemented based on the current Month:
  1. April - Easter
  2. October - Halloween
  3. November/December - Christmas
If the current month is included in the above theme list, then the Theme Button will appear with either a "Bunny", "Pumpkin" or "Santa" icon. If the current month is not included in the above theme list, then a happy face emoji will display within the Theme Button. If this button is clicked, an alert will display indicating that there are special themes available in the above-listed months.

Once a theme has been activated, cities can be searched as normal while maintaining the theme. If the user wishes to remove the theme, they need to click the button twice This is a small bug which will be rectified after gaining a stronger understanding of functions and how to circumvent certain situations

Built with

This Application was built with the following technologies:

  • HTML5
  • Cascading Style Sheets (CSS3)
  • JavaScript
  • Bootstrap
  • APIs and Geolocation

Future Updates

[] Responsive on a multitude of devices
[] React JS implementation
[] Color palette button to customise background as the user wishes

About the Programmer - Pari S. Nathali

Pari Nathali is an up-and-coming front-end web developer studying Pro at SheCodes. Keen to develop and demonstrate her skills, she is developing her skills in preparation for a career-change. Previously a forensic scientist and crime investigator, she has a multitude of transferable skills which, combined with her passion for programming would be an asset to any team or organisation.
GitHub: https://github.com/Pari-Pt/
SheCodes: https://www.shecodesfoundation.org/students/337-seonah-nathali
LinkedIn: https://www.linkedin.com/in/pari-pt/

About

A Vanilla JS Weather App that allows users to obtain live weather data via API calls for a desired location or for the user's position via geolocation. It also features a 5-day forecast, and changes color depending on whether it is daytime or nighttime in location of interest. As a fun addition, this app features a couple of festive themes for C…

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published