@jetshop/template-trend 5.10.0 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.linaria-cache/packages/template-trend/src/components/ContentPage/ContentPage.linaria.css +5 -3
- package/.linaria-cache/packages/template-trend/src/components/ContentPage/SubPageNavigation.linaria.css +4 -0
- package/.linaria-cache/packages/template-trend/src/components/Layout/Header/ChannelSelector/ChannelSelector.linaria.css +1 -1
- package/.linaria-cache/packages/template-trend/src/components/StartPage/Content/StartPageCampaign.linaria.css +1 -1
- package/.linaria-cache/packages/template-trend/src/components/StartPage/Content/StartPageHero.linaria.css +1 -1
- package/.linaria-cache/packages/template-trend/src/components/StartPage/StartPage.linaria.css +0 -1
- package/.linaria-cache/packages/template-trend/src/components/ui/Button.linaria.css +3 -2
- package/.linaria-cache/packages/ui/Breadcrumbs/Breadcrumbs.linaria.css +1 -1
- package/.linaria-cache/packages/ui/DropdownMenu/DropdownMenu.linaria.css +1 -1
- package/.vscode/launch.json +11 -0
- package/README.md +118 -1944
- package/package.json +5 -5
- package/schema.graphql +5 -2
- package/src/components/Auth/ForgotPassword.js +3 -8
- package/src/components/Auth/README.md +5 -0
- package/src/components/Cart/CartButton.js +40 -44
- package/src/components/Cart/CartFlyout.js +18 -7
- package/src/components/Cart/CartItem.js +12 -15
- package/src/components/Cart/{addMultipleToCart.gql → queries/addMultipleToCart.gql} +1 -1
- package/src/components/Cart/{addToCart.gql → queries/addToCart.gql} +1 -1
- package/src/components/Cart/{CartFragment.gql → queries/cartFragment.gql} +2 -5
- package/src/components/Cart/{CartQuery.gql → queries/cartQuery.gql} +1 -1
- package/src/components/Cart/{decrementQuantity.gql → queries/decrementQuantity.gql} +1 -1
- package/src/components/Cart/{incrementQuantity.gql → queries/incrementQuantity.gql} +1 -1
- package/src/components/Cart/{removeFromCart.gql → queries/removeFromCart.gql} +1 -1
- package/src/components/CategoryPage/CategoryHeader.js +3 -3
- package/src/components/CategoryPage/CategoryPage.js +1 -0
- package/src/components/CategoryPage/ProductCard.js +4 -2
- package/src/components/CategoryPage/ProductGrid.js +8 -2
- package/src/components/CategoryPage/ProductGridWindow.js +22 -14
- package/src/components/CategoryPage/README.md +11 -0
- package/src/components/CategoryPage/StandardCategoryPage.js +2 -0
- package/src/components/CategoryPage/WindowedCategoryPage.js +7 -0
- package/src/components/ContentPage/ContentPage.js +69 -38
- package/src/components/ContentPage/ContentPageFragment.gql +29 -0
- package/src/components/ContentPage/SubPageNavigation.js +206 -0
- package/src/components/Layout/Footer/FooterLinks.js +6 -4
- package/src/components/Layout/Footer/PagesQuery.gql +9 -0
- package/src/components/Layout/Header/AutocompleteQuery.gql +1 -6
- package/src/components/Layout/Header/ChannelSelector/ChannelSelector.js +3 -0
- package/src/components/Layout/Header/ChannelSelector/ChannelSelectorModal.js +4 -3
- package/src/components/Layout/Header/ChannelSelector/Selector.js +2 -0
- package/src/components/Layout/Header/RecommendedChannel/RecommendedChannelSelector.js +2 -0
- package/src/components/LogOut.loadable.js +10 -0
- package/src/components/PreviewRoute.loadable.js +10 -0
- package/src/components/ProductList/AddToCart.js +8 -5
- package/src/components/ProductList/Favourite.js +2 -2
- package/src/components/ProductList/FavouriteCount.js +2 -2
- package/src/components/ProductList/Favourites.js +17 -12
- package/src/components/ProductList/Lister.js +44 -0
- package/src/components/ProductList/Product.js +5 -4
- package/src/components/ProductList/ProductLists.gql +8 -5
- package/src/components/ProductList/SelectVariant.js +6 -10
- package/src/components/ProductList/productListQueries.js +5 -0
- package/src/components/ProductPage/AddToCart/AddToCartForm.js +19 -18
- package/src/components/ProductPage/AddToCart/ProductToast.js +18 -7
- package/src/components/ProductPage/Images/ImageContainer.js +12 -1
- package/src/components/ProductPage/PackageProduct/PackageProduct.js +8 -6
- package/src/components/ProductPage/ProductInfo.js +1 -1
- package/src/components/ProductPage/ProductPage.js +3 -5
- package/src/components/ProductPage/ProductPageFragment.gql +1 -0
- package/src/components/ProductPage/StockStatus/WarehouseStock.js +15 -17
- package/src/components/ProductPage/VariantSelector.js +1 -1
- package/src/components/RouteQuery.gql +2 -2
- package/src/components/{StartPage → SearchPage}/CategoryList.js +6 -4
- package/src/components/SearchPage/EmptySearchResults.js +1 -1
- package/src/components/Shop.js +52 -76
- package/src/components/StartPage/Content/StartPageHero.js +12 -1
- package/src/components/StartPage/ContentItemFragment.gql +6 -1
- package/src/components/StartPage/StartPage.js +0 -13
- package/src/components/StartPage/StartPageProductGridFragment.gql +1 -0
- package/src/components/ui/Button.js +19 -1
- package/.linaria-cache/packages/ui/ChannelSelector/Region.linaria.css +0 -3
- package/src/components/StartPage/Campaign.js +0 -162
- package/src/components/StartPage/CampaignHeader.js +0 -101
- package/src/components/StartPage/ExtraDetails.js +0 -72
- package/src/components/StartPage/Readme.md +0 -88
- package/src/components/StartPage/campaign.json +0 -20
- package/src/components/StartPage/campaignHeader.json +0 -5
- package/src/components/StartPage/categoryList.json +0 -65
- package/src/components/StartPage/extraDetails.json +0 -6
- package/src/components/StartPage/title.json +0 -3
|
@@ -7,7 +7,7 @@ import { SelectVariant } from './SelectVariant';
|
|
|
7
7
|
import { ReactComponent as TrashSVG } from '../../svg/trash.svg';
|
|
8
8
|
import { useProductList } from '@jetshop/core/hooks/ProductList';
|
|
9
9
|
|
|
10
|
-
export function Product({ product, loading, children }) {
|
|
10
|
+
export function Product({ product, loading, children, listId }) {
|
|
11
11
|
// Use the variant's image for display
|
|
12
12
|
const productForDisplay = { ...product };
|
|
13
13
|
if (product.isVariant && product.variant.images) {
|
|
@@ -19,7 +19,7 @@ export function Product({ product, loading, children }) {
|
|
|
19
19
|
<ProductCard product={productForDisplay} as="div">
|
|
20
20
|
{product.hasVariants && (
|
|
21
21
|
<div className="select-variant">
|
|
22
|
-
<SelectVariant product={product} />
|
|
22
|
+
<SelectVariant listId={listId} product={product} />
|
|
23
23
|
</div>
|
|
24
24
|
)}
|
|
25
25
|
{product.validation.status === 'valid' ? (
|
|
@@ -28,6 +28,7 @@ export function Product({ product, loading, children }) {
|
|
|
28
28
|
<InvalidProduct validation={product.validation} />
|
|
29
29
|
)}
|
|
30
30
|
<RemoveFromList
|
|
31
|
+
listId={listId}
|
|
31
32
|
articleNumber={product.articleNumber}
|
|
32
33
|
variant={product.variant}
|
|
33
34
|
/>
|
|
@@ -36,8 +37,8 @@ export function Product({ product, loading, children }) {
|
|
|
36
37
|
);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
function RemoveFromList({ children, articleNumber, variant }) {
|
|
40
|
-
const { remove } = useProductList();
|
|
40
|
+
function RemoveFromList({ children, articleNumber, variant, listId }) {
|
|
41
|
+
const { remove } = useProductList(listId);
|
|
41
42
|
const variantArticleNumber = variant?.articleNumber;
|
|
42
43
|
return (
|
|
43
44
|
<button
|
|
@@ -12,8 +12,8 @@ query ProductsFromProductList($articleNumbers: [String]) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
## query
|
|
15
|
-
query ProductList {
|
|
16
|
-
customerProductList {
|
|
15
|
+
query ProductList($id: ID) {
|
|
16
|
+
customerProductList(id: $id) {
|
|
17
17
|
...ProductListFragment
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -27,7 +27,7 @@ mutation AddToProductList($id: ID, $items: [AddToCustomerProductListInput!]!) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
## remove
|
|
30
|
+
## remove article from product list
|
|
31
31
|
mutation RemoveFromProductList($id: ID, $articleNumbers: [String!]) {
|
|
32
32
|
removeFromCustomerProductList(id: $id, articleNumbers: $articleNumbers) {
|
|
33
33
|
customerProductList {
|
|
@@ -54,9 +54,12 @@ mutation MergeProductLists($id: ID, $items: [AddToCustomerProductListInput!]!) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
### Fragments ###
|
|
58
|
-
|
|
59
57
|
fragment MinimalProductListDetail on CustomerProductList {
|
|
58
|
+
id
|
|
59
|
+
name
|
|
60
|
+
# TODO
|
|
61
|
+
# typeId {...}
|
|
62
|
+
# description
|
|
60
63
|
items {
|
|
61
64
|
variant {
|
|
62
65
|
articleNumber
|
|
@@ -10,18 +10,14 @@ import {
|
|
|
10
10
|
import { ReactComponent as Check } from '@jetshop/ui/svg/Check.svg';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
|
-
export function SelectVariant({ product }) {
|
|
14
|
-
const { update } = useProductList();
|
|
13
|
+
export function SelectVariant({ product, listId }) {
|
|
14
|
+
const { update } = useProductList(listId);
|
|
15
15
|
const initialVariant = product.variant;
|
|
16
16
|
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
validateSelection
|
|
22
|
-
} = useProductVariants(product, {
|
|
23
|
-
initialVariant
|
|
24
|
-
});
|
|
17
|
+
const { selectedVariant, selectValue, getSelectedValue, validateSelection } =
|
|
18
|
+
useProductVariants(product, {
|
|
19
|
+
initialVariant
|
|
20
|
+
});
|
|
25
21
|
|
|
26
22
|
React.useEffect(() => {
|
|
27
23
|
// When a variant is selected, call the update function from useProductList to update the list
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import queries from '@jetshop/core/data/queries/ProductLists.gql';
|
|
2
|
+
import mutations from '@jetshop/core/data/mutations/productListMutations.gql';
|
|
1
3
|
import * as ProductListQueries from './ProductLists.gql';
|
|
2
4
|
|
|
3
5
|
export const productListQueries = {
|
|
6
|
+
createList: mutations.CreateProductList,
|
|
7
|
+
deleteList: mutations.DeleteProductList,
|
|
8
|
+
all: queries.ProductLists,
|
|
4
9
|
query: ProductListQueries.ProductList,
|
|
5
10
|
productsQuery: ProductListQueries.ProductsFromProductList,
|
|
6
11
|
add: ProductListQueries.AddToProductList,
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { styled } from 'linaria/react';
|
|
3
|
+
import { css, cx } from 'linaria';
|
|
4
|
+
import { Form } from 'formik';
|
|
5
|
+
|
|
1
6
|
import AddToCartFormik from '@jetshop/core/cart/AddToCartFormik';
|
|
2
7
|
import ProductConfigurationContext from '@jetshop/core/components/ProductConfigurationProvider/ProductConfigurationContext';
|
|
3
8
|
import { useDynamicPrice } from '@jetshop/core/hooks/useDynamicPrice';
|
|
4
9
|
import t from '@jetshop/intl';
|
|
5
10
|
import { Price } from '@jetshop/ui/Price';
|
|
6
11
|
import { useStockStatus } from '@jetshop/ui/Stock/StockStatusContainer';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import { css, cx } from 'linaria';
|
|
11
|
-
import addToCartMutation from '../../Cart/addToCart.gql';
|
|
12
|
-
import CartQuery from '../../Cart/CartQuery.gql';
|
|
12
|
+
import { PreOrderDateSelector } from '@jetshop/ui/PreOrderDateSelector';
|
|
13
|
+
import { useNotification } from '@jetshop/core/components/Notifications';
|
|
14
|
+
|
|
13
15
|
import InputWithLabel from '../../Forms/Input';
|
|
14
16
|
import Button from '../../ui/Button';
|
|
15
17
|
import { IncludedInPackages } from '../PackageProduct/IncludedInPackages';
|
|
@@ -19,11 +21,12 @@ import StockStatusIndicator from '../StockStatus/StockStatusIndicator';
|
|
|
19
21
|
import { useProductValidationMessage } from '../useProductValidationMessage';
|
|
20
22
|
import { VariantSelector, dropdownStyles } from '../VariantSelector';
|
|
21
23
|
import { theme } from '../../Theme';
|
|
22
|
-
import { useNotification } from '@jetshop/core/components/Notifications';
|
|
23
24
|
import ProductToastWrapper from './ProductToast';
|
|
24
25
|
import { ConfigurationSelector } from '../ConfigurationSelector';
|
|
25
26
|
import WarehouseStock from '../StockStatus/WarehouseStock';
|
|
26
|
-
|
|
27
|
+
|
|
28
|
+
import addToCartMutation from '../../Cart/queries/addToCart.gql';
|
|
29
|
+
import CartQuery from '../../Cart/queries/cartQuery.gql';
|
|
27
30
|
|
|
28
31
|
const StyledForm = styled(Form)`
|
|
29
32
|
display: flex;
|
|
@@ -56,7 +59,7 @@ function AddToCartForm({
|
|
|
56
59
|
product,
|
|
57
60
|
variant,
|
|
58
61
|
getMissingOptions,
|
|
59
|
-
variantHandler
|
|
62
|
+
variantHandler
|
|
60
63
|
}) {
|
|
61
64
|
const configurationContext = useContext(ProductConfigurationContext);
|
|
62
65
|
const price = useDynamicPrice(product, variant);
|
|
@@ -68,7 +71,7 @@ function AddToCartForm({
|
|
|
68
71
|
missingOptions,
|
|
69
72
|
variantValidation,
|
|
70
73
|
hasVariants,
|
|
71
|
-
stockStatus
|
|
74
|
+
stockStatus
|
|
72
75
|
});
|
|
73
76
|
const [trigger, dismiss] = useNotification();
|
|
74
77
|
|
|
@@ -82,12 +85,12 @@ function AddToCartForm({
|
|
|
82
85
|
/>,
|
|
83
86
|
{
|
|
84
87
|
id: mutationId,
|
|
85
|
-
type: 'add-to-cart'
|
|
88
|
+
type: 'add-to-cart'
|
|
86
89
|
}
|
|
87
90
|
);
|
|
88
91
|
};
|
|
89
92
|
const onAddToCartError = () => {
|
|
90
|
-
return ({
|
|
93
|
+
return ({ mutationId, quantity, price, error }) => {
|
|
91
94
|
dismiss(mutationId);
|
|
92
95
|
|
|
93
96
|
trigger(
|
|
@@ -99,7 +102,7 @@ function AddToCartForm({
|
|
|
99
102
|
error={error}
|
|
100
103
|
/>,
|
|
101
104
|
{
|
|
102
|
-
type: 'add-to-cart'
|
|
105
|
+
type: 'add-to-cart'
|
|
103
106
|
}
|
|
104
107
|
);
|
|
105
108
|
};
|
|
@@ -136,9 +139,7 @@ function AddToCartForm({
|
|
|
136
139
|
css={{
|
|
137
140
|
marginBottom: '24px',
|
|
138
141
|
opacity:
|
|
139
|
-
configurationContext && configurationContext.loading
|
|
140
|
-
? 0.3
|
|
141
|
-
: 1,
|
|
142
|
+
configurationContext && configurationContext.loading ? 0.3 : 1
|
|
142
143
|
}}
|
|
143
144
|
/>
|
|
144
145
|
|
|
@@ -151,7 +152,7 @@ function AddToCartForm({
|
|
|
151
152
|
|
|
152
153
|
<StyledForm>
|
|
153
154
|
{product.customerComments &&
|
|
154
|
-
product.customerComments.map(
|
|
155
|
+
product.customerComments.map(comment => (
|
|
155
156
|
<InputWithLabel
|
|
156
157
|
wrapperClassName="customer-comment-input-wrapper"
|
|
157
158
|
className="customer-comment-input"
|
|
@@ -184,7 +185,7 @@ function AddToCartForm({
|
|
|
184
185
|
style={{
|
|
185
186
|
opacity: !!validationMessage ? 0.7 : 1,
|
|
186
187
|
cursor: !!validationMessage ? 'not-allowed' : 'pointer',
|
|
187
|
-
width: '100%'
|
|
188
|
+
width: '100%'
|
|
188
189
|
}}
|
|
189
190
|
>
|
|
190
191
|
{validationMessage ? validationMessage : t('Add to cart')}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from 'linaria/react';
|
|
3
|
+
|
|
1
4
|
import { useTracker } from '@jetshop/core/analytics/Analytics';
|
|
2
5
|
import { trackCartCheckoutEvent } from '@jetshop/core/analytics/tracking';
|
|
3
6
|
import ChannelContext from '@jetshop/core/components/ChannelContext';
|
|
@@ -5,11 +8,11 @@ import CartProvider from '@jetshop/core/components/Query/CartProvider';
|
|
|
5
8
|
import t from '@jetshop/intl';
|
|
6
9
|
import Image from '@jetshop/ui/Image/Image';
|
|
7
10
|
import { Price } from '@jetshop/ui/Price';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { styled } from 'linaria/react';
|
|
11
|
+
|
|
11
12
|
import { baseStyles } from '../../ui/Button';
|
|
12
|
-
import
|
|
13
|
+
import { theme } from '../../Theme';
|
|
14
|
+
|
|
15
|
+
import cartQuery from '../../Cart/queries/cartQuery.gql';
|
|
13
16
|
|
|
14
17
|
const Container = styled('aside')`
|
|
15
18
|
${theme.above.sm} {
|
|
@@ -140,9 +143,17 @@ const ProductToast = ({
|
|
|
140
143
|
<ChannelContext.Consumer>
|
|
141
144
|
{({ selectedChannel }) => (
|
|
142
145
|
<CheckoutButton
|
|
143
|
-
href={
|
|
144
|
-
onClick={
|
|
145
|
-
|
|
146
|
+
href={cart.externalCheckoutUrl}
|
|
147
|
+
onClick={event => {
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
track(
|
|
150
|
+
trackCartCheckoutEvent({
|
|
151
|
+
cart: cart,
|
|
152
|
+
callback: () => {
|
|
153
|
+
window.location = cart.externalCheckoutUrl;
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
);
|
|
146
157
|
}}
|
|
147
158
|
>
|
|
148
159
|
{t('To checkout')}
|
|
@@ -26,9 +26,20 @@ export default function ImageContainer({ images, badges, variant, ...rest }) {
|
|
|
26
26
|
variant
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
const selectedVariantImageIndex = variant
|
|
30
|
+
? images.findIndex(image => image.url === variant.images?.[0]?.url)
|
|
31
|
+
: null;
|
|
32
|
+
|
|
29
33
|
return (
|
|
30
34
|
<div {...rest} className={cx(rest.className, wrapper)}>
|
|
31
|
-
<Gallery
|
|
35
|
+
<Gallery
|
|
36
|
+
aspect={'1:1'}
|
|
37
|
+
images={images}
|
|
38
|
+
galleryRef={galleryRef}
|
|
39
|
+
eagerlyLoad={
|
|
40
|
+
selectedVariantImageIndex ? [0, selectedVariantImageIndex] : [0]
|
|
41
|
+
}
|
|
42
|
+
>
|
|
32
43
|
<Badges badges={badges} />
|
|
33
44
|
</Gallery>
|
|
34
45
|
</div>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { usePackageProduct } from '@jetshop/core/hooks/PackageProducts';
|
|
2
|
-
import { useIntl } from '@jetshop/intl';
|
|
3
|
-
import { Price } from '@jetshop/ui/Price';
|
|
4
1
|
import React, { useEffect, useRef } from 'react';
|
|
5
2
|
import { styled } from 'linaria/react';
|
|
6
3
|
import { css } from 'linaria';
|
|
7
|
-
|
|
8
|
-
import
|
|
4
|
+
|
|
5
|
+
import { usePackageProduct } from '@jetshop/core/hooks/PackageProducts';
|
|
6
|
+
import { useIntl } from '@jetshop/intl';
|
|
7
|
+
import { Price } from '@jetshop/ui/Price';
|
|
8
|
+
import { useNotification } from '@jetshop/core/components/Notifications';
|
|
9
9
|
import { ReactComponent as Cart } from '../../../svg/Cart.svg';
|
|
10
10
|
import {
|
|
11
11
|
default as Button,
|
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
import { PackageProductItem } from './PackageProductItem';
|
|
15
15
|
import packageProductQuery from './PackageProductQuery.gql';
|
|
16
16
|
import { theme } from '../../Theme';
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
import addMultipleToCartMutation from '../../Cart/queries/addMultipleToCart.gql';
|
|
19
|
+
import cartQuery from '../../Cart/queries/cartQuery.gql';
|
|
18
20
|
|
|
19
21
|
const PackageProductWrapper = styled('div')`
|
|
20
22
|
padding: 12px;
|
|
@@ -56,7 +56,7 @@ const ProductInfo = ({ product }) => {
|
|
|
56
56
|
/>
|
|
57
57
|
</ProductSection>
|
|
58
58
|
)}
|
|
59
|
-
{product.customFields
|
|
59
|
+
{product.customFields?.length > 0 && (
|
|
60
60
|
<ProductSection>
|
|
61
61
|
<SectionHeading>{t('Specifications')}</SectionHeading>
|
|
62
62
|
<ProductSpecifications fields={product.customFields} />
|
|
@@ -129,10 +129,8 @@ const Product = ({ result: { data, loading }, product }) => {
|
|
|
129
129
|
preselectCheapest: true
|
|
130
130
|
});
|
|
131
131
|
|
|
132
|
-
const {
|
|
133
|
-
|
|
134
|
-
getMissingOptions
|
|
135
|
-
} = variantHandler;
|
|
132
|
+
const { selectedVariant: selectedVariation, getMissingOptions } =
|
|
133
|
+
variantHandler;
|
|
136
134
|
|
|
137
135
|
// Return early if there is no product
|
|
138
136
|
if (!product)
|
|
@@ -150,8 +148,8 @@ const Product = ({ result: { data, loading }, product }) => {
|
|
|
150
148
|
<ProductContainer>
|
|
151
149
|
<MaxWidth>
|
|
152
150
|
<Breadcrumbs
|
|
151
|
+
breadcrumbs={data?.route?.breadcrumbs || []}
|
|
153
152
|
parents={parents}
|
|
154
|
-
breadcrumbText={product.breadcrumbText}
|
|
155
153
|
/>
|
|
156
154
|
</MaxWidth>
|
|
157
155
|
<Container>
|
|
@@ -207,21 +207,19 @@ const WarehouseStock = ({ product, variantHandler }) => {
|
|
|
207
207
|
|
|
208
208
|
const WarehouseStockItem = ({ item, missingOptions, validation }) => {
|
|
209
209
|
return (
|
|
210
|
-
|
|
211
|
-
<
|
|
212
|
-
<
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
</WarehouseStockWrapper>
|
|
224
|
-
</>
|
|
210
|
+
<WarehouseStockWrapper className="warehouse-stock-wrapper">
|
|
211
|
+
<p className="stock-status-header">
|
|
212
|
+
<span className="store-icon">
|
|
213
|
+
<StoreIcon />
|
|
214
|
+
</span>
|
|
215
|
+
<span className="header-title">{t('Find product in store')}</span>
|
|
216
|
+
</p>
|
|
217
|
+
<WarehouseValidation
|
|
218
|
+
validation={validation}
|
|
219
|
+
missingOptions={missingOptions}
|
|
220
|
+
item={item}
|
|
221
|
+
/>
|
|
222
|
+
</WarehouseStockWrapper>
|
|
225
223
|
);
|
|
226
224
|
};
|
|
227
225
|
|
|
@@ -257,7 +255,7 @@ function WarehouseValidation({ validation, missingOptions, item }) {
|
|
|
257
255
|
<WarehouseStockItemContent
|
|
258
256
|
warehouse={warehouse}
|
|
259
257
|
productVariant={productVariant}
|
|
260
|
-
key
|
|
258
|
+
key={warehouse.location?.id}
|
|
261
259
|
/>
|
|
262
260
|
))}
|
|
263
261
|
</ul>
|
|
@@ -295,7 +293,7 @@ const WarehouseStockItemContent = ({ warehouse, productVariant }) => {
|
|
|
295
293
|
}
|
|
296
294
|
|
|
297
295
|
return (
|
|
298
|
-
<li
|
|
296
|
+
<li className="warehouse-list-item">
|
|
299
297
|
<div className="warehouse-name">
|
|
300
298
|
<span>{warehouse.location?.name}</span>
|
|
301
299
|
</div>
|
|
@@ -159,7 +159,7 @@ function DropdownVariantSelect({
|
|
|
159
159
|
<DropdownMenuItem
|
|
160
160
|
data-testid={value + option.name}
|
|
161
161
|
key={value + option.name}
|
|
162
|
-
disabled={doNotDisable && validation === 'invalid'}
|
|
162
|
+
disabled={!doNotDisable && validation === 'invalid'}
|
|
163
163
|
onSelect={({ setIsOpen }) => {
|
|
164
164
|
selectValue(value, option);
|
|
165
165
|
setIsOpen(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#import "@jetshop/core/data/fragments/
|
|
1
|
+
#import "@jetshop/core/data/fragments/RouteMetaFragment.gql"
|
|
2
2
|
#import "@jetshop/core/data/fragments/HeadFragment.gql"
|
|
3
3
|
#import "./CategoryPage/CategoryPageFragment.gql"
|
|
4
4
|
#import "./ContentPage/ContentPageFragment.gql"
|
|
@@ -12,7 +12,7 @@ query route(
|
|
|
12
12
|
$filters: FilterInput
|
|
13
13
|
) {
|
|
14
14
|
route(path: $path) {
|
|
15
|
-
...
|
|
15
|
+
...RouteMeta
|
|
16
16
|
object {
|
|
17
17
|
...Head
|
|
18
18
|
...CategoryPage
|
|
@@ -3,7 +3,7 @@ import { styled } from 'linaria/react';
|
|
|
3
3
|
import CategoryLink from '@jetshop/ui/CategoryLink';
|
|
4
4
|
import Image from '@jetshop/ui/Image';
|
|
5
5
|
import { theme } from '../Theme';
|
|
6
|
-
import
|
|
6
|
+
import MaxWidth from '../Layout/MaxWidth';
|
|
7
7
|
|
|
8
8
|
const ScrollWrapper = styled('div')`
|
|
9
9
|
margin: 0 -1.5rem;
|
|
@@ -112,7 +112,9 @@ const CategoriesHeader = styled('h3')`
|
|
|
112
112
|
}
|
|
113
113
|
`;
|
|
114
114
|
|
|
115
|
-
const CategoryListWrapper = styled('div')
|
|
115
|
+
const CategoryListWrapper = styled('div')`
|
|
116
|
+
padding: 1rem 0;
|
|
117
|
+
`;
|
|
116
118
|
|
|
117
119
|
const Category = ({ category }) => {
|
|
118
120
|
const categoryImageUrl = category?.images?.[0]?.url;
|
|
@@ -135,7 +137,7 @@ const Category = ({ category }) => {
|
|
|
135
137
|
};
|
|
136
138
|
const CategoryList = ({ title, categories, className = '' }) => {
|
|
137
139
|
return (
|
|
138
|
-
<
|
|
140
|
+
<MaxWidth className={className}>
|
|
139
141
|
<CategoryListWrapper>
|
|
140
142
|
<CategoriesHeader>{title}</CategoriesHeader>
|
|
141
143
|
<ScrollWrapper>
|
|
@@ -146,7 +148,7 @@ const CategoryList = ({ title, categories, className = '' }) => {
|
|
|
146
148
|
</CategoriesWrapper>
|
|
147
149
|
</ScrollWrapper>
|
|
148
150
|
</CategoryListWrapper>
|
|
149
|
-
</
|
|
151
|
+
</MaxWidth>
|
|
150
152
|
);
|
|
151
153
|
};
|
|
152
154
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from '@jetshop/intl';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Query } from 'react-apollo';
|
|
4
|
-
import CategoryList from '
|
|
4
|
+
import CategoryList from './CategoryList';
|
|
5
5
|
import { Header, Matches } from './SearchPage';
|
|
6
6
|
import SearchTerm from './SearchTerm';
|
|
7
7
|
import EmptySearchCategoriesQuery from './EmptySearchCategoriesQuery.gql';
|
package/src/components/Shop.js
CHANGED
|
@@ -1,60 +1,53 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Helmet } from 'react-helmet-async';
|
|
3
|
+
import { Route, Switch } from 'react-router-dom';
|
|
4
|
+
|
|
2
5
|
import CustomFont from '@jetshop/core/components/Fonts/CustomFont';
|
|
6
|
+
import DynamicRoute from '@jetshop/core/components/DynamicRoute';
|
|
3
7
|
import PaginationProvider from '@jetshop/core/components/Pagination/PaginationProvider';
|
|
4
8
|
import { ProductListProvider } from '@jetshop/core/hooks/ProductList/ProductListContext';
|
|
5
9
|
import { useShopConfig } from '@jetshop/core/hooks/useShopConfig';
|
|
10
|
+
|
|
6
11
|
import GenericError from '@jetshop/ui/ErrorBoundary/Generic';
|
|
7
12
|
import LoadingBar from '@jetshop/ui/Loading/LoadingBar';
|
|
8
13
|
import ModalProvider from '@jetshop/ui/Modal/ModalProvider';
|
|
9
14
|
import ModalRoot from '@jetshop/ui/Modal/ModalRoot';
|
|
10
15
|
import ScrollRestorationHandler from '@jetshop/ui/ScrollRestorationHandler';
|
|
11
|
-
|
|
12
|
-
import { Helmet } from 'react-helmet-async';
|
|
13
|
-
import loadable from '@loadable/component';
|
|
14
|
-
import { Route, Switch } from 'react-router-dom';
|
|
15
|
-
import loadFontCss from '../fonts/loadFontCss';
|
|
16
|
-
import CategoryPreviewQuery from './CategoryPreviewQuery.gql';
|
|
17
|
-
import PagePreviewQuery from './PagePreviewQuery.gql';
|
|
16
|
+
|
|
18
17
|
import Container from './Layout/Container';
|
|
19
18
|
import Content from './Layout/Content';
|
|
20
19
|
import Footer from './Layout/Footer/Footer';
|
|
21
20
|
import Header from './Layout/Header/Header';
|
|
21
|
+
|
|
22
|
+
import ForgotPassword from './Auth/ForgotPassword.loadable';
|
|
23
|
+
import LogInPage from './Auth/LogInPage.loadable';
|
|
24
|
+
import ResetPassword from './Auth/ResetPassword.loadable';
|
|
25
|
+
import SignUpPage from './Auth/Signup/SignUpPage.loadable';
|
|
26
|
+
import CategoryPage from './CategoryPage/CategoryPage.loadable';
|
|
27
|
+
import ContentPage from './ContentPage/ContentPage.loadable';
|
|
28
|
+
import CookieConsent from './CookieConsent';
|
|
22
29
|
import LoadingPage from './LoadingPage';
|
|
30
|
+
import LogOutPage from './LogOut.loadable';
|
|
31
|
+
import MyPages from './MyPages/MyPages.loadable';
|
|
32
|
+
import NavTreePage from './NavigationTree/NavTreePage.loadable';
|
|
33
|
+
import NotFoundPage from './NotFoundPage.loadable';
|
|
34
|
+
import PreviewRoute from './PreviewRoute.loadable';
|
|
23
35
|
import { Favourites } from './ProductList/Favourites';
|
|
24
36
|
import { productListQueries } from './ProductList/productListQueries';
|
|
25
|
-
import ProductPreviewQuery from './ProductPreviewQuery.gql';
|
|
26
|
-
import routeQuery from './RouteQuery.gql';
|
|
27
|
-
import { theme } from './Theme';
|
|
28
|
-
import '../globalStyles';
|
|
29
|
-
import CookieConsent from './CookieConsent';
|
|
30
|
-
import Store from './Store/Store.loadable';
|
|
31
|
-
import StoreLocator from './StoreLocator/StoreLocator.loadable';
|
|
32
|
-
import NotFoundPage from './NotFoundPage.loadable';
|
|
33
|
-
import LogInPage from './Auth/LogInPage.loadable';
|
|
34
|
-
import NavTreePage from './NavigationTree/NavTreePage.loadable';
|
|
35
|
-
import StartPage from './StartPage/StartPage.loadable';
|
|
36
37
|
import ProductPage from './ProductPage/ProductPage.loadable';
|
|
37
|
-
import CategoryPage from './CategoryPage/CategoryPage.loadable';
|
|
38
|
-
import ContentPage from './ContentPage/ContentPage.loadable';
|
|
39
38
|
import SearchPage from './SearchPage/SearchPage.loadable';
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import MyPages from './MyPages/MyPages.loadable';
|
|
39
|
+
import StartPage from './StartPage/StartPage.loadable';
|
|
40
|
+
import Store from './Store/Store.loadable';
|
|
41
|
+
import StoreLocator from './StoreLocator/StoreLocator.loadable';
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
);
|
|
43
|
+
import categoryPreviewQuery from './CategoryPreviewQuery.gql';
|
|
44
|
+
import pagePreviewQuery from './PagePreviewQuery.gql';
|
|
45
|
+
import productPreviewQuery from './ProductPreviewQuery.gql';
|
|
46
|
+
import routeQuery from './RouteQuery.gql';
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
fallback: <LoadingPage />
|
|
56
|
-
}
|
|
57
|
-
);
|
|
48
|
+
import { theme } from './Theme';
|
|
49
|
+
import loadFontCss from '../fonts/loadFontCss';
|
|
50
|
+
import '../globalStyles';
|
|
58
51
|
|
|
59
52
|
function Shop() {
|
|
60
53
|
const { routes } = useShopConfig();
|
|
@@ -76,49 +69,32 @@ function Shop() {
|
|
|
76
69
|
<Content>
|
|
77
70
|
<PaginationProvider defaultProductsPerPage={24}>
|
|
78
71
|
<Switch>
|
|
79
|
-
<Route exact path="/"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<Route path=
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<Route path={routes.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<Route path={routes.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<Route
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<StoreLocator />
|
|
99
|
-
</Route>
|
|
100
|
-
<Route path={`${routes.store.path}/:id`}>
|
|
101
|
-
<Store />
|
|
102
|
-
</Route>
|
|
103
|
-
<Route path={routes.tree.path}>
|
|
104
|
-
<NavTreePage />
|
|
105
|
-
</Route>
|
|
106
|
-
<Route path={routes.myPages.path}>
|
|
107
|
-
<MyPages />
|
|
108
|
-
</Route>
|
|
109
|
-
<Route exact path={routes.forgotPassword.path}>
|
|
110
|
-
<ForgotPassword />
|
|
111
|
-
</Route>
|
|
112
|
-
<Route path={`${routes.resetPassword.path}/:token`}>
|
|
113
|
-
<ResetPassword />
|
|
114
|
-
</Route>
|
|
72
|
+
<Route exact path="/" component={StartPage} />
|
|
73
|
+
<Route path="/favourites" component={Favourites} />
|
|
74
|
+
<Route path={routes.search.path} component={SearchPage} />
|
|
75
|
+
<Route path={routes.signup.path} component={SignUpPage} />
|
|
76
|
+
<Route path={routes.login.path} component={LogInPage} />
|
|
77
|
+
<Route path={routes.logout.path} component={LogOutPage} />
|
|
78
|
+
<Route path={routes.stores.path} component={StoreLocator} />
|
|
79
|
+
<Route path={`${routes.store.path}/:id`} component={Store} />
|
|
80
|
+
<Route path={routes.tree.path} component={NavTreePage} />
|
|
81
|
+
<Route path={routes.myPages.path} component={MyPages} />
|
|
82
|
+
<Route
|
|
83
|
+
exact
|
|
84
|
+
path={routes.forgotPassword.path}
|
|
85
|
+
component={ForgotPassword}
|
|
86
|
+
/>
|
|
87
|
+
<Route
|
|
88
|
+
path={`${routes.resetPassword.path}/:token`}
|
|
89
|
+
component={ResetPassword}
|
|
90
|
+
/>
|
|
115
91
|
<Route
|
|
116
92
|
path="/preview"
|
|
117
93
|
render={props => (
|
|
118
94
|
<PreviewRoute
|
|
119
|
-
productQuery={
|
|
120
|
-
categoryQuery={
|
|
121
|
-
pageQuery={
|
|
95
|
+
productQuery={productPreviewQuery}
|
|
96
|
+
categoryQuery={categoryPreviewQuery}
|
|
97
|
+
pageQuery={pagePreviewQuery}
|
|
122
98
|
productPage={ProductPage}
|
|
123
99
|
categoryPage={CategoryPage}
|
|
124
100
|
contentPage={ContentPage}
|