Skip to content
This repository was archived by the owner on Mar 3, 2024. It is now read-only.

Commit 93aba11

Browse files
committed
updates and cleanup
1 parent 9fca6c5 commit 93aba11

File tree

66 files changed

+131
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+131
-167
lines changed

client/src/components/App.js

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Footer from "./views/Footer/Footer";
1010
import UploadProductPage from "./views/UploadProductPage/UploadProductPage";
1111
import ProductPage from "./views/ProductPage/ProductPage";
1212
import CartPage from "./views/CartPage/CartPage";
13+
import HistoryPage from "./views/HistoryPage/HistoryPage";
1314
//null Anyone Can go inside
1415
//true only logged in user can go inside
1516
//false logged in user can't go inside
@@ -34,6 +35,7 @@ function App() {
3435
component={Auth(ProductPage, null)}
3536
/>
3637
<Route exact path="/user/cart" component={Auth(CartPage, true)} />
38+
<Route exact path="/history" component={Auth(HistoryPage, true)} />
3739
</Switch>
3840
</div>
3941
<Footer />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React, { useEffect, useState } from "react";
2+
import Axios from "axios";
3+
4+
function HistoryPage() {
5+
const [History, setHistory] = useState([]);
6+
7+
useEffect(() => {
8+
Axios.get("/api/users/getHistory").then((response) => {
9+
if (response.data.success) {
10+
setHistory(response.data.history);
11+
} else {
12+
alert("You have been 404'd. Failed to load page.");
13+
}
14+
});
15+
}, []);
16+
return (
17+
<div style={{ width: "80%", margin: "3rem auto" }}>
18+
<div style={{ textAlign: "center" }}>
19+
<h1>History</h1>
20+
</div>
21+
<br />
22+
<table>
23+
<thead>
24+
<tr>
25+
<th>Payment ID</th>
26+
<th>Price</th>
27+
<th>Quantity</th>
28+
<th>Date of Purchase</th>
29+
</tr>
30+
</thead>
31+
<tbody>
32+
{History.map((item) => (
33+
<tr key={item._id}>
34+
<td>{item.paymentId}</td>
35+
<td>{item.price}</td>
36+
<td>{item.quantity}</td>
37+
<td>{item.dateOfPurchase}</td>
38+
</tr>
39+
))}
40+
</tbody>
41+
</table>
42+
</div>
43+
);
44+
}
45+
46+
export default HistoryPage;

client/src/components/views/LandingPage/LandingPage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function LandingPage() {
5757

5858
setPostSize(response.data.postSize);
5959
} else {
60-
alert("Failed to delivered your product");
60+
alert("You have been 404'd. Failed to load page.");
6161
}
6262
});
6363
};
@@ -136,7 +136,7 @@ function LandingPage() {
136136
<div style={{ width: "75%", margin: "3rem auto" }}>
137137
<div style={{ textAlign: "center" }}>
138138
<h2>
139-
JayBee's Shop <Icon type="shop" />
139+
JB's Headset Shop <Icon type="shop" />
140140
</h2>
141141
</div>
142142

client/src/components/views/NavBar/NavBar.js

+57-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,69 @@
1-
import React, { useState } from 'react';
2-
import LeftMenu from './Sections/LeftMenu';
3-
import RightMenu from './Sections/RightMenu';
4-
import { Drawer, Button, Icon } from 'antd';
5-
import './Sections/Navbar.css';
1+
import React, { useState } from "react";
2+
import LeftMenu from "./Sections/LeftMenu";
3+
import RightMenu from "./Sections/RightMenu";
4+
import { Drawer, Button, Icon } from "antd";
5+
import "./Sections/Navbar.css";
66

77
function NavBar() {
8-
const [visible, setVisible] = useState(false)
8+
const [visible, setVisible] = useState(false);
99

1010
const showDrawer = () => {
11-
setVisible(true)
11+
setVisible(true);
1212
};
1313

1414
const onClose = () => {
15-
setVisible(false)
15+
setVisible(false);
1616
};
1717

1818
return (
19-
<nav className="menu" style={{ position: 'fixed', zIndex: 5, width: '100%' }}>
19+
<nav
20+
className="menu"
21+
style={{ position: "fixed", zIndex: 5, width: "100%" }}
22+
>
2023
<div className="menu__logo">
21-
<a href="/">Logo</a>
24+
<a href="/">
25+
JB's
26+
<svg height="35" viewBox="0 0 70 35">
27+
<g>
28+
<path
29+
id="svg_1"
30+
fill-rule="nonzero"
31+
fill="rgb(41.176471%,44.705882%,85.490196%)"
32+
d="m30.89453,25.57813l-20.23047,0c-0.46875,0 -0.875,-0.32422 -0.98047,-0.78516l-5.10156,-22.10156l-3.57422,0c-0.55468,0 -1.00781,-0.44922 -1.00781,-1.00782c0,-0.55859 0.45313,-1.01171 1.00781,-1.01171l4.375,0c0.47266,0 0.87891,0.32421 0.98438,0.78515l5.10156,22.10156l19.42578,0c0.5586,0 1.00781,0.44922 1.00781,1.00782c0,0.55859 -0.44921,1.01172 -1.00781,1.01172zm0,0"
33+
/>
34+
<path
35+
id="svg_2"
36+
fill-rule="nonzero"
37+
fill="rgb(8.627451%,57.254902%,100%)"
38+
d="m34.77734,5.08984c-0.1914,-0.23828 -0.48046,-0.3789 -0.78515,-0.3789l-27.67578,0c-0.3086,0 -0.59766,0.14062 -0.78907,0.38281c-0.1914,0.23828 -0.26562,0.55469 -0.19531,0.85547l3.10547,13.46094c0.10938,0.45703 0.51563,0.78125 0.98438,0.78125l21.53906,0c0.47265,0 0.88281,-0.32813 0.98437,-0.78516l3.03125,-13.46484c0.06641,-0.29688 -0.00781,-0.61328 -0.19922,-0.85157zm0,0"
39+
/>
40+
<path
41+
id="svg_3"
42+
fill-rule="nonzero"
43+
fill="rgb(41.176471%,44.705882%,85.490196%)"
44+
d="m14.80859,26.92188c-2.04296,0 -3.70312,1.66015 -3.70312,3.70312c0,2.04297 1.66016,3.70313 3.70312,3.70313c2.03907,0 3.69922,-1.66016 3.69922,-3.70313c0,-2.04297 -1.66015,-3.70312 -3.69922,-3.70312zm0,0"
45+
/>
46+
<path
47+
id="svg_4"
48+
fill-rule="nonzero"
49+
fill="rgb(30.980392%,36.862745%,77.647059%)"
50+
d="m26.92188,26.92188c-2.03907,0 -3.69922,1.66015 -3.69922,3.70312c0,2.04297 1.66015,3.70313 3.69922,3.70313c2.04296,0 3.70312,-1.66016 3.70312,-3.70313c0,-2.04297 -1.66016,-3.70312 -3.70312,-3.70312zm0,0"
51+
/>
52+
<path
53+
id="svg_5"
54+
fill-rule="nonzero"
55+
fill="rgb(30.980392%,36.862745%,77.647059%)"
56+
d="m30.89453,23.55859l-13.39453,0l0,2.01954l13.39453,0c0.5586,0 1.00781,-0.45313 1.00781,-1.01172c0,-0.5586 -0.44921,-1.00782 -1.00781,-1.00782zm0,0"
57+
/>
58+
<path
59+
id="svg_6"
60+
fill-rule="nonzero"
61+
fill="rgb(0%,49.803922%,86.666667%)"
62+
d="m33.99219,4.71094l-16.49219,0l0,15.48047l13.46094,0c0.47265,0 0.88281,-0.32813 0.98437,-0.78516l3.03125,-13.46484c0.06641,-0.29688 -0.00781,-0.61328 -0.19922,-0.85157c-0.1914,-0.23828 -0.48046,-0.3789 -0.78515,-0.3789zm0,0"
63+
/>
64+
</g>
65+
</svg>
66+
</a>
2267
</div>
2368
<div className="menu__container">
2469
<div className="menu_left">
@@ -47,7 +92,7 @@ function NavBar() {
4792
</Drawer>
4893
</div>
4994
</nav>
50-
)
95+
);
5196
}
5297

53-
export default NavBar
98+
export default NavBar;
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
1-
import React from 'react';
2-
import { Menu } from 'antd';
3-
const SubMenu = Menu.SubMenu;
4-
const MenuItemGroup = Menu.ItemGroup;
1+
import React from "react";
2+
import { Menu } from "antd";
53

64
function LeftMenu(props) {
75
return (
86
<Menu mode={props.mode}>
9-
<Menu.Item key="mail">
10-
<a href="/">Home</a>
11-
</Menu.Item>
12-
<SubMenu title={<span>Blogs</span>}>
13-
<MenuItemGroup title="Item 1">
14-
<Menu.Item key="setting:1">Option 1</Menu.Item>
15-
<Menu.Item key="setting:2">Option 2</Menu.Item>
16-
</MenuItemGroup>
17-
<MenuItemGroup title="Item 2">
18-
<Menu.Item key="setting:3">Option 3</Menu.Item>
19-
<Menu.Item key="setting:4">Option 4</Menu.Item>
20-
</MenuItemGroup>
21-
</SubMenu>
22-
</Menu>
23-
)
7+
<Menu.Item key="mail">
8+
<a href="/">Home</a>
9+
</Menu.Item>
10+
</Menu>
11+
);
2412
}
2513

26-
export default LeftMenu
14+
export default LeftMenu;

client/src/components/views/NavBar/Sections/Navbar.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '~antd/dist/antd.css';
1+
@import "~antd/dist/antd.css";
22

33
.menu {
44
padding: 0 20px;
@@ -84,4 +84,4 @@
8484
.menu__logo a {
8585
padding: 10px 20px;
8686
}
87-
}
87+
}

client/src/components/views/NavBar/Sections/RightMenu.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ function RightMenu(props) {
3737
<a href="/product/upload">Upload</a>
3838
</Menu.Item>
3939

40+
<Menu.Item key="history">
41+
<a href="/history">History</a>
42+
</Menu.Item>
43+
4044
<Menu.Item key="cart">
41-
<Badge count={1}>
45+
<Badge count={user.userData && user.userData.cart.length}>
4246
<a href="/user/cart" style={{ marginRight: -22, color: "#667777" }}>
4347
<Icon
4448
type="shopping-cart"

client/src/components/views/UploadProductPage/UploadProductPage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function UploadProductPage(props) {
6666
alert("Product posted!");
6767
props.history.push("/");
6868
} else {
69-
alert("Failed to Upload Product :(");
69+
alert("You have been 404'd. Failed to load page.");
7070
}
7171
});
7272
};

server/routes/users.js

+8
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,12 @@ router.post("/successBuy", auth, (req, res) => {
204204
);
205205
});
206206

207+
router.get("/getHistory", auth, (req, res) => {
208+
User.findOne({ _id: req.user._id }, (err, doc) => {
209+
let history = doc.history;
210+
if (err) return res.status(400).send(err);
211+
return res.status(200).json({ success: true, history });
212+
});
213+
});
214+
207215
module.exports = router;
-37.7 KB
Binary file not shown.

uploads/1591459440955_image.png

-189 KB
Binary file not shown.
Binary file not shown.

uploads/1591459503956_london.jpg

-191 KB
Binary file not shown.

uploads/1591459538091_customer-3.jpg

-8.38 KB
Binary file not shown.

uploads/1591459541258_customer-2.jpg

-10.4 KB
Binary file not shown.

uploads/1591459544885_customer-1.jpg

-10 KB
Binary file not shown.

uploads/1591654474135_lisbon-3.jpg

-195 KB
Binary file not shown.

uploads/1591654478169_logo.png

-33.7 KB
Binary file not shown.

uploads/1591654527952_berlin.jpg

-503 KB
Binary file not shown.

uploads/1591654533422_7.jpg

-194 KB
Binary file not shown.
-146 KB
Binary file not shown.
-9.39 KB
Binary file not shown.

uploads/1591654609850_logo-white.png

-31.2 KB
Binary file not shown.

uploads/1591654619596_app-iPhone.png

-772 KB
Binary file not shown.

0 commit comments

Comments
 (0)