From daecc7a1288e8affd41837e36fc119ac2887ce4e Mon Sep 17 00:00:00 2001 From: Gabriel L Martinez Date: Fri, 10 Apr 2020 20:27:15 -0400 Subject: [PATCH] Use isPublished property correctly in Product List --- .../components/ProductList/ProductList.tsx | 9 ++++----- src/products/fixtures.ts | 20 +++++++++++++++++++ src/products/queries.ts | 1 + src/products/types/ProductList.ts | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/products/components/ProductList/ProductList.tsx b/src/products/components/ProductList/ProductList.tsx index dcd7c7add..895194939 100644 --- a/src/products/components/ProductList/ProductList.tsx +++ b/src/products/components/ProductList/ProductList.tsx @@ -105,7 +105,6 @@ interface ProductListProps export const ProductList: React.FC = props => { const { activeAttributeSortId, - settings, disabled, isChecked, @@ -322,13 +321,13 @@ export const ProductList: React.FC = props => { product.isAvailable)} + data-tc-is-published={maybe(() => product.isPublished)} > {product && - maybe(() => product.isAvailable !== undefined) ? ( + maybe(() => product.isPublished !== undefined) ? ( = props => { description: "product status" }) } - status={product.isAvailable ? "success" : "error"} + status={product.isPublished ? "success" : "error"} /> ) : ( diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index 2730c64fe..0980e1be6 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -302,6 +302,7 @@ export const products = ( }, id: "UHJvZHVjdDo2MQ==", isAvailable: true, + isPublished: true, name: "Nebula Night Sky Paint", productType: { __typename: "ProductType", @@ -323,6 +324,7 @@ export const products = ( }, id: "UHJvZHVjdDo2NA==", isAvailable: true, + isPublished: true, name: "Light Speed Yellow Paint", productType: { __typename: "ProductType", @@ -344,6 +346,7 @@ export const products = ( }, id: "UHJvZHVjdDo2NQ==", isAvailable: true, + isPublished: true, name: "Hyperspace Turquoise Paint", productType: { __typename: "ProductType", @@ -380,6 +383,7 @@ export const products = ( }, id: "UHJvZHVjdDo3NQ==", isAvailable: true, + isPublished: true, name: "Pineapple Juice", productType: { __typename: "ProductType", @@ -416,6 +420,7 @@ export const products = ( }, id: "UHJvZHVjdDo3Ng==", isAvailable: true, + isPublished: true, name: "Coconut Juice", productType: { __typename: "ProductType", @@ -452,6 +457,7 @@ export const products = ( }, id: "UHJvZHVjdDo3Mg==", isAvailable: true, + isPublished: true, name: "Apple Juice", productType: { __typename: "ProductType", @@ -488,6 +494,7 @@ export const products = ( }, id: "UHJvZHVjdDo3MQ==", isAvailable: true, + isPublished: true, name: "Orange Juice", productType: { __typename: "ProductType", @@ -524,6 +531,7 @@ export const products = ( }, id: "UHJvZHVjdDo3NA==", isAvailable: true, + isPublished: true, name: "Banana Juice", productType: { __typename: "ProductType", @@ -560,6 +568,7 @@ export const products = ( }, id: "UHJvZHVjdDo3OQ==", isAvailable: true, + isPublished: true, name: "Bean Juice", productType: { __typename: "ProductType", @@ -596,6 +605,7 @@ export const products = ( }, id: "UHJvZHVjdDo3Mw==", isAvailable: true, + isPublished: true, name: "Carrot Juice", productType: { __typename: "ProductType", @@ -632,6 +642,7 @@ export const products = ( }, id: "UHJvZHVjdDo3OA==", isAvailable: true, + isPublished: true, name: "Green Juice", productType: { __typename: "ProductType", @@ -668,6 +679,7 @@ export const products = ( }, id: "UHJvZHVjdDo4OQ==", isAvailable: true, + isPublished: true, name: "Code Division T-shirt", productType: { __typename: "ProductType", @@ -704,6 +716,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMDc=", isAvailable: true, + isPublished: true, name: "Polo Shirt", productType: { __typename: "ProductType", @@ -740,6 +753,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMDg=", isAvailable: true, + isPublished: true, name: "Polo Shirt", productType: { __typename: "ProductType", @@ -776,6 +790,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMDk=", isAvailable: true, + isPublished: true, name: "Polo Shirt", productType: { __typename: "ProductType", @@ -812,6 +827,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTA=", isAvailable: true, + isPublished: true, name: "Polo Shirt", productType: { __typename: "ProductType", @@ -848,6 +864,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTU=", isAvailable: true, + isPublished: true, name: "Black Hoodie", productType: { __typename: "ProductType", @@ -884,6 +901,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTY=", isAvailable: true, + isPublished: true, name: "Blue Hoodie", productType: { __typename: "ProductType", @@ -920,6 +938,7 @@ export const products = ( }, id: "UHJvZHVjdDoxMTc=", isAvailable: true, + isPublished: true, name: "Mustard Hoodie", productType: { __typename: "ProductType", @@ -956,6 +975,7 @@ export const products = ( }, id: "UHJvZHVjdDo4NQ==", isAvailable: true, + isPublished: true, name: "Colored Parrot Cushion", productType: { __typename: "ProductType", diff --git a/src/products/queries.ts b/src/products/queries.ts index 99236c111..dbed486ce 100644 --- a/src/products/queries.ts +++ b/src/products/queries.ts @@ -53,6 +53,7 @@ export const productFragment = gql` url } isAvailable + isPublished basePrice { ...Money } diff --git a/src/products/types/ProductList.ts b/src/products/types/ProductList.ts index ab392aa3e..66d7f268b 100644 --- a/src/products/types/ProductList.ts +++ b/src/products/types/ProductList.ts @@ -48,6 +48,7 @@ export interface ProductList_products_edges_node { name: string; thumbnail: ProductList_products_edges_node_thumbnail | null; isAvailable: boolean | null; + isPublished: boolean | null; basePrice: ProductList_products_edges_node_basePrice | null; productType: ProductList_products_edges_node_productType; attributes: ProductList_products_edges_node_attributes[];