Skip to content

Commit 1042596

Browse files
comments clean up
1 parent 1feed1f commit 1042596

13 files changed

+9
-43
lines changed

src/actions.ts

+1-25
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,4 @@ export const TOGGLE_CART_ITEM_AMOUNT = 'TOGGLE_CART_ITEM_AMOUNT'
2020
export const CLEAR_CART = 'CLEAR_CART'
2121
export const COUNT_CART_TOTALS = 'COUNT_CART_TOTALS'
2222
export const HANDLE_CLICK_FROM_SERVICES = 'HANDLE_CLICK_FROM_SERVICES'
23-
export const RESET_IS_CLICK_FROM_SERVICES = 'RESET_IS_CLICK_FROM_SERVICES'
24-
25-
// export enum Actions {
26-
// SIDEBAR_OPEN = 'SIDEBAR_OPEN',
27-
// SIDEBAR_CLOSE = 'SIDEBAR_CLOSE',
28-
// GET_PRODUCTS_BEGIN = 'GET_PRODUCTS_BEGIN',
29-
// GET_PRODUCTS_SUCCESS = 'GET_PRODUCTS_SUCCESS',
30-
// GET_PRODUCTS_ERROR = 'GET_PRODUCTS_ERROR',
31-
// GET_SINGLE_PRODUCT_BEGIN = 'GET_SINGLE_PRODUCT_BEGIN',
32-
// GET_SINGLE_PRODUCT_SUCCESS = 'GET_SINGLE_PRODUCT_SUCCESS',
33-
// GET_SINGLE_PRODUCT_ERROR = 'GET_SINGLE_PRODUCT_ERROR',
34-
// LOAD_PRODUCTS = 'LOAD_PRODUCTS',
35-
// SET_GRID_VIEW = 'SET_GRID_VIEW',
36-
// SET_LIST_VIEW = 'SET_LIST_VIEW',
37-
// UPDATE_SORT = 'UPDATE_SORT',
38-
// SORT_PRODUCTS = 'SORT_PRODUCTS',
39-
// UPDATE_FILTERS = 'UPDATE_FILTERS',
40-
// FILTER_PRODUCTS = 'FILTER_PRODUCTS',
41-
// CLEAR_FILTERS = 'CLEAR_FILTERS',
42-
// ADD_TO_CART = 'ADD_TO_CART',
43-
// REMOVE_CART_ITEM = 'REMOVE_CART_ITEM',
44-
// TOGGLE_CART_ITEM_AMOUNT = 'TOGGLE_CART_ITEM_AMOUNT',
45-
// CLEAR_CART = 'CLEAR_CART',
46-
// COUNT_CART_TOTALS = 'COUNT_CART_TOTALS',
47-
// }
23+
export const RESET_IS_CLICK_FROM_SERVICES = 'RESET_IS_CLICK_FROM_SERVICES'

src/assets/logo_word.jpg

-7.56 KB
Binary file not shown.

src/components/AddToCart/AddToCart.tsx src/components/AddToCart.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { useState } from 'react'
22
import styled from 'styled-components'
33
import { Link } from 'react-router-dom'
4-
import { productDataType } from '../../utils/productData'
5-
import { useCartContext } from '../../context/cart_context'
6-
import AmountButtons from '../AmountButtons'
4+
import { productDataType } from '../utils/productData'
5+
import { useCartContext } from '../context/cart_context'
6+
import AmountButtons from './AmountButtons'
77

88
const AddToCart: React.FC<{ singleProduct: productDataType | {} }> = ({
99
singleProduct,

src/components/CheckoutForm.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { useCartContext } from '../context/cart_context'
55
import { formatPrice } from '../utils/helpers'
66
import { useHistory } from 'react-router-dom'
77
import styled from 'styled-components'
8-
98
// Billing info and style from Stripe YouTube tutorial
109
import Row from './Row'
1110
import BillingDetailsFields from './BillingDetailsFields'
@@ -41,7 +40,7 @@ export const CheckoutForm = () => {
4140
}
4241
}
4342

44-
// send cart, totalAmount to netlify function when component mounts
43+
// send cart to netlify function when component mounts
4544
useEffect(() => {
4645
createPaymentIntent()
4746
// eslint-disable-next-line

src/components/Filters/HeightFilters.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ export const HeightFilters = () => {
1313
} = useFilterContext()
1414
const uniqueHeights: any = getUniqueValues(allProducts, 'height', true)
1515

16-
// uniqueHeights.sort((a: string, b: string) => {
17-
// return Number(a.match(/\d+/)![0]) - Number(b.match(/\d+/)![0])
18-
// })
19-
2016
const sortedUniqueHeight = sortUniqueCategoriesByFirstNumber(uniqueHeights)
2117

2218
return (

src/components/Navbar/Logo.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react'
2-
// import logo from '../../assets/logo_word.jpg'
32
import whiteLogo from '../../assets/logo_white.png'
43
import { Link } from 'react-router-dom'
54

src/components/Sidebar/SidebarHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import logo from '../../assets/logo_word.jpg'
2+
import logo from '../../assets/logo_white.png'
33
import { Link } from 'react-router-dom'
44
import { FaTimes } from 'react-icons/fa'
55
import { useProductsContext } from '../../context/products_context'

src/components/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Contact from './Contact/Contact'
88
import FeaturedProducts from './FeaturedProducts/FeaturedProducts'
99
import Loading from './Loading'
1010
import ProductImages from './ProductImages'
11-
import AddToCart from './AddToCart/AddToCart'
11+
import AddToCart from './AddToCart'
1212
import AmountButtons from './AmountButtons'
1313
import Filters from './Filters/Filters'
1414
import ProductList from './ProductList'

src/context/cart_context.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export type cartType = {
1919
}
2020

2121
export type initialStateType = {
22-
// add shipping fee later
2322
cart: cartType[]
2423
totalItems: number
2524
totalAmount: number

src/context/filter_context.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const FilterProvider: React.FC = ({ children }) => {
147147
</FilterContext.Provider>
148148
)
149149
}
150-
// make sure use
150+
151151
export const useFilterContext = () => {
152152
return useContext(FilterContext)
153153
}

src/context/products_context.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const ProductsProvider: React.FC = ({ children }) => {
6161
const singleProduct: productDataType = state.allProducts.filter(
6262
(product: productDataType) => product.slug === slug
6363
)[0]
64-
// running filter() on empty allProducts will result in undefined
64+
// running filter() on empty allProducts [] will result in undefined
6565
// this if clause guard against such case
6666
if (singleProduct) {
6767
dispatch({ type: GET_SINGLE_PRODUCT_SUCCESS, payload: singleProduct })

src/pages/SingleProductPage/SingleProductContent.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ export const SingleProductContent = () => {
1212
return (
1313
<section className='content'>
1414
<h2>{name}</h2>
15-
{/* insert stars component here */}
1615
<h5 className='price'>{price && formatPrice(price)}</h5>
1716
<p className='desc'>{itemDescription}</p>
1817
<p className='info'>
1918
<span>Availability : </span>
2019
{stock ? 'In stock' : 'Out of stock'}
21-
{/* logic showing in stock or out of stock */}
2220
</p>
2321

2422
{brand ? (

src/pages/SingleProductPage/SingleProductPage.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const SingleProductPage = () => {
2121

2222
// when page refreshes, allProducts changes from [] to an array of data from API
2323
// so if state of allProducts changes, run this useEffect too for the case of page refresh
24-
2524
useEffect(() => {
2625
if (slug) {
2726
fetchSingleProduct(slug)

0 commit comments

Comments
 (0)