Skip to content

hatchways/team-eagle

Repository files navigation

Poll App. Hatchways Co-op Project.

Background and Overview

This app allows users to upload polls with two photos, and ask friends from friend lists, or the general public to vote on their polls.


Setup

  1. cd to ./server
    1. Make sure MongoDB is setup and running on your localhost on port 27017. The app will connect to "poll" database on your local mongo connection.
    2. yarn install
    3. yarn dev

In a new terminal tab:

  1. cd to ./client

    1. yarn install
    2. yarn start
  2. [optional] if you want to test out uplodaing photos, go to .env file and enter the following credentials with keys:

AWS_SECRET_ACCESS_KEY = ""
AWS_ACCESS_KEY_ID = ""

Technology

Stack

  • Database
    • MongoDB
  • Backend
    • Express, Mongoose
  • Frontend
    • React (hooks), Material UI

Noticeable Dependencies

Backend:

  • socket.io
    • For establishing web socket connections to update active/inactive user status
  • aws-sdk, multer, multer-s3
    • For parsing uploaded images and sending them AWS S3
  • chai, mocha, mongodb-memory-server
    • For integration testing

Frontend:

  • socket.io-client
  • @material-ui/core, @material-ui/icons, @material-ui/tabs
  • react-dropzone

API Endpoints

Checkout the dev README for details about API endpoints.


App Images

Register page Home page

Friend list create modal


Friends page. Followers tab.


Poll update modal


Poll update modal with dropdown


Profile image update modal


Home page


Noticeable Features

Feature Overview

  • Web sockets
  • Mobile responsiveness
  • Integration tests
  • React context

Feature visuals

  • Web sockets

    App shows live indicators when users are logged in:

active user demo GIF

server/bin/www:

io.on('connection', (socket) => {
  console.log('connection');

  socket.on('userActive', () => {
    socket.emit('makeActive');
    io.emit('friendsUpdate');
  });

  socket.on('userLogout', () => {
    io.emit('friendsUpdate');
  });

  socket.on('disconnect', () => {
    console.log('user disconnected');
  });
});
  • Mobile responsiveness

App on mobile navigation GIF


App on mobile horizontal scroll GIF


App on mobile navigation GIF


  • Integration tests

    Integration tests spec run GIF

  • React Context

client/src/components/contexts/PollContext.js:

import React from 'react';

// This is what each component should import
export const PollContext = React.createContext();

// This should be imported only by index.js
export const PollContextProvider = ({ children }) => {
  const [state, setState] = React.useState({
    poll: {},
    votes: [],
  });

  function setPollState(newState) {
    setState((prevState) => {
      return { ...prevState, ...newState };
    });
  }

  return (
    <PollContext.Provider
      value={{
        ...state,
        setPollState,
      }}
    >
      {children}
    </PollContext.Provider>
  );
};

Contributors

Dhruv Arora, Thiago Nemecek, Abdulhakeem Almidan

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •