-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Refactor cart page components, add _redirects
- Loading branch information
1 parent
eb59413
commit 73f5dfd
Showing
11 changed files
with
87 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,45 @@ | ||
npx lint-staged | ||
#npx lint-staged | ||
|
||
|
||
echo ' | ||
💅🛠️ Formatting and testing project before committing... | ||
' | ||
|
||
# Check tsconfig standards | ||
npm run check-types || | ||
( | ||
echo ' | ||
TypeScript Check Failed. ❌ | ||
Make the required changes listed above, add changes and try to commit again. | ||
' | ||
false; | ||
) | ||
|
||
|
||
# Check ESLint Standards | ||
npm run check-lint || | ||
( | ||
echo ' | ||
ESLint Check Failed. ❌ | ||
Make the required changes listed above, add changes and try to commit again. | ||
' | ||
false; | ||
) | ||
|
||
|
||
# Check Prettier standards | ||
npm run check-format-client || | ||
( | ||
echo ' | ||
Prettier Check Failed. ❌ | ||
Run npm run format, add changes and try commit again.'; | ||
false; | ||
) | ||
|
||
npm run check-format-server || | ||
( | ||
echo ' | ||
Prettier Check Failed. ❌ | ||
Run npm run format, add changes and try commit again.'; | ||
false; | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* /index.html 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
import { useAppSelector } from '@/state/store' | ||
import type { CartType } from '@/types' | ||
import styles from './CartPage.module.css' | ||
import { CartItem, CartPriceDetails, EmptyCart, PlaceOrder } from './components' | ||
import { CartPriceDetails, EmptyCart, PlaceOrder } from './components' | ||
import CartItems from './components/cart-items/CartItems' | ||
|
||
export default function CartPage() { | ||
const cartData = useAppSelector((state) => state.cart) | ||
|
||
if (!cartData?.length) return <EmptyCart /> | ||
|
||
return ( | ||
<> | ||
<div className={styles.cartContainer}> | ||
<div> | ||
{cartData?.map((product: CartType) => ( | ||
<CartItem product={product} key={product.id} /> | ||
))} | ||
<PlaceOrder cartData={cartData} /> | ||
</div> | ||
<CartPriceDetails cartData={cartData} /> | ||
<div className={styles.cartContainer}> | ||
<div> | ||
<CartItems /> | ||
<PlaceOrder /> | ||
</div> | ||
</> | ||
<CartPriceDetails /> | ||
</div> | ||
) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useAppSelector } from '@/state/store' | ||
import type { CartType } from '@/types' | ||
import CartItemCard from '../cart-item-card/CartItemCard' | ||
|
||
export default function CartItems() { | ||
const cartData = useAppSelector((state) => state.cart) | ||
|
||
return ( | ||
<> | ||
{cartData?.map((product: CartType) => ( | ||
<CartItemCard product={product} key={product.id} /> | ||
))} | ||
</> | ||
) | ||
} |
8 changes: 3 additions & 5 deletions
8
client/src/pages/cart/components/cart-price-details/CartPriceDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
client/src/pages/product-listing/components/products/Products.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import useFilter from '@/hooks/useFilters' | ||
import type { ProductType } from '@/types' | ||
import ProductCard from '../product-card/ProductCard' | ||
|
||
type Props = { | ||
filteredData: ProductType[] | ||
} | ||
export default function Products() { | ||
const { filteredData } = useFilter() | ||
|
||
export default function Products({ filteredData }: Props) { | ||
return ( | ||
<div> | ||
{filteredData?.map((product) => ( | ||
<> | ||
{filteredData?.map((product: ProductType) => ( | ||
<ProductCard product={product} key={product.id} /> | ||
))} | ||
</div> | ||
</> | ||
) | ||
} |