Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users should be able Signup/Register to the E-commerce App and verify email #14

Merged
merged 7 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/coverage

# production
/dist

/build
dist
# misc
.DS_Store
.env.local
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ Our e-commerce web application server, developed by Team Ninjas, facilitates smo
[![Netlify Status](https://api.netlify.com/api/v1/badges/a3ed5a75-a862-4f3b-ba21-8369180cf3e6/deploy-status)](https://app.netlify.com/sites/e-commerce-ninja-fn-staging/deploys)
[![Coverage Status](https://coveralls.io/repos/github/atlp-rwanda/e-commerce-ninjas-fe/badge.svg)](https://coveralls.io/github/atlp-rwanda/e-commerce-ninjas-fe)
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/atlp-rwanda/e-commerce-ninjas-fe/tree/develop.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/atlp-rwanda/e-commerce-ninjas-fe/tree/develop)
[![CI](https://github.com/atlp-rwanda/e-commerce-ninjas-fe/actions/workflows/ci.yml/badge.svg)](https://github.com/atlp-rwanda/e-commerce-ninjas-fe/actions/workflows/ci.yml)

## Completed features
- Setup empty react
- Setup Redux store
- Setup StoryBook documentation
- Sign up page

## Get started
- Clone repository
Expand All @@ -47,7 +49,7 @@ npm run storybook

## Folder Structure

- `public`: Contains static files like `index.html` and images.
- `public`: Contains static files and folder like `index.html` and images.
- `src`: The main source folder for the React application.
- `components`: Reusable UI components.
- `pages`: Different pages/screens of the application.
Expand Down
10 changes: 10 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[[redirects]]
from = "/*"
to = "/index.html"
status = 200

[[redirects]]
from = "/api/*"
to = "/index.html"
status = 200
force = true
16,376 changes: 10,325 additions & 6,051 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@
"dependencies": {
"@reduxjs/toolkit": "^2.2.5",
"axios": "^1.7.2",
"dotenv": "^16.4.5",
"formik": "^2.4.6",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.9.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-helmet": "^6.1.0",
"react-icons": "^5.2.1",
"react-redux": "^9.1.2",
"react-router-dom": "^6.24.0",
"react-spinners": "^0.14.1",
"sass": "^1.77.6",
"save-dev": "0.0.1-security"
"react-toastify": "^10.0.5",
"save-dev": "0.0.1-security",
"yup": "^1.4.0"
},
"devDependencies": {
"@babel/core": "^7.24.7",
Expand Down Expand Up @@ -49,6 +53,7 @@
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-helmet": "^6.1.11",
"@types/testing-library__react": "^10.2.0",
"@types/webpack-dev-server": "^4.7.2",
"@typescript-eslint/eslint-plugin": "^7.14.1",
Expand All @@ -68,10 +73,13 @@
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-storybook": "^0.8.0",
"eslint-webpack-plugin": "^4.2.0",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"image-webpack-loader": "^8.1.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"react-test-renderer": "^18.3.1",
"sass": "^1.77.6",
"sass-loader": "^14.2.1",
"storybook": "^8.1.10",
"style-loader": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
Binary file added public/assets/images/email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/failed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added public/assets/images/login-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added public/assets/images/new-message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/not-found.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added public/assets/images/sign-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="logo.png" type="image/png">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="./images/logo.png" type="image/png">
<title>E-Commerce Ninjas FrontEnd</title>
</head>
<body>
Expand Down
16 changes: 16 additions & 0 deletions src/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import './styles/Colors.scss';
@import './styles/Sample.scss';
@import './styles/style.scss';
@import './styles/signup.scss';
@import './styles/LandingPage.scss';
@import './styles/email.scss';
@import './styles/AdminHeader.scss';
@import './styles/Button.scss';
@import './styles/Categories.scss';
@import './styles/Footer.scss';
@import './styles/Input.scss';
@import './styles/SearchInput.scss';
@import './styles/SellerHeader.scss';
@import './styles/Sidebar.scss';
@import './styles/Header.scss';
@import "./styles/Product.scss";
11 changes: 5 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* eslint-disable*/
import React from "react";
import { BrowserRouter as Router } from "react-router-dom";
import AppRouter from "./router";
import "./styles/style.scss";
import Sidebar from "./components/sidebar/Sidebar";
/* eslint-disable */
import React from 'react';
import "./App.scss"
import { BrowserRouter as Router } from 'react-router-dom';
import AppRouter from './router';

const App: React.FC = () => (
<Router>
Expand Down
16 changes: 16 additions & 0 deletions src/components/Meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
import React from 'react'
import {Helmet} from 'react-helmet'

interface MetaProps {
title: string;
}

export const Meta: React.FC<MetaProps> = (props) => {
return (
<Helmet>
<meta charSet="utf-8" />
<title>{props.title}</title>
</Helmet>
);
};
73 changes: 73 additions & 0 deletions src/components/ResendEmail.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* eslint-disable */
import React, { useEffect } from "react";
import { Meta } from "./Meta";
import Button from "./buttons/Button";
import { useFormik } from "formik";
import * as yup from "yup";
import { toast } from "react-toastify";
import { useAppDispatch, useAppSelector } from "../store/store";
import { resendVerificationEmail } from "../store/features/auth/authSlice";
import { PuffLoader } from "react-spinners";

const validationSchema = yup.object({
email: yup.string().email("Invalid email format").required("Email is required"),
})
export const ResendEmail = () => {
const dispatch = useAppDispatch();
const { isSuccess, isError, isLoading, message } = useAppSelector((state) => state.auth)
const initialValues = {
email: "",
};
const formik = useFormik({
initialValues,
validationSchema,
onSubmit: (values) => {
dispatch(resendVerificationEmail(values));
},
})

useEffect(() => {
if (isSuccess) {
toast.success(message)
formik.resetForm()
}
if (isError) {
toast.error(message)
}
})
return (
<>
<Meta title="Resend Email - E-Commerce Ninjas" />
<div className="wrapper">
<div className="container">
{
isLoading ? (
<div className="loading-spinner">
<PuffLoader size={100} color="#FF6D18" loading={isLoading} />
<p>Please wait...</p>
</div>
) : (
<div className="resend-email">
<h2>Resend Email</h2>
<p>Please enter your email address below to resend the verification email.</p>
<form onSubmit={formik.handleSubmit}>
<input
type="email"
placeholder="Email Address"
required
name="email"
id="email"
onChange={formik.handleChange}
onBlur={formik.handleBlur}
value={formik.values.email}
/>
<Button title="Resend" type="submit" />
</form>
</div>
)
}
</div>
</div>
</>
)
}
12 changes: 8 additions & 4 deletions src/components/buttons/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* eslint-disable */
import React from 'react';

import React from "react";
interface ButtonProps {
title: string;
type: "button" | "submit" | "reset";
}

const Button = ({ title }: { title: string }) => (
<button type="button">{title}</button>
const Button: React.FC<ButtonProps> = ({ title, type }) => (
<button type={type}>{title}</button>
);

export default Button;
export default Button;
15 changes: 8 additions & 7 deletions src/components/categories/Categories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable */

import React from "react";
import "../../styles/Categories.scss";

import leftButton from '../../../public/assets/left-bottom.png';
import middle from '../../../public/assets/middle.png';
import rightButton from '../../../public/assets/right-bottom.png';
import rightTop from '../../../public/assets/right-top.png';
function Categories() {
return (
<div className="categories__container">
Expand All @@ -20,7 +21,7 @@ function Categories() {
</div>
<div className="categories__box categories__box__2">
<img
src="left-bottom.png"
src={leftButton}
alt="Product image"
className="categories__img"
/>
Expand All @@ -31,7 +32,7 @@ function Categories() {
</div>
<div className="categories__box categories__box__3">
<img
src="middle.png"
src={middle}
alt="Product image"
className="categories__img"
/>
Expand All @@ -51,7 +52,7 @@ function Categories() {
</div>
<div className="categories__box categories__box__4">
<img
src="right-top.png"
src={rightTop}
alt="Product image"
className="categories__img"
/>
Expand All @@ -64,7 +65,7 @@ function Categories() {
</div>
<div className="categories__box categories__box__5">
<img
src="right-bottom.png"
src={rightButton}
alt="Product image"
className="categories__img"
/>
Expand Down
1 change: 0 additions & 1 deletion src/components/layout/AdminHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import React from "react";
import { IoIosNotifications } from "react-icons/io";
import { FaEnvelope } from "react-icons/fa";
import "../../styles/AdminHeader.scss";

function AdminHeader() {
return (
Expand Down
2 changes: 0 additions & 2 deletions src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { IoLogoFacebook } from "react-icons/io";
import { FaSquareTwitter } from "react-icons/fa6";
import { FaLinkedin } from "react-icons/fa6";

import "../../styles/Footer.scss";

function Footer() {
return (
<footer className="footer">
Expand Down
5 changes: 2 additions & 3 deletions src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { IoLogOutSharp } from "react-icons/io5";
import { FaUserClock } from "react-icons/fa6";
import { FaChevronDown } from "react-icons/fa";
import { NavLink } from "react-router-dom";

import "../../styles/Header.scss";
import Logo from "../../../public/assets/images/logo.png";

import SearchInput from "../inputs/SearchInput";

Expand All @@ -34,7 +33,7 @@ function Header() {
<div className="header__top">
<div className="header__logo">
<img
src="logo.png"
src={Logo}
alt="Ecommerce logo"
className="header__logo__img"
/>
Expand Down
15 changes: 15 additions & 0 deletions src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable */
import React from 'react';
import Header from './Header';
import { Outlet } from 'react-router-dom';
import Footer from './Footer';

export default function Layout() {
return (
<>
<Header />
<Outlet />
<Footer />
</>
);
}
10 changes: 8 additions & 2 deletions src/components/layout/Sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { LiaShippingFastSolid } from "react-icons/lia";
import { FaHandHoldingUsd } from "react-icons/fa";
import { GoDotFill } from "react-icons/go";
import { FaChevronCircleLeft, FaChevronCircleRight } from "react-icons/fa";
import '../../styles/index.scss';

import leftTop from "../../../public/assets/images/left-top.png";
import rightTop from "../../../public/assets/images/right-top.png";
import leftBottom from "../../../public/assets/images/left-bottom.png";
import rightBottom from "../../../public/assets/images/right-bottom.png";
const images = [
'/assets/middle.png',
'/assets/shoe2.jpeg',
Expand Down Expand Up @@ -53,12 +55,14 @@ const Sample: React.FC = () => {
<div className="sampleImages1">
<div className="sample1">
<div className="menShoe">
<img src={leftTop} alt="" />
<div className="text-container">
<p>Men's Shoes</p>
<button>View &gt;</button>
</div>
</div>
<div className="phones">
<img src={leftBottom} alt="" />
<div className="text-container">
<p>Phones</p>
<button>View &gt;</button>
Expand All @@ -84,12 +88,14 @@ const Sample: React.FC = () => {
</div>
<div className="sample3">
<div className="womenShoe">
<img src={rightTop} alt="" />
<div className="text-container">
<p>Women's Shoes</p>
<button>View &gt;</button>
</div>
</div>
<div className="accessories">
<img src={rightBottom} alt="" />
<div className="text-container">
<p>Accessories</p>
<button>View &gt;</button>
Expand Down
Loading
Loading