- Timestamp:
- 10/15/22 15:28:57 (2 years ago)
- Branches:
- master
- Children:
- 113029b
- Parents:
- ee05663
- Location:
- frontend
- Files:
-
- 39 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/package-lock.json
ree05663 r55ed171 22 22 "bootstrap": "^5.2.0", 23 23 "font-awesome": "^4.7.0", 24 "jquery": "^3.6.1", 24 25 "react": "^18.2.0", 25 26 "react-bootstrap": "^2.5.0", 26 27 "react-dom": "^18.2.0", 27 28 "react-helmet-async": "^1.3.0", 29 "react-router-bootstrap": "^0.26.2", 28 30 "react-router-dom": "^6.3.0", 29 31 "react-scripts": "5.0.1", 30 32 "react-toastify": "^9.0.8", 33 "slugify": "^1.6.5", 31 34 "web-vitals": "^2.1.4" 32 35 } … … 11728 11731 } 11729 11732 }, 11733 "node_modules/jquery": { 11734 "version": "3.6.1", 11735 "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", 11736 "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==" 11737 }, 11730 11738 "node_modules/js-tokens": { 11731 11739 "version": "4.0.0", … … 14575 14583 } 14576 14584 }, 14585 "node_modules/react-router-bootstrap": { 14586 "version": "0.26.2", 14587 "resolved": "https://registry.npmjs.org/react-router-bootstrap/-/react-router-bootstrap-0.26.2.tgz", 14588 "integrity": "sha512-YlpI9Xi+Uqp6zFAUO8D/wu6P8mr1ujqq+0V5MhJG1kx9dr/95fAMoGk4J+/CsysOkwtR3tYSac4DDWmHwXvC8w==", 14589 "dependencies": { 14590 "prop-types": "^15.7.2" 14591 }, 14592 "peerDependencies": { 14593 "react": ">=16.13.1", 14594 "react-router-dom": ">=6.0.0" 14595 } 14596 }, 14577 14597 "node_modules/react-router-dom": { 14578 14598 "version": "6.3.0", … … 15434 15454 "engines": { 15435 15455 "node": ">=8" 15456 } 15457 }, 15458 "node_modules/slugify": { 15459 "version": "1.6.5", 15460 "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz", 15461 "integrity": "sha512-8mo9bslnBO3tr5PEVFzMPIWwWnipGS0xVbYf65zxDqfNwmzYn1LpiKNrR6DlClusuvo+hDHd1zKpmfAe83NQSQ==", 15462 "engines": { 15463 "node": ">=8.0.0" 15436 15464 } 15437 15465 }, … … 25737 25765 } 25738 25766 }, 25767 "jquery": { 25768 "version": "3.6.1", 25769 "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", 25770 "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==" 25771 }, 25739 25772 "js-tokens": { 25740 25773 "version": "4.0.0", … … 27620 27653 "requires": { 27621 27654 "history": "^5.2.0" 27655 } 27656 }, 27657 "react-router-bootstrap": { 27658 "version": "0.26.2", 27659 "resolved": "https://registry.npmjs.org/react-router-bootstrap/-/react-router-bootstrap-0.26.2.tgz", 27660 "integrity": "sha512-YlpI9Xi+Uqp6zFAUO8D/wu6P8mr1ujqq+0V5MhJG1kx9dr/95fAMoGk4J+/CsysOkwtR3tYSac4DDWmHwXvC8w==", 27661 "requires": { 27662 "prop-types": "^15.7.2" 27622 27663 } 27623 27664 }, … … 28258 28299 "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" 28259 28300 }, 28301 "slugify": { 28302 "version": "1.6.5", 28303 "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz", 28304 "integrity": "sha512-8mo9bslnBO3tr5PEVFzMPIWwWnipGS0xVbYf65zxDqfNwmzYn1LpiKNrR6DlClusuvo+hDHd1zKpmfAe83NQSQ==" 28305 }, 28260 28306 "sockjs": { 28261 28307 "version": "0.3.24", -
frontend/package.json
ree05663 r55ed171 18 18 "bootstrap": "^5.2.0", 19 19 "font-awesome": "^4.7.0", 20 "jquery": "^3.6.1", 20 21 "react": "^18.2.0", 21 22 "react-bootstrap": "^2.5.0", 22 23 "react-dom": "^18.2.0", 23 24 "react-helmet-async": "^1.3.0", 25 "react-router-bootstrap": "^0.26.2", 24 26 "react-router-dom": "^6.3.0", 25 27 "react-scripts": "5.0.1", 26 28 "react-toastify": "^9.0.8", 29 "slugify": "^1.6.5", 27 30 "web-vitals": "^2.1.4" 28 31 }, -
frontend/src/App.css
ree05663 r55ed171 1 body { 2 overflow-x: hidden; 3 } -
frontend/src/App.js
ree05663 r55ed171 21 21 import OrderHistoryScreen from "./screens/OrderHistoryScreen"; 22 22 import ProfileScreen from "./screens/ProfileScreen"; 23 23 import AdminDashboardScreen from "./screens/AdminDashboardScreen"; 24 import ListProducts from "./components/ListProducts"; 25 import AdminAddProductScreen from "./screens/AdminAddProductScreen"; 26 import AdminProductsScreen from "./screens/AdminProductsScreen"; 27 import AdminEditProductScreen from "./screens/AdminEditProductScreen"; 28 import AdminOrdersScreen from "./screens/AdminOrdersScreen"; 29 import AdminOrderScreen from "./screens/AdminOrderScreen"; 24 30 function App() { 25 31 const { state } = useContext(Store); 26 32 const { cart } = state; 33 //<Route path="/search" element={<AdminProductsScreen />} /> 27 34 return ( 28 35 <BrowserRouter> … … 44 51 <Route path="/order/:id" element={<OrderScreen />} /> 45 52 <Route path="/products" element={<CategoryScreen />} /> 53 <Route path="/admin/dashboard" element={<AdminDashboardScreen />} /> 54 <Route path="/admin/addProduct" element={<AdminAddProductScreen />} /> 55 <Route path="/admin/products" element={<AdminProductsScreen />} /> 56 <Route path="/admin/orders" element={<AdminOrdersScreen />} /> 57 <Route path="/admin/order/:id" element={<AdminOrderScreen />} /> 58 <Route 59 path="/admin/product/:slug" 60 element={<AdminEditProductScreen />} 61 /> 46 62 </Routes> 47 63 -
frontend/src/components/Header.js
ree05663 r55ed171 518 518 <div className="header__right"> 519 519 <div className="header__buttons"> 520 {userInfo ?(520 {userInfo && userInfo.isAdmin && ( 521 521 <NavDropdown 522 522 title={ … … 541 541 <NavDropdown.Item 542 542 onClick={() => { 543 navigate("/ orderhistory");543 navigate("/admin/dashboard"); 544 544 }} 545 545 > 546 Нарачки546 Dashboard 547 547 </NavDropdown.Item> 548 548 … … 556 556 </NavDropdown.Item> 557 557 </NavDropdown> 558 ) : ( 558 )} 559 {userInfo && !userInfo.isAdmin && ( 560 <NavDropdown 561 title={ 562 <span> 563 <AccountCircleIcon 564 className="header__login" 565 fontSize="large" 566 /> 567 <p>{userInfo.name}</p> 568 </span> 569 } 570 id="basic-nav-dropdown" 571 > 572 <NavDropdown.Item 573 onClick={() => { 574 navigate("/profile"); 575 }} 576 > 577 Профил 578 </NavDropdown.Item> 579 580 <NavDropdown.Item 581 onClick={() => { 582 navigate("/orderhistory"); 583 }} 584 > 585 Нарачки 586 </NavDropdown.Item> 587 588 <NavDropdown.Divider /> 589 <NavDropdown.Item 590 className="drowdown-item" 591 to="#signout" 592 onClick={signoutHandler} 593 > 594 Одјави се 595 </NavDropdown.Item> 596 </NavDropdown> 597 )} 598 {!userInfo && ( 559 599 <Link 560 600 to={"/signin"} -
frontend/src/components/Product.js
ree05663 r55ed171 15 15 return ( 16 16 <div className="product__container"> 17 <Link to={`/product/${product.slug}`}> 18 <div className="product__img"> 19 <img src={product.image} alt="product"></img> 17 <Link to={`/product/${product.slug}`} style={{ height: "165.91px" }}> 18 <div className="product__img" style={{ height: "100%" }}> 19 <img 20 src={product.image} 21 alt="product" 22 style={{ height: "100%" }} 23 ></img> 20 24 </div> 21 25 </Link> -
frontend/src/screens/CardPaymentScreen.js
ree05663 r55ed171 41 41 cart.totalPrice = cart.itemsPrice + cart.shippingPrice; 42 42 43 const [cardNumber, setCardNumber] = useState(""); 44 const handleChange = (event) => { 45 const result = event.target.value.replace(/[^0-9]/gi, ""); 46 setCardNumber(result); 47 }; 48 const [ccvNumber, setCcvNumber] = useState(""); 49 const handleChangeCCV = (event) => { 50 const result = event.target.value.replace(/[^0-9]/gi, ""); 51 console.log(event.currentTarget.validity.valid); 52 53 setCcvNumber(result); 54 }; 43 55 const paymentHandler = async (event) => { 44 56 event.preventDefault(); 45 57 const form = event.currentTarget; 46 58 if (form.checkValidity() === false) { 59 event.preventDefault(); 60 event.stopPropagation(); 61 } 62 if (cardNumber.length !== 16) { 47 63 event.preventDefault(); 48 64 event.stopPropagation(); … … 63 79 isPaid: true, 64 80 paidAt: Date.now(), 81 isConfirmed: true, 82 contactNumber: userInfo.contact, 65 83 }, 66 84 { … … 95 113 <Form.Group id="nameInput"> 96 114 <Form.Label>Име и Презиме</Form.Label> 97 <Form.Control 98 type="text" 99 //value={holderName} 100 // onChange={(e) => setHolderName(e.target.value)} 101 required 102 ></Form.Control> 115 <Form.Control type="text" required></Form.Control> 103 116 </Form.Group> 104 117 <Form.Group> … … 106 119 <Form.Control 107 120 type="text" 108 //value={cardNumber} 109 //onChange={(e) => setCardNumber(e.target.value)} 121 minLength="16" 122 maxLength="16" 123 value={cardNumber} 124 onChange={handleChange} 110 125 required 111 126 ></Form.Control> … … 115 130 <Form.Control 116 131 type="text" 117 //value={cvv} 118 //onChange={(e) => setCvv(e.target.value)} 132 minLength={3} 133 maxLength={3} 134 value={ccvNumber} 135 onChange={handleChangeCCV} 119 136 required 120 137 ></Form.Control> -
frontend/src/screens/OrderHistoryScreen.js
ree05663 r55ed171 10 10 import CheckIcon from "@mui/icons-material/Check"; 11 11 import ClearIcon from "@mui/icons-material/Clear"; 12 import PhonePausedIcon from "@mui/icons-material/PhonePaused"; 13 import LocalShippingIcon from "@mui/icons-material/LocalShipping"; 12 14 const reducer = (state, action) => { 13 15 switch (action.type) { … … 49 51 50 52 return ( 51 <div className="pageContainer shipPC" >53 <div className="pageContainer shipPC" style={{ justifyContent: "normal" }}> 52 54 <Helmet> 53 55 <title>Историја на нарачки</title> … … 82 84 {order.isDelivered ? ( 83 85 <CheckIcon></CheckIcon> 86 ) : order.isShipped ? ( 87 <LocalShippingIcon></LocalShippingIcon> 84 88 ) : ( 85 < ClearIcon></ClearIcon>89 <PhonePausedIcon></PhonePausedIcon> 86 90 )} 87 91 </td> -
frontend/src/screens/OrderScreen.js
ree05663 r55ed171 84 84 Доставено на {order.deliveredAt} 85 85 </MessageBox> 86 ) : order.isShipped ? ( 87 <MessageBox variant="primary"> 88 Вашата нарачка е испратена. 89 </MessageBox> 90 ) : order.isConfirmed ? ( 91 <MessageBox variant="primary"> 92 Вашата нарачка се процесира. 93 </MessageBox> 86 94 ) : ( 87 <MessageBox variant="danger">Не е доставено</MessageBox> 95 <MessageBox variant="danger"> 96 Потребно е да ја потврдите нарачката. Ќе бидете контактирани 97 преку телефонскиот број оставен за контакт. 98 </MessageBox> 88 99 )} 89 100 </Card.Body> -
frontend/src/screens/PlaceOrderScreen.js
ree05663 r55ed171 60 60 shippingPrice: cart.shippingPrice, 61 61 totalPrice: cart.totalPrice, 62 isConfirmed: false, 63 contactNumber: userInfo.contact, 62 64 }, 63 65 { -
frontend/src/screens/ProductScreen.js
ree05663 r55ed171 72 72 <img src={product.sideImage} alt={product.name}></img> 73 73 </div> 74 <div className="sideImg"> 75 <img src={product.sideImage2} alt={product.name}></img> 76 </div> 74 77 </div> 75 78 </div> -
frontend/src/screens/ProductScreenBootstrap.js
ree05663 r55ed171 165 165 onClick={changePhoto} 166 166 ></img> 167 168 <img 169 id="sec" 170 src={product.sideImage2} 171 alt={product.name} 172 onClick={changePhoto} 173 ></img> 167 174 </Row> 168 175 -
frontend/src/screens/SigninScreen.js
ree05663 r55ed171 32 32 ctxDispatch({ type: "USER_SIGNIN", payload: data }); 33 33 localStorage.setItem("userInfo", JSON.stringify(data)); 34 navigate(redirect || "/"); 34 if (data.isAdmin) navigate("/admin/dashboard"); 35 else navigate(redirect || "/"); 35 36 } catch (err) { 36 37 toast.error(getError(err));
Note:
See TracChangeset
for help on using the changeset viewer.