Giter VIP home page Giter VIP logo

rem32's Introduction

README

Welcome to the REM32!, an 500px inspired Full-Stack single-page website where you can browse photos, user profiles and add comments.

Live Link

Table of Contents

Technologies used

  • Front End: React, Redux

    • Used to support front-end handling of images, user profiles, likes/comments and follows
    • Supports the persistence of state to local storage on uploading images to the site whether through user profile image, user cover image or a generic image post
  • Back End: Postgresql, Ruby on Rails

    • Handles User Authentication via session tokens where the requests works in tandem with the front-end to log/sign the user in
    • Uses a PostgreSQL database and Ruby on Rails backend to give access to the back-end server to change the database whenever needed/
  • Other: Amazon AWS S3, JavaScript

    • AWS S3 handles the image hosting to allow for a more dynamic and scalability of the application as well as reducing the server load.
  • Hosting: Heroku

    • The project was hosted on heroku.

Features

User Authentication

New Users can sign up with a new account or try the demo user, returning users can log in. The Demo User Sign in uses a set timeout function to visualize a user login and displays both the user and password signup as if a user was actually signning in.

Check out the User Authentication Code
const demoLogin = (e) => {
  e.preventDefault();
  displayUsername();
};

const displayUsername = () => {
  let i = 0;
  const demousername = "demoUser";

  const username = setInterval(() => {
    setState({ username: demousername.slice(0, i + 1) });

    if (i >= demousername.length - 1) {
      clearInterval(username);
      displayPassword();
    }
    i++;
  }, 100);
};

const displayPassword = () => {
  let j = 0;
  const demopassword = "demouser";

  const password = setInterval(() => {
    setState({ password: demopassword.slice(0, j + 1) });

    if (j >= demopassword.length - 1) {
      clearInterval(password);
      demoUserLogin({ username: "demoUser", password: "demouser" }).then(() => {
        setState({ username: "", password: "" });
      });
    }
    j++;
  }, 100);
};

const renderDemoLogin = () => {
  return (
    <input
      type="submit"
      className="button"
      onClick={demoLogin}
      value="Demo User"
    />
  );
};


Image Uploading

Logged in Users can upload images to the site where the images are hosted through AWS. They can give the images a title and description and on the Image Show page they can view the image along with additional contents. The images are also filtered and organized to ensure the lastest upload appears first on the home page.

Checkout the image uploading code
const handleFile = (e) => {
  e.preventDefault();
  const fileReader = new FileReader();
  const file = e.currentTarget.files[0];

  fileReader.onloadend = () => {
    setState((prevState) => {
      return { ...prevState, imageFile: file };
    });
    setState((prevState) => {
      return { ...prevState, imageUrl: fileReader.result };
    });
  };

  if (file) {
    fileReader.readAsDataURL(file);
  } else {
    setState({ ...state }, { imageFile: null });
    setState({ ...state }, { imageUrl: null });
  }
};

const handleImageSubmit = (e) => {
  e.preventDefault();
  const formData = new FormData();
  if (state.imageFile) {
    formData.append("image[title]", state.title);
    formData.append("image[description]", state.description);
    formData.append("image[image]", state.imageFile);
  }
  createImage(formData).then(() => {
    history.push(`/`);
  });
};


Comments/Likes

Logged in Users can leave comments and likes on Images they like/see. Comments can be edited and deleted quickly while Likes can be removed/readded.

User Profile & Followers/Followings

Users can view other users profile pages where they have access to images other user uploads, additionally they can follow/unfollow the user as well as viewing the user's followers and followings. Case statement method was implemented through the user navigation bar for a quick and fast time(Best: O(1) Worst: O(n)) and the state was changed based on which was clicked.

Future plans

  • Implement tags to help make images unique and more informative.
  • Implement search functionality to enable users to search images via title, and tags.

rem32's People

Contributors

dzhengg98 avatar

Stargazers

 avatar

Watchers

 avatar

rem32's Issues

Design Docs

Hey David! Awesome Work!

Wiki Page Home

  • Is the first page you see upon entering the wiki
  • Contains a welcome message
  • Contains a link/placeholder for a link to the live page
  • All links in the right sidebar should contain each wiki page and link to the correct page
  • Correctly formatted
    • each wiki page is listed in bullet points
    • all links route the correct page

Comments

MVP List

  • Should have 7 MVPs.
    • 3 of those are User Auth, Heroku, and Production README.
    • The other 4 are from the MVP List or ones clarified with the PM
  • Contains a description sentence of the app
  • Includes two to three detailed bullets on functionality and presentation of feature
  • At least one CRUD feature, which states what CRUD operations are planned (creation, reading, updating, deletion)
  • Estimates how long it will take the code each MVP
  • Correctly formatted
    • MVPs are listed in an ordered list
    • Each MVP is broken down into bullet points

Comments

Database Schema

  • Contains correct datatypes
  • Contains appropriate constraints/details
    • primary key
    • not null
    • unique
    • indexed
    • foreign key
  • Contains bullet points after the table that state which foreign keys will reference to which table, or references to the associations which will be made
    • foreign key and table name are lowercased, snake_cased and back_ticked
  • Correctly formatted
    • schema is written in a table format
    • the table's name are lowercased, snake_cased and back_ticked
    • the table header column names are bolded
    • columns names are lowercased and snaked_cased and back_ticked

Comments

Backend Routes

  • Contains the following sections: HTML, API Endpoints(Backend)
  • Each route has a description
  • API Endpoint routes contains wildcard variables written in snake_case
  • Routes does not contain superfluous routes
  • Have API routes that will allow the front end to get all info it needs and does not have unneeded routes:
    • i.e. probably don't need a GET likes api endpoint because that info comes through the post show

Comments

  • Don't need each table name to be capitalized

Sample State

  • State shape is flat!
  • State's keys are camelCased
  • All keys within the values in the state are accessible in the schema
  • Correctly formatted
    • Sample state is rendered with triple backticks, and the language (```javascript...```). This will display the state as a code block instead of a giant line of text
    • Top level slices
      • entities
      • session
      • errors (here or in ui)
      • ui (if needed)
    • Should NOT have nested slices, aka comments inside of posts
      • Some info from other tables is ok, for instance:
        • the author username and imageurl for a post. basically any info that the user can't change
        • like count and a boolean on whether the user likes the post instead of a likes slice

Comments

  • Don't need 'ui' to be capitalized

Frontend Routes

  • Frontend routes contains wildcard variables written in camelCase
  • Correctly formatted
    • Routes are displayed with inline coding text (backticks)

Comments

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.