Changeset 55ed171 for frontend/src
- Timestamp:
- 10/15/22 15:28:57 (2 years ago)
- Branches:
- master
- Children:
- 113029b
- Parents:
- ee05663
- Location:
- frontend/src
- Files:
-
- 9 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
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.