Code Monkey home page Code Monkey logo

breathez's Introduction

BreathEZ

BreathEZ is an app that informs users of air quality where they live, and in other cities across the US. It's a Progressive Web Application designed for mobile use and is currently deployed here.

Installation

To install this app:

git clone <<url>>
cd ~/breath-ez
npm i

Once all the dependancies are installed run npm start and the site should be accessible at http://localhost:3000/.

Technologies

This app is built in React using the create-react-app boilerplate. It also uses...

-react-router-dom

-react-collapsible

-node-sass

-fetch api

-HTML5

-cypress

API

This app relies on the AirVisual API run by IQAir. This is an amazing API that lets us access reliable air quality and weather data. We're using the community (free) version, which puts limits on how many API calls the user can make per day, minute, and second. We've intentionally designed this app to slow the user down just enough that they shouldn't run into this problem, but if they do we have dynamic error handling that makes the process user-friendly.

Features

Upon visiting BreathEZ the user will see air quality and weather information for the available city nearest to them. If they would like to view data for a different city they can select a state and city using a drop-down menu. The list of available states fetches on page load, and when you select a state the app will fetch a list of available cities within that state.

The user can also click "FAQ" in the upper righthand corner if they have questions about how air quality is rated in the US, what kinds of pollutants our app can measure, and the effectiveness of different kinds of masks. Most importantly our FAQ page contains information on what AQI levels to worry about based on your health and medical history.

Using the app on mobile Viewing the FAQ on mobile Using the app on a desktop

Testing

We use cypress for end to end and integration testing. In order to test the site run npm run cypress and you should be brought to a testing suite. The tests use stubbed api calls, but do expect the site to run locally. Make sure you've run npm start in an open tab and can visit the site before testing.

sw.js and runRegistration.js

We originally used boilerplate service worker and registration logic provided to us by a create-react-app template. Eventually we converted this to a service worker of our own design that operates a little differently. This worker lives in our public directory, not src and the registration is called directly in index.html. This approach allowed us to slim down to only the code we needed to run this (relatively simple) app, and by hosting the files in public we aim to improve offline performance.

Future Iterations

There are number of improvements that could be made to this app. In addition to resolving the iOS bug we might decide to...

-Improve the desktop and tablet views, perhaps by adding more detailed information.

-Add logic that can slow down API calls to prevent users from hitting limits. Doing this would likely involve adding a loading screen.

-Add cached data files that can store information such as a list of available states so that the app doesn't have to fetch this information every time. We can easily mock this up with dummy data, but would need to add logic that lets the cache automatically update.

Contributors

This app was a group project for Module 3 of the Front End Engineering Program at the Turing School of Software and Design. Our assignment was to design and build an app using unfamiliar technology, and we chose to design a PWA.

Authors

Thao Ma GH Boone Epstein GH Eric Campbell GH
Ms. Turtle Mr. Epstein Mr. Campbell

breathez's People

Contributors

deadbelly avatar mainlyetcetera avatar thaomonster avatar

Stargazers

 avatar

Watchers

 avatar  avatar

breathez's Issues

BUG: Async errors

Describe the bug / point of concern
This isn't so much of a bug as it is a needed fix. We're formatting our asyc lifecycle callbacks in a way that throws warnings in the console. We should follow the steps outlined in the warnings to eliminate them.

Header Component

** Description **
We'll need a Header component for the top of the app. It should have a title, search bar, and link to our FAQ.

** Planning **
Refer to the Miro for specific docs.

Deploy site

** Description **
We should be able to visit the site from any browser, have everything work correctly, and install it on a phone. It should automatically use HTTPS instead of HTTP. We can try this through Vercel but if it does not use HTTPS we should try a different method.

BUG: FAQ disappears on iOS

Describe the bug / point of concern
On iOS mobile devices the FAQ link element is not visible. Searching for the term 'FAQ' identifies an element that appears to be in the correct place, but it is not visible nor clickable. The app works exactly as expected on non-iOS mobile devices. iOS users can type in the /faq url themselves to visit the FAQ page and it loads normally.

Location / Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to breath-ez.vercel.app on any iOS device.
  2. Notice the lack of an FAQ link in the upper right corner.
  3. Compare this with an Android phone or desktop browser.

User Story: Searching for a location

As a User, when I open the app I want to be able to search for a location so that I can navigate to a page with detailed information about the air quality in that location.

Acceptance Criteria:
-Navigate to the homepage.
-Input(/select) a specific location using our search bar.
-The app should route to a new page displaying air quality for that same location.

We should be able to move between the faq and home routes

** Description **

What does this addition do? What problems does it solve?

  • adds routes that let us move between the faq and home paths via links
    ** Planning **

Is there a specific plan for how to implement this? What needs to change?

  • use router
  • implement two routes
    • one will be for faq path
    • one will be for / path
  • these will be attached to links
    • both links will be rendered conditionally by Header
      ** Related Features **

What features and user stories rely on this addition?
#5

FAQ Component

** Description **
We need an FAQ component that includes copy explaining how our rating system works and how air quality is evaluated.

** Planning **
Refer to the Miro for specific docs.

User Story: Viewing location details

As a User when I visit a location details page, I want to see statics on current air quality, past trends, and future predictions. These statistics should be accessible to me even if I don't understand how air quality is measured.

Acceptance Criteria:
-Navigate to a location's detail page (either using a url, or the search bar)
-It should display a rating of air quality, that's accessible to the average person.
-It should display more detailed/specific pollution information for the past 48 hours.
-It should display predictions for future pollution levels.

Fallback Javascript

** Description **
The site should have fallback javascript for when it's not connected to the internet. There are several online guides on how to set this up and we should likely follow one of those closely and then deviate as needed. The metric for success is passing the chrome Lighthouse audit.

Initial Architecture

** Description **
We should establish some initial architecture so that we can build out features without many merge conflicts.

** Planning **
We haven't agreed on anything but a super basic modular react tree should work.

** Related Features **
Literally all of them.

Convert to PWA

** Description **
This is a placeholder issue for the second major iteration of our app. Once we're satisfied with our app as a browser app we should plan how to convert it to a PWA and open issues to itemize that process.

User Story: FAQ

As a User,

When I click on the FAQ link,

I want to see and be able to click on the different information section.

So that I can understand what the information given to me means.

Accessibility

** Description **
The site should be fully accessible. There are three ways we should test this:

  1. We should get a high score on Lighthouse's accessibility audit- ideally a 100.
  2. We should navigate the site with a screen reader the tab key and make sure it works.
  3. We should explore color-blindness simulations and make sure our contrast ratios hold up.

BUG: missing weather assets

Describe the bug / point of concern
Some valid icon codes we get from the API have no corresponding icon in our assets.

Location / Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to the app
  2. Open dev tools
  3. Load data for a city
  4. Open up the hooks in app and change ic to 04n
  5. There should be no weather icon now.
    Expected behavior
    Every valid code should have a corresponding icon

Additional context
The issue is that the documentation doesn't give us duplicate icons even though some codes apply to the same icon. We just need to create these duplicates in ourselves.

App Component

** Description **
We need to build out or App component including whatever methods might live there, and determine the logic of it's render method.

** Planning **
Refer to the Miro for specific docs.

first standup with Scott

resource name:

  • stand-up with Scott/day 1

resource body:

where to go

  • polished mvp over new features
  • may be worth doing together for naming
  • styling separately recommended

nail down pwa

  • start mobile first

hooks

  • start without worrying about them
    • refactor class to stateless hook component
    • possibility

Loading Screen

** Description **
We should have a loading screen while the user is awaiting api calls.

** Planning **
I think the best move is to use react promise tracker and some kind of react spinner dependency (of which there are many).

Error Handling

** Description **
We need the DOM to update and inform the user of any 404 or 500 errors. These updates should be informative so that the user can tell exactly what's gone wrong and how they might fix it.

** Planning **
Refer to the Miro for specific docs.

BUG: [description]

Describe the bug / point of concern
When the user visits the FAQ page the title/logo shifts slightly because of changing text in the header.

Location / Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to the app
  2. Click on FAQ
  3. Watch the elements in the header shift around.
  4. Go back and watch it happen it again.

Expected behavior
The title/logo should stay where it is and not move.

Default To Closest City

** Description **
THIS IS A STRETCH GOAL. We should make sure we complete everything else , or at least are confident about our MVP first.

We should use location services to allow the landing page to automatically display information for the closest city. If we begin work on this issue we should first design an appropriate user story and tests, and then build the feature to pass those metrics.

BUG: Viewport Size

Describe the bug / point of concern
We're failing an option Lighthouse check that indicates whether the app adjusts dynamically to the viewport width. We have code that should handle this but it either isn't working, or isn't working properly with Lighthouse.

Location / Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to the App
  2. Open dev tools
  3. Run the lighthouse PWA audit
  4. Scroll down to the viewport width test and see that it's grey (not red, but not green)

Expected behavior
Ideally this test should pass and give us a green check.

Desktop View

** Description **
We should design a version of the site that looks good on a desktop browser. There's a considerable amount of creative freedom here. This includes responsiveness, but also a fair bit of redesigning to make use of more space.

User Story: FAQ

As a User when I click the FAQ navigation button at the top of the app, I want to visit a page that explains how the app works, and how we rate air quality, so that I can better understand the information that the app is giving me.

Potential Solid README template

Description

What does this addition do? What problems does it solve?

Planning

Is there a specific plan for how to implement this? What needs to change?

  • We can use this as a basis, filling in our own info.

Rubric

resource name:
rubric page
resource link:
page

Testing Suite

** Description **
We need to build a series of Cypress tests that can navigate our app and asses it. This should include stubbed API calls so that we don't rely on the server. This needs to include unit and integration tests.

** Planning **
No planning exists for this yet. We should wait until everything else about the site is somewhat viable before we begin writing tests.

API Calls

** Description **
We need to determine where we'll be communicating with API and where the function calls will live. The functions should likely be in their own file which will then be imported into App.js.

** Planning **
Refer to the Miro for specific docs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.