Coder Social home page Coder Social logo

reels's Introduction

Reels

Click here to view!

Background

Reels is a full-stack, multi-page application clone of an award winning ecommerce site, called Rollies, where users can do online shopping and leave a review of products they bought. This project utilized Rails and postgreSQL for the backend, React/Redux and CSS3 for the frontend. Reels is heavily focused on front-end animation and UI/UX design to mimic the original site which won a Site of The Day awards by awwwards.com.

Tech Stack

javascript

html5

css3

react

node.js

ruby

postgresql



Features

User Authentication - Login/Signup

Reels user auth features allow user create an account or login, either with their own account or as a demo user. A login modal will popup when they are attempting to purchase an item, check their cart, or create a review without logged in. This authentication modal gives an easy access to try the site features without the need to leave their current page.

image login

Product Pages

Each product page shows product details where users can purchase the product. Users will be able to select the size options before they add item to the cart, check the size measurement using the Size Chart modal, and check the Material and Shipping details through the accordion section of the page

image product page

Reviews

Review section located underneath product details of Product Pages. It shows the average rating of the reviews and star ratings. If user is logged in, they can create, update, or delete their reviews. Each user is only allowed to leave one review per product. If the review exists, user will only be able to update or delete their review.

gif review

The code snippet below handles the logic whether the review is created or updated. If a user doesn't leave any review, a button of "Write Review" will appear and shows a "Create Review" modal. In the other hand, if a review exists, a button of "Update Review" and "Delete Review" will be shown. Whenever user clicks the Update Review, an "Update Review" modal will popup with prepopulated form.

const Review = () => {
const dispatch = useDispatch();
const {productId} = useParams();
const user = useSelector(state => state.session.user);
const reviews = useSelector(getReviews);
const ratings = reviews.map(review => review.rating);
const [showModal, setShowModal] = useState(false);
const [formType, setFormType] = useState('Create Review');

useEffect(() => {
  dispatch(fetchReviews(productId));
}, [dispatch, productId]);

const existingReview = reviews.find(review => review?.userId === user?.id);

const reviewButton = () => {
  if (existingReview) {
    return (
      <div className="review_button_area flex-row">
        <button 
          className="review_button"
          onClick={() => {
            dispatch(fetchReview(existingReview.id));
            setShowModal(true);
            setFormType('Update Review');
          }}>
          Update Review
        </button>
        <button 
          className="review_button"
          onClick={() => {
            if (window.confirm('Are you sure? Deleting a review is irreversible.')) {
              dispatch(deleteReview(existingReview.id))
            }}}
            >
          Delete Review
        </button>
      </div>
    )
}


Cart

When the user add an item to the cart on product page, a shopping cart modal will appear to signify successful completion. The cart item quantity can be updated using the +/- button. Each cart item can also be deleted by clicking the remove button or reduce the quantity to 0. The price of each item and subtotal are dynamically updated according to each user's cart. Additionally, whenever the user click the checkout button, user's cart will be cleared, a Thank You modal will appear and redirect the user to the Home Page.

gif add to cart

The code snippet below handles the logic of adding item quantity to the shopping cart. When the "+" or "-" button is clicked, it will add or subtract quantity by 1 respectively. There is also the input field where users are able to update the quantity by typing inside this field. If product quantity is 0, it will be automatically remove from the cart.

const dispatch = useDispatch();
let {quantity, productName, price} = cartItem;
let [count, setCount] = useState(Number(quantity));
const totalPricePerItem = (price * quantity).toFixed(2);
const images = cartItem.imageUrl;

const addQuantity = () => {
  dispatch(updateCartItem({...cartItem, quantity: quantity += 1}));
}

const subtractQuantity = () => {
  cartItem.quantity === 1 ? 
    dispatch(removeCartItem(cartItem.id)) : 
    dispatch(updateCartItem({...cartItem, quantity: quantity -= 1}));
}

if (!cartItem) return null;

return (
  <div className="quantity_price flex-row justify-between">
    <div className="quantity_button flex-row">
      <button onClick={subtractQuantity}> - </button>
      <input 
        className="cart_item_quantity"
        type="text"
        value={Number(quantity)}
        onChange={e => setCount(Number(e.target.value))}
        onBlur={() => dispatch(updateCartItem({...cartItem, quantity: Number(count)}))}
      />
      <button onClick={addQuantity}> + </button>
    </div>
    <p className="cart_subprice">{`$${totalPricePerItem}`}</p>
  </div>
 </div>
)


Search Bar

User can perform a search product function through the search bar that is located on the navbar. If the search yield results, list of products with matching query will show up and user can click through each product to their corresponding pages.

image search bar

Search product async function

export const searchProducts = query => async dispatch => {
const res = await csrfFetch(`/api/products/search/${query}`);

if (res.ok) {
    const products = await res.json();
    dispatch(getProducts(products));
  }
}

reels's People

Contributors

fee3fitri avatar

Watchers

 avatar

reels's Issues

Due 10/21

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

Feature List

  • Should have 7 Features.
    • 3 of those are User Auth, Heroku, and Production README.
    • The other 4 are from the Feature/MVP List or they have clarified them with you
  • 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 feature
  • Correctly formatted
    • features are listed in an ordered list
    • Each feature is broken down into bullet points

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

Due 10/25

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:
    • probably doesn't need a GET likes api endpoint because that info comes through the post show

Frontend Routes

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

Due 10/24

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

User Auth

  • Backend: DB, model, controller, views
  • Redux Loop: fetch, actions, reducer
  • Presentational Components
  • Styling
    • Should look similar to real site
    • When errors are displayed, the form adjusts properly
  • Smooth, bug free navigation
    • Login errors clears when switching from login form to sign up form (and vice-versa)
    • Errors should display for both /signup and/login.
  • Adequate and appropriate seeds
    • Demo Login Works
  • Modal (if present on website that is being cloned)

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.