Skip to content

Commit

Permalink
Merge pull request #50 from imranhsayed/feature/latest-plugin-version…
Browse files Browse the repository at this point in the history
…-updates

Latest plugin version updates
  • Loading branch information
imranhsayed authored Dec 29, 2020
2 parents 6c2edf6 + a245021 commit 7ffb8b0
Show file tree
Hide file tree
Showing 30 changed files with 5,106 additions and 4,509 deletions.
5 changes: 0 additions & 5 deletions package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-woocommerce-themes",
"version": "1.0.4",
"version": "2.0.1",
"private": true,
"description": "Gatsby WooCommerce Theme Project",
"main": "index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { ImageFragment } = require('../image/index.js');
const ProductsFragment = `
fragment ProductsFragment on WpProduct {
id
productId
databaseId
nodeType
link
description
Expand Down
25 changes: 14 additions & 11 deletions packages/gatsby-woocommerce-theme/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-woocommerce-theme",
"version": "1.0.4",
"version": "2.0.1",
"description": "Gatsby WooCommerce Theme - Electra",
"main": "index.js",
"author": "Imran Sayed",
Expand All @@ -21,20 +21,21 @@
"gatsby": "^2.24.2",
"jest": "^26.1.0",
"prettier": "^2.0.5",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-test-renderer": "^16.13.1",
"sass-loader": "^9.0.2",
"styled-components": "^5.1.1"
},
"dependencies": {
"@apollo/client": "^3.1.3",
"@wordpress/base-styles": "^2.0.0",
"@wordpress/block-library": "^2.22.0",
"@wordpress/base-styles": "^3.3.0",
"@wordpress/block-library": "^2.27.0",
"bootstrap": "^4.5.2",
"classnames": "^2.2.6",
"cross-fetch": "^3.0.5",
"dompurify": "^2.0.14",
"gatsby": "2.24.74",
"gatsby-link": "^2.4.13",
"gatsby-plugin-google-tagmanager": "^2.3.11",
"gatsby-plugin-manifest": "^2.4.18",
Expand All @@ -44,13 +45,15 @@
"gatsby-plugin-sass": "^2.3.12",
"gatsby-plugin-sharp": "^2.6.19",
"gatsby-source-filesystem": "^2.3.19",
"gatsby-source-wordpress-experimental": "1.3.6",
"gatsby-source-wordpress-experimental": "^6.0.0",
"gatsby-transformer-sharp": "^2.5.11",
"isomorphic-fetch": "^2.2.1",
"js-search": "^2.0.0",
"lodash": "^4.17.19",
"node-sass": "^4.14.1",
"prop-types": "^15.7.2",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-helmet": "^6.1.0",
"react-js-pagination": "^3.0.3",
"react-lazy-load-image-component": "^1.5.0",
Expand All @@ -63,9 +66,9 @@
"validator": "^13.1.1"
},
"peerDependencies": {
"gatsby": "^2.21.33",
"react": "^16.13.1",
"react-dom": "^16.13.1"
"gatsby": "^2.24.74",
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"keywords": [
"gatsby",
Expand All @@ -79,8 +82,8 @@
],
"homepage": "https://github.com/imranhsayed/gatsby-woocommerce-themes#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/imranhsayed/gatsby-woocommerce-themes.git"
"type": "git",
"url": "git+https://github.com/imranhsayed/gatsby-woocommerce-themes.git"
},
"bugs": {
"url": "https://github.com/imranhsayed/gatsby-woocommerce-themes/issues"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const AddToCart = (props) => {

const productQtyInput = {
clientMutationId: v4(), // Generate a unique id.
productId: product.productId,
productId: product?.databaseId,
};

/* eslint-disable */
Expand All @@ -29,11 +29,12 @@ const AddToCart = (props) => {

// Update cart in the localStorage.
const updatedCart = getFormattedCart(data);

localStorage.setItem("woo-next-cart", JSON.stringify(updatedCart));

// Update cart data in React Context.
setCart(updatedCart);
},
}
});

// Add to Cart Mutation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const CartDropDown = ({ isDropdownOpen }) => {
</div>
</div>
<ul className="shopping-cart-items">
{ cart.products.map( product => (
{ cart?.products.map( product => (
<li className="clearfix" key={ product.productId }>
{!isEmpty(product.image) ? (
<figure>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const CartItemsContainer = () => {
</div>
</div>
) : (
<div className="container mt-5">
<div className="container mt-5" style={{height: '72vh'}}>
<h2>No items in the cart</h2>
<Link to="/">
<button className="btn btn-secondary woo-next-large-black-btn">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const OrderSuccess = ( props ) => {
<div className="container">
{ 'success' === responseData.result ? (
<div>
<h2>Order no: { responseData.order.orderId } </h2>
<h2>Order no: { responseData.order.orderKey } </h2>
<p>Status : { responseData.order.status }</p>
</div>
): ''}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ const Orders = ({ authData }) => {
customer: { orders },
} = data;

console.warn( 'prder', orders );

return (
<div className="">
{!isEmpty(orders.edges)
? orders.edges.map((order) => {
return (
<div className="" key={order.node.orderId}>
<div className="" key={order.node.orderKey}>
<div className="card-header">
<h4>Order #{order.node.orderId}</h4>
<h4>Order #{order.node.orderKey}</h4>
<time>Order Placed: {getFormattedDate(order.node.date)}</time>
<div>Payment Method: {order.node.paymentMethodTitle}</div>
<div>Order Status: {order.node.status}</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import React from "react";
import Slider from "react-slick";
import "./style.scss";
import Zoom from 'react-medium-image-zoom'
Expand All @@ -8,41 +8,33 @@ import { isEmpty } from "lodash";

const ProductCarousel = ( { galleryImages } ) => {

let slider1 = null;
let slider2 = null;

const [nav1, setNav1] = useState( null );
const [nav2, setNav2] = useState( null );

useEffect( () => {
setNav1( slider1 )
setNav2( slider2 )
}, [slider1, slider2] );

if ( isEmpty( galleryImages.nodes ) ) {
if ( isEmpty( galleryImages?.nodes ) ) {
return null;
}

const settings = {
dots: true,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
arrows: true
};

return (
<div>
{/*First slider*/ }
<Slider
asNavFor={ nav2 }
ref={ slider => ( slider1 = slider ) }
arrows={ true }
>
<Slider {...settings} >
{ galleryImages.nodes.map( galleryImage => {
return (
<div key={ galleryImage.id } className="top-product-carousel">
<div key={ galleryImage?.id } className="top-product-carousel">
<div className="carousel-img-wrap carousel-img-wrap--product">
{ !isEmpty( galleryImage.mediaItemUrl ) ? (
<Zoom>
<img
src={ galleryImage.mediaItemUrl }
src={ galleryImage?.mediaItemUrl }
alt={
!isEmpty( galleryImage.altText )
!isEmpty( galleryImage?.altText )
? galleryImage.altText
: galleryImage.title
: galleryImage?.title
}
/>
</Zoom>
Expand All @@ -52,34 +44,6 @@ const ProductCarousel = ( { galleryImages } ) => {
)
} ) }
</Slider>
{/*Second Slider*/ }
<Slider
asNavFor={ nav1 }
ref={ slider => ( slider2 = slider ) }
slidesToShow={ 3 }
swipeToSlide={ true }
focusOnSelect={ true }
>
{ galleryImages.nodes.map( galleryImage => {
return (
<div key={ galleryImage.id } className="bottom-product-carousel">
<div className="carousel-img-wrap">
{ !isEmpty( galleryImage.mediaItemUrl ) ? (
<img
src={ galleryImage.mediaItemUrl }
alt={
!isEmpty( galleryImage.altText )
? galleryImage.altText
: galleryImage.title
}
/>
) : null }
</div>
</div>
)
} ) }
</Slider>
</div>
);
};

Expand Down
112 changes: 57 additions & 55 deletions packages/gatsby-woocommerce-theme/src/mutations/add-to-cart.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,66 @@
import { gql } from "@apollo/client";

const ADD_TO_CART = gql`
mutation ($input: AddToCartInput!) {
addToCart(input: $input) {
cartItem {
key
product {
id
productId
name
description
type
onSale
slug
averageRating
reviewCount
image {
id
sourceUrl
altText
}
galleryImages {
nodes {
id
sourceUrl
altText
}
}
}
variation {
id
variationId
name
description
type
onSale
price
regularPrice
salePrice
image {
id
sourceUrl
altText
}
attributes {
nodes {
id
attributeId
name
value
}
}
}
quantity
total
subtotal
subtotalTax
mutation ($input: AddToCartInput!) {
addToCart(input: $input) {
cartItem {
key
product {
node {
id
databaseId
name
description
type
onSale
slug
averageRating
reviewCount
image {
id
sourceUrl
altText
}
galleryImages {
nodes {
id
sourceUrl
altText
}
}
}
}
variation {
node {
id
databaseId
name
description
type
onSale
price
regularPrice
salePrice
image {
id
sourceUrl
altText
}
}
attributes {
id
attributeId
name
value
}
}
quantity
total
subtotal
subtotalTax
}
}
}
`;

export default ADD_TO_CART;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mutation CHECKOUT_MUTATION( $input: CheckoutInput! ) {
clientMutationId
order {
id
orderId
orderKey
refunds {
nodes {
amount
Expand Down
Loading

0 comments on commit 7ffb8b0

Please sign in to comment.