Skip to content

Latest commit

 

History

History
127 lines (82 loc) · 6.09 KB

README.md

File metadata and controls

127 lines (82 loc) · 6.09 KB

ECE-GY 9953 Awesome Inc Frontend

This is the frontend codes for an online superstore web application, which is part of the ECE-GY 9953 Advanced Project.

Prerequisites

Created with React version 18.2.0 and Ant Design version 4.23.6.
Node version 16.15.0.

Package Management

NPM or Yarn are both fine. In my experience, Yarn works with Ant Design better.

Packages

Run yarn install or npm start to install all the packages used for this project.

Run the program

Locate the terminal to the src folder and run yarn start or npm start.

Features

Major Features

Consists features based on the CRUD operations.

Customer

The customer could register, log in, forget and reset password, change the password after logging in, go to the account information page and view the profile of the customer and edit the information.

Address

Functionalities associated with the address include: adding an address to the customer profile, getting the addresses of the customer after logging in, and updating and deleting an address on the customer profile.

Product & Order

The customer could search for a product and view the details including the unit price and the discount percentage of the product. Then the customer can add products to the shopping cart and place an order. The customer can also view the order history and choose to return an order within 30 days of the shipping date.

Admin

The administrator could log into the system, and view and change the stock of a product.

Security Features

XSS attacks prevention

JSX produces React elements and React produces separate components. Everything is converted to a string before being rendered. => Safe to embed user input and ensures that attackers can never inject anything that’s not explicitly written in our web application.

JWT

Chose the Bearer Token as the JWT. The bearer token is a cryptic string, generated by the Spring Boot backend. Sent in the HTTP Authorization header when making requests to protected resources.

Structure of the project

package.json

Specifies the versions of packages and dependencies.

App.js

Set up routes for different pages using React Router. Includes the footer across pages.

index.css

Consistent styling across pages.

src/components/Options.js

Constants including the security questions, quantities, regions, etc.

src/components/Home.js

Home page of the web application.

src/components/Navbar.js

Navbar used across all pages. Located at the top left corner is an icon with the text Awesome. By clicking the icon, the user is redirected to the home page. In the middle, there's a search bar for the customer to search for products, access limited to logged-in customers. At the top right corner, the first menu item is a user icon, disabled when the customer is not logged in, if logged in, submenu items include account info, address book, and log out. The second menu item with the text Log In/Register has the two submenu items, Register and Log In, after the customer is logged in, this submenu is disabled. The third one is a cart icon with two submenu items, View Cart and Checkout, access limited to logged-in customers.

src/components/Navbar.css

CSS styling for the navbar.

src/components/Register.js

Resgiter form.

src/components/Login.js

Login form, double authetication with the security question.

src/components/ForgotPassword.js

Forgot password page for the customer to submit the email address and later receive a link in the email inbox to change/reset the password. No JWT needed for this page.

src/components/ChangePassword.js

Change/Reset password page following the forgot password action.

src/components/Account.js

Account Info page, displaying the name and email of the customer.
Two buttons, one for directing to the editing info page, the other for directing to the updating password page.

src/components/EditInfo.js

Renders the customer's info and allows the customer to edit it.

src/components/UpdatePassword.js

Allows the customer to update the password.

src/components/AddressBook.js

Account Info page, displaying all addresses of the customer in the format of table. A separate Card component that directs to the add address page. In the table, the customer could click on the Edit Address button to direct to the edit address page and click on the Delete Address button to delete it.

src/components/EditAddress.js

Renders the customer's address and allows the customer to edit it.

src/components/AddAddress.js

Add address form page.

src/components/CategoryItems.js

Constants of categories, used in the Results.js table.

src/components/Results.js

Search Results data populated in a table. Sorters and filters of categories implemented.

src/components/Product.js

A specific product page, allows the customer to choose a quantity of the product and add it to the shopping cart.

src/components/Cart.js

View Cart page, data populated in the table. Allows the cutsomer to updapte the quantity or delete a product. Could redirect to the checkout page by clicking the Checkout button.

src/components/Checkout.js

Checkout page, asks the customer choose shipping address, order priority, shipping mode, and fill out payment info.

src/components/OrderPlaced.js

Successfully placed order page.

src/components/OrderHistory.js

Order history data populated in the table. Allows the customer to return an order within 30 days of the shipping date.

src/components/AdminLogin.js

Admin log in form page.

src/components/AdminUpdateProduct.js

Admin update product page. Separate management from the customer.