Skip to content

Commit d71d12f

Browse files
Part 20: Final UI Changes, ALerts, Popups, Footer, Loaders, Logo
1 parent 077f0da commit d71d12f

21 files changed

+510
-40
lines changed

data.json

+27-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"price": 993,
88
"discountPercentage": 12.96,
99
"rating": 0,
10-
"stock": 94,
10+
"stock": 0,
1111
"brand": "Apple",
1212
"category": "smartphones",
1313
"thumbnail": "https://i.dummyjson.com/data/products/1/thumbnail.jpg",
@@ -35,7 +35,8 @@
3535
"https://i.dummyjson.com/data/products/2/2.jpg",
3636
"https://i.dummyjson.com/data/products/2/3.jpg",
3737
"https://i.dummyjson.com/data/products/2/thumbnail.jpg"
38-
]
38+
],
39+
"deleted": true
3940
},
4041
{
4142
"id": 3,
@@ -50,7 +51,8 @@
5051
"thumbnail": "https://i.dummyjson.com/data/products/3/thumbnail.jpg",
5152
"images": [
5253
"https://i.dummyjson.com/data/products/3/1.jpg"
53-
]
54+
],
55+
"deleted": true
5456
},
5557
{
5658
"id": 4,
@@ -2402,7 +2404,28 @@
24022404
"id": 3
24032405
}
24042406
],
2405-
"cart": [],
2407+
"cart": [
2408+
{
2409+
"title": "Huawei P30",
2410+
"description": "Huawei’s re-badged P30 Pro New Edition was officially unveiled yesterday in Germany and now the device has made its way to the UK.",
2411+
"price": 499,
2412+
"discountPercentage": 10.58,
2413+
"rating": 4.09,
2414+
"stock": 32,
2415+
"brand": "Huawei",
2416+
"category": "smartphones",
2417+
"thumbnail": "https://i.dummyjson.com/data/products/5/thumbnail.jpg",
2418+
"images": [
2419+
"https://i.dummyjson.com/data/products/5/1.jpg",
2420+
"https://i.dummyjson.com/data/products/5/2.jpg",
2421+
"https://i.dummyjson.com/data/products/5/3.jpg"
2422+
],
2423+
"productId": 5,
2424+
"quantity": 1,
2425+
"user": 2,
2426+
"id": 1
2427+
}
2428+
],
24062429
"orders": [
24072430
{
24082431
"items": [

package-lock.json

+175
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
"@testing-library/react": "^13.4.0",
1313
"@testing-library/user-event": "^14.4.3",
1414
"react": "^18.2.0",
15+
"react-alert": "^7.0.3",
16+
"react-alert-template-basic": "^1.0.2",
1517
"react-dom": "^18.2.0",
1618
"react-hook-form": "^7.43.9",
19+
"react-loader-spinner": "^5.3.4",
1720
"react-redux": "^8.0.5",
1821
"react-router-dom": "^6.10.0",
1922
"react-scripts": "5.0.1",

public/ecommerce.png

3.18 KB
Loading

src/App.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ import AdminHome from './pages/AdminHome';
2525
import AdminProductDetailPage from './pages/AdminProductDetailPage';
2626
import AdminProductFormPage from './pages/AdminProductFormPage';
2727
import AdminOrdersPage from './pages/AdminOrdersPage';
28+
import { positions, Provider } from 'react-alert';
29+
import AlertTemplate from 'react-alert-template-basic';
30+
31+
const options = {
32+
timeout: 5000,
33+
position: positions.BOTTOM_LEFT,
34+
};
35+
2836
const router = createBrowserRouter([
2937
{
3038
path: '/',
@@ -146,7 +154,9 @@ function App() {
146154
return (
147155
<>
148156
<div className="App">
149-
<RouterProvider router={router} />
157+
<Provider template={AlertTemplate} {...options}>
158+
<RouterProvider router={router} />
159+
</Provider>
150160
{/* Link must be inside the Provider */}
151161
</div>
152162
</>

src/features/admin/components/AdminProductList.js

+5
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,11 @@ function ProductGrid({ products }) {
523523
<p className="text-sm text-red-400">product deleted</p>
524524
</div>
525525
)}
526+
{product.stock<=0 && (
527+
<div>
528+
<p className="text-sm text-red-400">out of stock</p>
529+
</div>
530+
)}
526531
</div>
527532
</Link>
528533
<div className="mt-5">

0 commit comments

Comments
 (0)