Merge branch 'master' into fix/changing-sorting-option-should-reset-pagination

This commit is contained in:
Gabriel L Martinez 2020-04-14 06:16:41 -04:00 committed by GitHub
commit c800de35fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 2156 additions and 20 deletions

View file

@ -42,6 +42,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Reset state after closing - #456 by @dominik-zeglen - Reset state after closing - #456 by @dominik-zeglen
- Password validation errors are not shown - #471 by @gabmartinez - Password validation errors are not shown - #471 by @gabmartinez
- Reset pagination when guest change the sorting of the list - #474 by @gabmartinez - Reset pagination when guest change the sorting of the list - #474 by @gabmartinez
- Display Is Published column correctly in main Product Listing - #475 by @gabmartinez
## 2.0.0 ## 2.0.0

View file

@ -105,7 +105,6 @@ interface ProductListProps
export const ProductList: React.FC<ProductListProps> = props => { export const ProductList: React.FC<ProductListProps> = props => {
const { const {
activeAttributeSortId, activeAttributeSortId,
settings, settings,
disabled, disabled,
isChecked, isChecked,
@ -322,13 +321,13 @@ export const ProductList: React.FC<ProductListProps> = props => {
<TableCell <TableCell
className={classes.colPublished} className={classes.colPublished}
data-tc="isPublished" data-tc="isPublished"
data-tc-is-published={maybe(() => product.isAvailable)} data-tc-is-published={maybe(() => product.isPublished)}
> >
{product && {product &&
maybe(() => product.isAvailable !== undefined) ? ( maybe(() => product.isPublished !== undefined) ? (
<StatusLabel <StatusLabel
label={ label={
product.isAvailable product.isPublished
? intl.formatMessage({ ? intl.formatMessage({
defaultMessage: "Published", defaultMessage: "Published",
description: "product status" description: "product status"
@ -338,7 +337,7 @@ export const ProductList: React.FC<ProductListProps> = props => {
description: "product status" description: "product status"
}) })
} }
status={product.isAvailable ? "success" : "error"} status={product.isPublished ? "success" : "error"}
/> />
) : ( ) : (
<Skeleton /> <Skeleton />

View file

@ -302,6 +302,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo2MQ==", id: "UHJvZHVjdDo2MQ==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Nebula Night Sky Paint", name: "Nebula Night Sky Paint",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -323,6 +324,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo2NA==", id: "UHJvZHVjdDo2NA==",
isAvailable: true, isAvailable: true,
isPublished: false,
name: "Light Speed Yellow Paint", name: "Light Speed Yellow Paint",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -344,6 +346,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo2NQ==", id: "UHJvZHVjdDo2NQ==",
isAvailable: true, isAvailable: true,
isPublished: false,
name: "Hyperspace Turquoise Paint", name: "Hyperspace Turquoise Paint",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -380,6 +383,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo3NQ==", id: "UHJvZHVjdDo3NQ==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Pineapple Juice", name: "Pineapple Juice",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -416,6 +420,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo3Ng==", id: "UHJvZHVjdDo3Ng==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Coconut Juice", name: "Coconut Juice",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -452,6 +457,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo3Mg==", id: "UHJvZHVjdDo3Mg==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Apple Juice", name: "Apple Juice",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -488,6 +494,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo3MQ==", id: "UHJvZHVjdDo3MQ==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Orange Juice", name: "Orange Juice",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -524,6 +531,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo3NA==", id: "UHJvZHVjdDo3NA==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Banana Juice", name: "Banana Juice",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -560,6 +568,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo3OQ==", id: "UHJvZHVjdDo3OQ==",
isAvailable: true, isAvailable: true,
isPublished: false,
name: "Bean Juice", name: "Bean Juice",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -596,6 +605,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo3Mw==", id: "UHJvZHVjdDo3Mw==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Carrot Juice", name: "Carrot Juice",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -632,6 +642,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo3OA==", id: "UHJvZHVjdDo3OA==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Green Juice", name: "Green Juice",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -668,6 +679,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo4OQ==", id: "UHJvZHVjdDo4OQ==",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Code Division T-shirt", name: "Code Division T-shirt",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -704,6 +716,7 @@ export const products = (
}, },
id: "UHJvZHVjdDoxMDc=", id: "UHJvZHVjdDoxMDc=",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Polo Shirt", name: "Polo Shirt",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -740,6 +753,7 @@ export const products = (
}, },
id: "UHJvZHVjdDoxMDg=", id: "UHJvZHVjdDoxMDg=",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Polo Shirt", name: "Polo Shirt",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -776,6 +790,7 @@ export const products = (
}, },
id: "UHJvZHVjdDoxMDk=", id: "UHJvZHVjdDoxMDk=",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Polo Shirt", name: "Polo Shirt",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -812,6 +827,7 @@ export const products = (
}, },
id: "UHJvZHVjdDoxMTA=", id: "UHJvZHVjdDoxMTA=",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Polo Shirt", name: "Polo Shirt",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -848,6 +864,7 @@ export const products = (
}, },
id: "UHJvZHVjdDoxMTU=", id: "UHJvZHVjdDoxMTU=",
isAvailable: true, isAvailable: true,
isPublished: false,
name: "Black Hoodie", name: "Black Hoodie",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -884,6 +901,7 @@ export const products = (
}, },
id: "UHJvZHVjdDoxMTY=", id: "UHJvZHVjdDoxMTY=",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Blue Hoodie", name: "Blue Hoodie",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -920,6 +938,7 @@ export const products = (
}, },
id: "UHJvZHVjdDoxMTc=", id: "UHJvZHVjdDoxMTc=",
isAvailable: true, isAvailable: true,
isPublished: true,
name: "Mustard Hoodie", name: "Mustard Hoodie",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",
@ -956,6 +975,7 @@ export const products = (
}, },
id: "UHJvZHVjdDo4NQ==", id: "UHJvZHVjdDo4NQ==",
isAvailable: true, isAvailable: true,
isPublished: false,
name: "Colored Parrot Cushion", name: "Colored Parrot Cushion",
productType: { productType: {
__typename: "ProductType", __typename: "ProductType",

View file

@ -53,6 +53,7 @@ export const productFragment = gql`
url url
} }
isAvailable isAvailable
isPublished
basePrice { basePrice {
...Money ...Money
} }

View file

@ -48,6 +48,7 @@ export interface ProductList_products_edges_node {
name: string; name: string;
thumbnail: ProductList_products_edges_node_thumbnail | null; thumbnail: ProductList_products_edges_node_thumbnail | null;
isAvailable: boolean | null; isAvailable: boolean | null;
isPublished: boolean | null;
basePrice: ProductList_products_edges_node_basePrice | null; basePrice: ProductList_products_edges_node_basePrice | null;
productType: ProductList_products_edges_node_productType; productType: ProductList_products_edges_node_productType;
attributes: ProductList_products_edges_node_attributes[]; attributes: ProductList_products_edges_node_attributes[];

File diff suppressed because it is too large Load diff

View file

@ -58,4 +58,16 @@ storiesOf("Views / Products / Product list", module)
disabled={true} disabled={true}
/> />
)) ))
.add("published", () => (
<ProductListPage
{...props}
products={products.filter(product => product.isPublished)}
/>
))
.add("not published", () => (
<ProductListPage
{...props}
products={products.filter(product => !product.isPublished)}
/>
))
.add("no data", () => <ProductListPage {...props} products={[]} />); .add("no data", () => <ProductListPage {...props} products={[]} />);