Giter VIP home page Giter VIP logo

jp-quintana / react-shopping-cart Goto Github PK

View Code? Open in Web Editor NEW
87.0 5.0 20.0 19.03 MB

Shopping cart app built with React and Firebase. This app is a clone of https://alphaleteathletics.com.

Home Page: https://flaakko-v2.web.app/

HTML 0.09% JavaScript 70.10% SCSS 29.59% CSS 0.21%
cart ecommerce firebase firestore javascript react react-context react-ecommerce react-hooks react-shopping-cart reactjs scss shopping shopping-cart storefront

react-shopping-cart's Introduction

React Shopping Cart

Shopping cart app built with React and Firebase. Currently WIP.

This app is a clone of https://alphaleteathletics.com.

App Preview

flaakko-latest.mp4

(Version in video deployed Aug 11, 2023)

Features

  • Products Display.
  • Products Filter.
  • Infinite Scroll.
  • Cart Functions.
  • Basic Inventory Management.
  • Auth (Email/Password & Anonymous).
  • Mock Checkout Page.
  • User orders & addresses.

Future additions

Check issues tab.

Installation

  • Step 1: Clone Repository and Install Packages.
git clone https://github.com/jp-quintana/react-shopping-cart.git

cd react-shopping-cart

npm install
  • Step 2: Create firebase-config.js file inside src/firebase directory.
export const firebaseConfig = {
  apiKey: '',
  authDomain: '',
  databaseURL: '',
  projectId: '',
  storageBucket: '',
  messagingSenderId: '',
  appId: '',
};
  • Step 3: Start the development server.
npm run dev

Setup Firebase Project

Firestore

Create products and users collections and carts, checkoutSessions and orders ones optionally.

Products Collection

products-collection Product collection holds both variants and skus collection.

  • collection: must match one of the allowed skus in CollectionPage component.
  • price: sets actual price. Variant doc handles discount logic.

Variants Subcollection

variants-subcollection-1 Each variant represents a different color.

  • productId: should hold parent doc id.
  • images: same id as folder which contains corresponding variant image in cloude storage. And src should be the link provided by cloud storage when uploading corresponding image.
  • variantPrice: should hold a number equal or less to product price. If variantPrice < price, then the product variant will be showed as "on sale" in UI.

Skus Subcollection

skus-subcollection-1 Although these docs are children of product doc, skus are specific to the product variant, not the product itself. Say for example, if variant has 5 sizes, there should be 5 sku docs, each one representing a different size. If the product has 2 colors, each with 5 sizes, you need to create 10 sku docs.

  • productId: should hold parent doc id.
  • variantId: should hold corresponding variant doc id.
  • value: this is the sku value. It's currently not used in the app itself. App uses the sku doc id generated by firebase.

Cloud Storage

cloud-storage-example Each image should be stored in a folder with a name that corresponds to its respective ID. Aditionally each image folder should be stored in the "product-images" repository. The "src" is obtained by clicking the link inside the red rectangle. See image above and the one in Variants Subcollection section.

Admin View

admin-view

(Can be found in App.jsx in src folder)

Note

Important: comment out all admin routes before deploying app as firestore rules are not configured yet. Commented out lines in image above currently do not work even though components are found in project.

Seed Data to Firebase

Setup Admin

is-admin Create new user in the app and add "isAdmin: true" to corresponding user doc in firestore.

Data

seed-data Use "dummy-products.json" file in data folder as guide for your own data. At the moment you must add each image manually to the cloud storage as shown above and afterwards add the corresponding links to the json file. Once you've added your data, change file name to "products.json".

Authors

react-shopping-cart's People

Contributors

jp-quintana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-shopping-cart's Issues

Create Home Page

Setup router and route for the home page and add basic UI + Images

Tasks

Router

  • Home

UI + Images

  • Header
  • Hero
  • All Products Carousel
  • Categories
  • Newsletter
  • Footer

Update Nav & Add Route Guards

Tasks

Update nav UI and incorporate auth logic. Add protected routes.

Update Nav

  • Modify login link (icon to plain text).
  • Update Nav UI
  • Update SideNavUI
  • Create SideModal

Route Protection

  • Add protected routes.

Create Collections page

Add basic UI, Images & params

Tasks

UI + Images

  • Dummy Products
  • UI

Params

  • Filter by params

Create User Profile Page

Tasks

Create UI for User Profile Page.

Base User Profile

  • Add base UI with orders, personal data and addresses section.

Edit Profile Modal

  • Add modal to edit personal user data.

Order Modal

  • Add modal to view details of each order user makes.

Addresses Page

  • Create base UI for Addresses Page.

Add/Edit Address Modal

  • Add modal to add new addresses or edit existing ones.

Add Store Email For Newsletter

Tasks

Add hook to store email from users in firebase newsletter collection.

useNewsletter Hook

  • Create hook.

Update UI

  • Update Newsletter Section UI so it works with new newsletter logic.

Redesign Database

Redesign database to allow for future implementation of admin view.

Fix Footer

Make it so that the footer sticks to the bottom of the page no matter the amount of content in main.

Add Auth

Tasks

Setup authentication with auth and implement cart/auth logic.

Firebase

  • Add auth.
  • Add firestore.

User & Cart

  • Add Auth Context.
  • Update Cart Context so it works wit new auth logic.
  • Add custom hooks for auth and cart operations.

Add Cart Context

Add Cart Context and implement Cart logic in Header and Product and Cart pages.

Tasks

Add Context

  • Reducer

Implement Logic

  • Product Page
  • Cart Page
  • Cart icon in Header

Add User Addresses In Checkout

Tasks

Add users' addresses in dropdown menu in checkout page to improve user experience.

Dropdown Menu

  • Create using React Select package.

useCheckout Hook

  • Update logic. Users should be able to use previous saved addresses to fill in form and should be able to create new addresses from this same page.

useAddressHook

  • Update logic. Should be updated to be able to receive data from useCheckout hook.

Add User Profile Logic

Tasks

Add User Profile Logic.

User Profile

  • Update UI.

Account Orders

  • Logic.

Edit Profile

  • Logic.

Account Orders

  • Logic.

Others

Protected Routes

  • Update to make work with new User Profile Logic.

Add Notification Modal

Tasks

Add notification modals for add item to cart and for errors throughout the app.

Notification Modal

  • Add To Cart.
  • Errors.

Update Order Logic

Add shipping and address details in order reviews in account profile.

Add Loader

Tasks

Add Loader Component.

Loader

  • Add Loader Component.

Add Admin Page

Tasks

Add admin panel and feature for admin to add/delete/edit products.

Admin Page UI

  • Add admin panel.
  • Add create/edit product page.

useAdmin Hook

  • Create hook containing all admin functions.

Admin Logic

  • Incorporate Admin logic.

Add Inventory Logic

Tasks

Add stock checks throughout the app. Add logic to update cart if there are difference between amounts in cart and available stock.

useInventory Hook

  • Create function to check Inventory in database to compare with cart.

Product Page

  • Update logic to get latest stock when reloading per SKU when updating page.

Cart & Checkout Page

  • Check for stock differences between all items in cart and their respective stock in database. If difference is present, update corresponding items in cart.

Create Order

  • Update inventory database quantities when creating order.

Update Cart Logic

Tasks

Update Cart Logic.

Auth Logic

  • Add anonymous login and remove local storage logic.

Cart Logic

  • Update cart logic to work with anonymous login.

Update Cart Modal

Tasks

Add Custom Key Down Hook to listen for Escape key when modals are open so they can be closed.

Custom Hook

  • Add useKeyDown hook.

Modal Components

  • Add custom hook in each common component.

Update Product Logic

Tasks

Load all producs onto firebase firestore. Update product schema and logic in project. Update cart logic to make it work with new product schema.

Firebase

  • Add Products.

Product Schema

  • Collections.
  • Products.

Product Logic

  • Context.
  • Custom hook.

Cart Logic

  • Update to match new product changes.

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.