Commit 5eb2e522 authored by Kyle Muldoon's avatar Kyle Muldoon

Merge branch 'master' of https://gitlab.mynisum.com/ascend/ecommerce-maven...

Merge branch 'master' of https://gitlab.mynisum.com/ascend/ecommerce-maven into AFP45-Display-User-Cart-And-Update-Items-Within

Pulling UI changes into this branch
parents 59ca132e 40e8df70
...@@ -14,13 +14,18 @@ spec: ...@@ -14,13 +14,18 @@ spec:
spec: spec:
containers: containers:
- name: afp-ecom-api-container - name: afp-ecom-api-container
image: nexus.mynisum.com/afp-ecom-api:11 image: nexus.mynisum.com/afp-ecom-api:13
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
- containerPort: 8084 - containerPort: 8084
env: env:
- name: PORT - name: PORT
value: "8080" value: "8080"
- name: MONGOCONNECTION
valueFrom:
secretKeyRef:
name: mongodb-secret
key: spring.data.mongodb.uri
imagePullSecrets: imagePullSecrets:
- name: registry-creds - name: registry-creds
......
spring.data.mongodb.uri=mongodb+srv://ecom:ecom@e-commerce-db-cluster.va815.mongodb.net/e-commerce-db?retryWrites=true&w=majority
spring.data.mongodb.database=e-commerce-db spring.data.mongodb.database=e-commerce-db
security.enable-csrf=false security.enable-csrf=false
server.port=8080 server.port=8080
...@@ -19,4 +19,4 @@ export const updateUserCart = (updatedCart, userEmail) => dispatch => ApiUtil.up ...@@ -19,4 +19,4 @@ export const updateUserCart = (updatedCart, userEmail) => dispatch => ApiUtil.up
.then(cart => dispatch(receiveUserCart(cart))); .then(cart => dispatch(receiveUserCart(cart)));
export const createUserCart = newCart => dispatch => ApiUtil.createCart(newCart) export const createUserCart = newCart => dispatch => ApiUtil.createCart(newCart)
.then(res => res.json) .then(res => res.json)
\ No newline at end of file
import { connect } from 'react-redux';
import HeaderCart from './header-cart';
const mSTP = state => ({
});
const mDTP = dispatch => ({
});
export default connect(mSTP, mDTP)(HeaderCart);
\ No newline at end of file
import React, { Component } from 'react'
import './header.css';
export default class HeaderCart extends Component {
constructor(props) {
super(props)
this.state = {}
}
render() {
return (
<div>
Cart
</div>
)
}
}
\ No newline at end of file
...@@ -2,7 +2,7 @@ import { connect } from 'react-redux'; ...@@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import Header from './header'; import Header from './header';
const mSTP = state => ({ const mSTP = state => ({
user: state.user
}); });
const mDTP = dispatch => ({ const mDTP = dispatch => ({
......
.order-history-nav, /* .order-history-nav,
.products-nav, .products-nav,
#nav-bar-text, #nav-bar-text,
.cart-nav { .cart-nav {
...@@ -6,19 +6,18 @@ ...@@ -6,19 +6,18 @@
padding-top: 11px; padding-top: 11px;
padding-bottom: 10px; padding-bottom: 10px;
color: white; color: white;
} } */
.nav-home { .header-nav {
color: white; padding-left: 20px;
font-size: 20px; box-shadow: 0px 1px 10px;
margin-left: 10px;
} }
#nav-home-link { /* #nav-home-link {
margin-bottom: 3px; margin-bottom: 3px;
} */
.nav-bar-text {
padding-right: 20px;
} }
#nav-bar-text {
opacity: 0.6;
cursor: default;
}
\ No newline at end of file
import React, { Component } from 'react' import React, { Component } from 'react'
import Nav from 'react-bootstrap/Nav' import Nav from 'react-bootstrap/Nav'
import Navbar from 'react-bootstrap/Navbar' import Navbar from 'react-bootstrap/Navbar'
// import NavDropdown from 'react-bootstrap/NavDropdown' import NavDropdown from 'react-bootstrap/NavDropdown'
import {NavLink} from 'react-router-dom' import {NavLink} from 'react-router-dom'
import Session from '../session/session-container' import Session from '../session/session-container'
import HeaderCart from './header-cart-container'
import './header.css'; import './header.css';
export default class Header extends Component { export default class Header extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = {} this.state = {}
} }
render() { render() {
let userName
if(!!this.props.user?.currentUser){
userName = this.props.user.currentUser.firstName
}else{
userName = "Guest"
}
return ( return (
<div> <div>
<Navbar collapseOnSelect expand="lg" bg="primary" variant="dark"> <Navbar className = "header-nav" collapseOnSelect expand="sm" bg="light">
<Navbar.Brand>Ascend Ecommerce</Navbar.Brand>
<Navbar.Toggle aria-controls="responsive-navbar-nav" /> <Navbar.Toggle aria-controls="responsive-navbar-nav" />
<NavLink to="/product-market" id="nav-home-link"><span className="nav-home">Ascend Ecommerce</span></NavLink>
<Navbar.Collapse id="responsive-navbar-nav"> <Navbar.Collapse id="responsive-navbar-nav">
<Nav > <Nav className="mr-auto">
<Navbar.Text id="nav-bar-text"> <Nav.Link to="/product-market" id="nav-home-link">Home</Nav.Link>
Hello Guest! <Nav.Link to="/product-market">Products</Nav.Link>
</Navbar.Text>
</Nav> </Nav>
<NavLink to="/product-market"><span className="products-nav">Products</span></NavLink>
<NavLink to="/orders"><span className="order-history-nav">Order History</span></NavLink>
<NavLink to="/cart"><span className="cart-nav">Cart</span></NavLink>
<Nav className="ms-auto"> <Nav className="ms-auto">
<Session /> {!this.props.user?.currentUser ?
<Navbar.Text className="nav-bar-text">Hello Guest</Navbar.Text> :
<NavDropdown className="nav-bar-text" title={"Hello "+userName} id="collasible-nav-dropdown">
<NavDropdown.Item ><NavLink to="/orders">Order History</NavLink></NavDropdown.Item>
</NavDropdown>
}
<Session className="nav-bar-text"/>
<HeaderCart className="nav-bar-text"/>
</Nav> </Nav>
</Navbar.Collapse> </Navbar.Collapse>
</Navbar> </Navbar>
......
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Checkout from './checkout'; import Checkout from './checkout.js';
const mSTP = state => ({ const mSTP = state => ({
...@@ -8,5 +8,4 @@ const mSTP = state => ({ ...@@ -8,5 +8,4 @@ const mSTP = state => ({
const mDTP = dispatch => ({ const mDTP = dispatch => ({
}); });
export default connect(mSTP, mDTP)(Checkout); export default connect(mSTP, mDTP)(Checkout);
\ No newline at end of file
...@@ -85,15 +85,18 @@ export default class ProductDetails extends Component { ...@@ -85,15 +85,18 @@ export default class ProductDetails extends Component {
<form className="details-add-cart-and-quantity" onSubmit={ e => this.handleSubmit(e, this.props.product) }> <form className="details-add-cart-and-quantity" onSubmit={ e => this.handleSubmit(e, this.props.product) }>
<input <input
type="number" type="number"
className="prod-details-quantity" className="prod-details-quantity"
id={ this.props.user?.currentUser ? "" : "disabled" }
disabled={ !this.props.user?.currentUser } disabled={ !this.props.user?.currentUser }
onChange={this.handleChange("orderItemQuantity")} onChange={this.handleChange("orderItemQuantity")}
placeholder="Quantity" placeholder="Quantity"
value={ this.state.orderItemQuantity } value={ this.state.orderItemQuantity }
/> />
<button className="prod-details-add-to-cart" disabled={ !this.props.user?.currentUser }> <button
Add to Cart className="prod-details-add-to-cart"
</button> id={ this.props.user?.currentUser ? "" : "disabled" }
disabled={ !this.props.user?.currentUser
}>Add to Cart</button>
{ this.props.user?.currentUser ? "" :<p id="details-please-log-in-notice">Log in to Add to Cart</p>} { this.props.user?.currentUser ? "" :<p id="details-please-log-in-notice">Log in to Add to Cart</p>}
</form> </form>
</div> </div>
......
...@@ -83,33 +83,45 @@ export default class ProductItem extends Component { ...@@ -83,33 +83,45 @@ export default class ProductItem extends Component {
} }
</div> </div>
<p id="prod-name">{ this.props.item.productName }</p> <p id="prod-name">{ this.props.item.productName }</p>
<div id="prod-price"> <div className="product-price-promo-quantity-add-cart">
{ this.props.item.promo ? <div className="price-and-promo">
<div id="promo-show"> <div id="prod-price">
<p id="promo-show-text-original"> { this.props.item.promo ?
${ this.props.item.price } <div id="promo-show">
</p> <p id="promo-show-text-original">
<p id="promo-show-text"> ${ this.props.item.price }
${ discount } </p>
</p> <p id="promo-show-text">
</div> : "$" + this.props.item.price } ${ discount }
</p>
</div> : "$" + this.props.item.price }
</div>
{ this.props.item.promo ?
<p id="prod-promotion">
{ "Save " + this.props.item.promo + "%!"}
</p> : ""}
</div>
<form onSubmit={ e => this.handleSubmit(e, this.props.item) } className="add-cart-and-quantity">
{ this.props.user?.currentUser ? "" :<p id="please-log-in-notice">Log in to <br /> Add to Cart</p>}
<p id="quantity-text">Qty</p>
<input
className="order-quantity"
id={ this.props.user?.currentUser ? "" : "disabled" }
type="number"
placeholder="Qty"
disabled={ !this.props.user?.currentUser }
onChange={ this.handleChange("orderItemQuantity") }
value = { this.state.orderItemQuantity }
min="1"
max="99"
/>
<button
disabled={ !this.props.user?.currentUser }
className="add-to-cart-button"
id={ this.props.user?.currentUser ? "" : "disabled" }
>Add to Cart</button>
</form>
</div> </div>
{ this.props.item.promo ?
<p id="prod-promotion">
{ "Save " + this.props.item.promo + "% on this item!"}
</p> : ""}
<form onSubmit={ e => this.handleSubmit(e, this.props.item) } className="add-cart-and-quantity">
{ this.props.user?.currentUser ? "" :<p id="please-log-in-notice">Log in to Add to Cart</p>}
<input
className="order-quantity"
type="number"
placeholder="Qty"
disabled={ !this.props.user?.currentUser }
onChange={ this.handleChange("orderItemQuantity") }
value = { this.state.orderItemQuantity }
/>
<button disabled={ !this.props.user?.currentUser } className="add-to-cart-button">Add to Cart</button>
</form>
<Modal <Modal
id="product-details-modal" id="product-details-modal"
......
...@@ -38,7 +38,8 @@ export default class ProductMarket extends Component { ...@@ -38,7 +38,8 @@ export default class ProductMarket extends Component {
<div className="products-container"> <div className="products-container">
{this.props.products.map(prod => { {this.props.products.map(prod => {
return ( return (
<div className={prod.productName ? "product-item-container" : "no-item"} key={ prod.sku }> <div className={prod.availableStock >= 0 ? "product-item-container" : "no-item"} key={ prod.sku }>
{ prod.availableStock >= 0 ? "" : <p id="out-of-stock">- Out of Stock -</p> }
{ prod.productName ? { prod.productName ?
<ProductItem <ProductItem
item={ prod } item={ prod }
...@@ -46,7 +47,7 @@ export default class ProductMarket extends Component { ...@@ -46,7 +47,7 @@ export default class ProductMarket extends Component {
user={ this.props.user } user={ this.props.user }
addToCart={ this.props.addCartItem } addToCart={ this.props.addCartItem }
/> />
: :
<div className="product-item"> <div className="product-item">
<p id="prod-not-available">This Product is No Longer Available</p> <p id="prod-not-available">This Product is No Longer Available</p>
</div> </div>
......
...@@ -15,4 +15,4 @@ const cartReducer = (state = initialState, action) => { ...@@ -15,4 +15,4 @@ const cartReducer = (state = initialState, action) => {
} }
} }
export default cartReducer; export default cartReducer;
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
background-color: rgb(231, 228, 228);
} }
#product-market-title { #product-market-title {
...@@ -34,7 +35,23 @@ ...@@ -34,7 +35,23 @@
} }
.no-item { .no-item {
display: none; pointer-events: none;
position: relative;
width: 330px;
height: 335px;
margin: 8px;
opacity: 0.6;
}
#out-of-stock {
background: white;
position: absolute;
width: 100%;
text-align: center;
font-size: 35px;
top: 80px;
opacity: 0.5;
z-index: 50;
} }
.product-item { .product-item {
...@@ -42,14 +59,19 @@ ...@@ -42,14 +59,19 @@
height: 100%; height: 100%;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
box-shadow: 3px 4px 6px;
border-radius: 8px;
background-color: white;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border: 1px solid gray; border: 1px solid lightgray;
transition: all 0.5s; transition: all 0.5s;
} }
.product-item:hover { .product-item:hover {
transform: scale(1.03); transform: scale(1.03);
box-shadow: 5px 6px 10px;
border-color: gray;
} }
#prod-img { #prod-img {
...@@ -109,10 +131,20 @@ ...@@ -109,10 +131,20 @@
#prod-price { #prod-price {
font-size: 18px; font-size: 18px;
font-size: 18px;
display: flex;
justify-content: center;
align-items: center;
} }
#prod-promotion { #prod-promotion {
font-size: 17px;
color: red; color: red;
padding-bottom: 6px;
}
#quantity-text {
padding-top: 4px;
} }
.add-to-cart-button { .add-to-cart-button {
...@@ -139,6 +171,9 @@ ...@@ -139,6 +171,9 @@
#promo-show { #promo-show {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 5px;
padding-top: 2px;
height: 24px;
} }
#promo-show-text, #promo-show-text-original { #promo-show-text, #promo-show-text-original {
...@@ -166,7 +201,7 @@ ...@@ -166,7 +201,7 @@
outline: none; outline: none;
height: 30px; height: 30px;
padding: 6px; padding: 6px;
width: 42px; width: 47px;
transition: all 0.5s; transition: all 0.5s;
} }
.order-quantity:focus { .order-quantity:focus {
...@@ -176,15 +211,20 @@ ...@@ -176,15 +211,20 @@
.add-cart-and-quantity { .add-cart-and-quantity {
display: flex; display: flex;
position: relative; position: relative;
flex-wrap: wrap;
width: 50%;
justify-content: center;
} }
#please-log-in-notice { #please-log-in-notice {
display: none; display: none;
position: absolute; position: absolute;
bottom: 47px; text-align: center;
left: 22px; bottom: 50px;
width: 80%;
padding: 3px 10px; padding: 3px 10px;
border-radius: 5px; border-radius: 5px;
cursor: default;
background-color: rgb(248, 76, 76); background-color: rgb(248, 76, 76);
animation: fadeInUp; animation: fadeInUp;
...@@ -408,8 +448,27 @@ ...@@ -408,8 +448,27 @@
color: red; color: red;
} }
input::-webkit-outer-spin-button, .product-price-promo-quantity-add-cart {
width: 100%;
display: flex;
background-color: rgba(202, 202, 202, 0.6);
padding-top: 9px;
margin-bottom: -4px;
border-radius: 0px 0px 7px 7px;
}
.price-and-promo {
width: 50%;
display: flex;
flex-wrap: wrap;
}
#disabled {
pointer-events: none;
}
/* input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { input::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} } */
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment