Giter Site home page Giter Site logo

drkchn / mosa-upenn-soc-2023 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 8.05 MB

Civics-Themed Winner @ MOSA Summer of Code | Get Out The Vote: Civics Central | Promoting democracy by educating voters about upcoming elections

Home Page: https://soc-2023-civic-tracker.web.app/

JavaScript 1.48% HTML 1.65% CSS 0.87% TypeScript 95.51% Shell 0.50%
typescript google-firebase material-ui node-js react-js vite

mosa-upenn-soc-2023's Introduction

Project Title: Civic Central

Homepage

Overview

Project summary

In the United States, the voting-age population turnout has been historically lower and lags behind many other peer countries. We believe our project can help increase civic engagement by educating users. Our application aims to encourage users to participate in democracy by making it easier to access election information.

When a user inputs their residential address, we query the Google Civics API and present comprehensive information about on any upcoming U.S. elections. We also offer the user the ability to see information about representatives across all levels of government based on the users input.

Check out our Devpost here! Devpost Civic Central

Authors (by last name alphabetical order)

  • Derek Chen - @drkchn – derche [at] seas[dot]upenn[dot]edu – GitHub
  • Connor Fech - @cfech – cfech [at] seas[dot]upenn[dot]edu – GitHub
  • Gunjan Jhaveri - @gjhaveri98 – gjhaveri [at] seas[dot]upenn[dot]edu – GitHub
  • Prinsa Patel - @prinsaa – prinsa [at] seas[dot]upenn[dot]edu – GitHub

Usage

Prerequisites

  • Node Version Manager Install to manage multiple Node.js versions (Optional)
  • Node.js (version 18.16.0)
  • Google Cloud Account
  • Google Civic Information API key

Installation

  1. Clone the repository to your intended directory
git clone https://github.com/drkchn/mosa-upenn-SoC-2023.git
  1. Run the command npm install to install all dependencies

  2. create a file in the root directory called .env

    • Add the following environment variable: VITE_CIVICS_API_KEY=[Your Key Here]
  3. Run the command npm run start to locally launch the project

  4. Check out our codebase!

Getting the Google Civic Information API key

  1. Navigate to Google Cloud console
  2. Go to Navigation menu --> APIs & Services --> Credentials
  3. Click Create Credentials --> API Key
  4. Go to Navigation menu --> APIs & Services --> Enabled APIs & Services --> Click on Enable APIs and Services button
  5. Search for Civic Information API and click Enable

Restrict your API key to prevent unauthorized access (Optional)

  1. Go to APIs & Services --> Credentials
  2. Under API restrictions, click on Restrict key
  3. Search for Google Civic Information API and check the box
  4. Click Save button

Working with ENVs in React with Vite

  1. create a .env file in the root directory
  2. Add the following line
VITE_CIVICS_API_KEY=[Your API key goes here]
  1. Never expose or git push your API key!

    • Environment variables must be prepended with VITE, or it will not be picked up during the application build.
  2. Use it in the application

Deployment & Features

Using the Homepage Search Bar

Address Search Bar

  1. Navigate to the search bar on the homepage.
  2. Enter a U.S. residential address, then click on the FIND MY ELECTIONS INFO! button.
  3. You will be redirected to a new page.
  4. Check out any upcoming elections in your area, or view your representatives in government!
  5. You can click on the Election name button or Officials' name button for more information.

Navigating the Why Vote? Page

Why Vote Voter Data

  1. Navigate to the Why Vote? page.
  2. Each of the buttons is hyperlinked to reputable sources where you can learn more about the importance of voting.
  3. You can see historical voting data from 1990-2022, based on sex and race at the bottom of the page.

Changing the Website Theme

Dark Theme

  1. Click on the icon with the symbol of a sun.
  2. You can toggle between a light theme and a dark theme.
  3. The purple light theme represents the shared bipartisan goal of educating voters and encouraging voters to participate in democracy!

Reviewing the Request History

Request history

  1. Click on the icon with the symbol of a magnifying glass and upwards line graph.
  2. You can review all prior API requests and see if an API call was successful (200 OK) or unsuccessful (400 Bad Request).
  3. You can click on CLEAR button to clear your request history.

Learn More:

About Us

  1. Click on the About page to learn more about the developers
  2. Click on the Learn More button to see a detailed technical explanation of the application
  3. You can also click on any of the technologies to learn more about them individually

Responsive Design

Responsive design 1 Responsive design 2

  1. All pages in the app are completely responsive
  2. The app can be viewed on any screen size without compromising the user experience

See Our Code:

  1. Click on the <> icon
  2. The GitHub repo will open in a new page

Additional information

Application Design

Civics Central is developed using React, Typescript and Vite. Typescript is utilized to enforce strict static typing. Axios is used to query multiple different API's from the Google Cloud Suite from which the reposes are memoized in order to limit overuse of Google Civics API and hitting our rate limit. Our application using React Router to handle rendering different pages as well as React Context and State to share data between components. Material UI component library is leveraged for pre-built components, implementing custom application themes and applying principals of responsive design.

Local Development Environment

Our local development configuration is focused on enforcing frontend development best practices. We utilized prettier and eslint to enforce code format standards as well as build and push scripts that run linters and tests and the Vite build tool to package code for production. Our application also has React Testing Library and Jest for unit testing and code coverage reports. Environment variables are used to pass various run time arguments to the application, such as API keys.

Team Collaboration

Our team practiced a trunk based development methodology to effectively and efficiently collaborate on on this project. We utilized git branches and github issues in order to collaborate together and mitigate potential merge conflicts. In a trunk based development model the main branch acts as the single source of truth and one off branches are checked out on a per issue basis then merged back into the main branch after the issue is complete.

Tools used

Which frameworks, libraries, or other tools did you use to create your project?

  • React.js - Web framework
  • TypeScript - Programming language to enforce static typing
  • Node.js - JavaScript runtime environment
  • Google Cloud - Google Civic Information API, monitor API usage, and prevent API overuse
  • Google Firebase - To host the application
  • Vite.js - As a local development and build tool
  • Material UI - Pre-build components, for consistent UI/UX, and responsive design
  • Git/GitHub - Version control system, trunk based development
  • Prettier - Enforce code formatting
  • EsLint - Enforce Javascript best practices

Future Features

In the future we would like to add user accounts and a search history for each account. This would allow the user to see all of their previously queried data without having to search again. We would also like to integrate a map into the Civic Info page that shows the address/location fo the election. 0

mosa-upenn-soc-2023's People

Contributors

cfech avatar drkchn avatar gjhaveri98 avatar prinsaa avatar

Stargazers

 avatar  avatar

Watchers

 avatar

mosa-upenn-soc-2023's Issues

Add a testing library

  • Have to add react testing library to the application so we can test our code.
  • install library
  • add debug root functionality
  • add to pre-push script

Fix Footer

Make sure the footer is always on the foot of the page, both in phone and computer view

Deploy template to firebase

Firebase Account Required

Steps taken:

  1. Created a firebase project
  2. sudo npm install -g firebase-tools
  3. firebase login
  4. In the root of the project firebase init
  5. Configured firebase.json to run build script before a deploy would happen
  6. ran firebase deploy

Generate A React Template

  • React template generated and added to the repository
  • Added support for material UI
  • Added prettier linting
  • Added some documentation to the readme

MVP Webpage that explains reasons it's important to vote

The webpage will contain information about the importance of elections, democracy, and civic duty to motivate users to vote in their elections. Webpage should be visually appealing while informative for users. Overall, it should provide educational aspects to voting.

Create a footer

  • Footers usually have information about the creators of a website, any legal notices erc.

example:
Screenshot 2023-06-11 at 1 28 05 PM

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.