diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index e9682467d..e81189a02 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -430,7 +430,7 @@ "string": "Taxes" }, "productTypeTaxesInputLabel": { - "string": "Taxes" + "string": "Tax group" }, "productVariantCreatePricesSetPricePlaceholder": { "context": "input label", @@ -6502,10 +6502,6 @@ "context": "modal button upload", "string": "Upload" }, - "src_dot_products_dot_components_dot_ProductOrganization_dot_150865454": { - "context": "product is not configurable", - "string": "Simple" - }, "src_dot_products_dot_components_dot_ProductOrganization_dot_1755013298": { "string": "Category" }, @@ -6517,7 +6513,6 @@ "string": "Organize Product" }, "src_dot_products_dot_components_dot_ProductOrganization_dot_2754779425": { - "context": "product is configurable", "string": "Configurable" }, "src_dot_products_dot_components_dot_ProductOrganization_dot_2805838453": { diff --git a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx index 97a2e87aa..1c2ff039c 100644 --- a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx +++ b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx @@ -2,9 +2,9 @@ import { Popper, TextField, Typography } from "@material-ui/core"; import { fade } from "@material-ui/core/styles/colorManipulator"; import CloseIcon from "@material-ui/icons/Close"; import Debounce, { DebounceProps } from "@saleor/components/Debounce"; -import ArrowDropdownIcon from "@saleor/icons/ArrowDropdown"; -import { IconButton, makeStyles } from "@saleor/macaw-ui"; +import { ChevronIcon, IconButton, makeStyles } from "@saleor/macaw-ui"; import { FetchMoreProps } from "@saleor/types"; +import classNames from "classnames"; import Downshift, { ControllerStateAndHelpers } from "downshift"; import { filter } from "fuzzaldrin"; import React from "react"; @@ -65,12 +65,18 @@ const useStyles = makeStyles( paddingRight: theme.spacing(1) }, adornment: { + color: theme.palette.saleor.main[3], + cursor: "pointer", + userSelect: "none", display: "flex", alignItems: "center", - userSelect: "none", - cursor: "pointer", - "&:active": { - pointerEvents: "none" + "& svg": { + transition: theme.transitions.duration.shorter + "ms" + } + }, + adornmentRotate: { + "& svg": { + transform: "rotate(180deg)" } } }), @@ -167,7 +173,8 @@ const MultiAutocompleteSelectFieldComponent: React.FC { const displayCustomValue = inputValue && @@ -183,13 +190,17 @@ const MultiAutocompleteSelectFieldComponent: React.FC +
{endAdornment} - +
), ref: anchor, - onBlur, onFocus: () => { if (fetchOnFocus) { fetchChoices(inputValue); @@ -208,6 +219,7 @@ const MultiAutocompleteSelectFieldComponent: React.FC {isOpen && ( { const isCustomValueSelected = choices && selectedItem @@ -178,13 +185,17 @@ const SingleAutocompleteSelectFieldComponent: React.FC - +
+
), error, id: undefined, - onBlur: handleBlur, onFocus: () => { if (fetchOnFocus) { fetchChoices(inputValue); @@ -198,7 +209,8 @@ const SingleAutocompleteSelectFieldComponent: React.FC { + if (disabled) { + return; + } + toggleMenu(); + } }) }} error={error} diff --git a/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.tsx b/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.tsx index 5a7150936..d2d9f692e 100644 --- a/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.tsx +++ b/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.tsx @@ -48,7 +48,7 @@ const ProductTypeTaxes: React.FC = props => { disabled={disabled} displayValue={taxTypeDisplayName} label={intl.formatMessage({ - defaultMessage: "Taxes", + defaultMessage: "Tax group", id: "productTypeTaxesInputLabel" })} name={"taxType" as keyof ProductTypeForm} diff --git a/src/products/components/ProductOrganization/ProductOrganization.tsx b/src/products/components/ProductOrganization/ProductOrganization.tsx index 6487a8c5d..f45be0bfd 100644 --- a/src/products/components/ProductOrganization/ProductOrganization.tsx +++ b/src/products/components/ProductOrganization/ProductOrganization.tsx @@ -12,6 +12,7 @@ import SingleAutocompleteSelectField, { } from "@saleor/components/SingleAutocompleteSelectField"; import { ProductErrorFragment } from "@saleor/graphql"; import { ChangeEvent } from "@saleor/hooks/useForm"; +import { commonMessages } from "@saleor/intl"; import { makeStyles } from "@saleor/macaw-ui"; import { maybe } from "@saleor/misc"; import { productTypeUrl } from "@saleor/productTypes/urls"; @@ -132,28 +133,24 @@ const ProductOrganization: React.FC = props => { - - {productType?.name ?? "..."} - + + + {productType?.name ?? "..."} + + - + {maybe( () => productType.hasVariants - ? intl.formatMessage({ - defaultMessage: "Configurable", - description: "product is configurable" - }) - : intl.formatMessage({ - defaultMessage: "Simple", - description: "product is not configurable" - }), + ? intl.formatMessage(commonMessages.yes) + : intl.formatMessage(commonMessages.no), "..." )} diff --git a/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx index ef533258e..f89211ab4 100644 --- a/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx +++ b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx @@ -38,7 +38,7 @@ const useExpanderStyles = makeStyles( ); const useSummaryStyles = makeStyles( - theme => ({ + () => ({ expanded: {}, root: { width: "100%", @@ -46,10 +46,6 @@ const useSummaryStyles = makeStyles( margin: 0, padding: 0, minHeight: 0, - paddingTop: theme.spacing(2), - paddingLeft: theme.spacing(3), - paddingRight: theme.spacing(5.5), - paddingBottom: theme.spacing(2), "&$expanded": { minHeight: 0 @@ -66,6 +62,15 @@ const useSummaryStyles = makeStyles( { name: "VariantDetailsChannelsAvailabilityCardExpanderSummary" } ); +const useStyles = makeStyles( + () => ({ + summaryContent: { + paddingTop: 0 + } + }), + { name: "VariantDetailsChannelsAvailabilityCard" } +); + interface VariantDetailsChannelsAvailabilityCardProps { variant: ProductVariantFragment; } @@ -73,6 +78,7 @@ interface VariantDetailsChannelsAvailabilityCardProps { const VariantDetailsChannelsAvailabilityCard: React.FC = ({ variant }) => { + const classes = useStyles(); const expanderClasses = useExpanderStyles({}); const summaryClasses = useSummaryStyles({}); const localizeDate = useDateLocalize(); @@ -139,18 +145,20 @@ const VariantDetailsChannelsAvailabilityCard: React.FC - } - classes={summaryClasses} - data-test-id="channels-variant-availability-summary" - > - - {intl.formatMessage(messages.subtitle, { - publishedInChannelsCount: publishedInChannelsListings.length, - availableChannelsCount: allAvailableChannelsListings.length - })} - - + + } + classes={summaryClasses} + data-test-id="channels-variant-availability-summary" + > + + {intl.formatMessage(messages.subtitle, { + publishedInChannelsCount: publishedInChannelsListings.length, + availableChannelsCount: allAvailableChannelsListings.length + })} + + + {channelListings.map(({ channel }) => ( diff --git a/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx b/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx index 135e61ea0..b3ba78c4d 100644 --- a/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx +++ b/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx @@ -28,16 +28,7 @@ import React from "react"; import { FormattedMessage, MessageDescriptor, useIntl } from "react-intl"; const useStyles = makeStyles( - theme => ({ - caption: { - fontSize: 14, - padding: theme.spacing(0, 3, 2, 3) - }, - colName: { - fontSize: 14, - paddingLeft: 0, - width: "auto" - }, + () => ({ colPrice: { textAlign: "right", verticalAlign: "top", @@ -124,126 +115,125 @@ const ProductVariantPrice: React.FC = props => { description: "product pricing, section header" })} /> - - + + {intl.formatMessage({ defaultMessage: "Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency", description: "info text" })} - - - - - - - - - - - - - - - - {renderCollection( - ProductVariantChannelListings, - (listing, index) => { - const priceError = getFormChannelError( - formErrors.price, - listing.id - ); - const costPriceError = getFormChannelError( - formErrors.costPrice, - listing.id - ); + + + + + + + + + + + + + + + + + {renderCollection( + ProductVariantChannelListings, + (listing, index) => { + const priceError = getFormChannelError( + formErrors.price, + listing.id + ); + const costPriceError = getFormChannelError( + formErrors.costPrice, + listing.id + ); - return ( - - {listing?.name || } - - {listing ? ( - - onChange(listing.id, { - costPrice: listing.costPrice, - price: e.target.value, - preorderThreshold: listing.preorderThreshold - }) - } - disabled={loading} - required - hint={ - priceError && - getProductErrorMessage(priceError, intl) - } - /> - ) : ( - - )} - - - {listing ? ( - - onChange(listing.id, { - costPrice: e.target.value, - price: listing.price, - preorderThreshold: listing.preorderThreshold - }) - } - disabled={loading} - hint={ - costPriceError - ? getProductErrorMessage(costPriceError, intl) - : "" - } - /> - ) : ( - - )} - - - ); - }, - () => ( - - - + return ( + + {listing?.name || } + + {listing ? ( + + onChange(listing.id, { + costPrice: listing.costPrice, + price: e.target.value, + preorderThreshold: listing.preorderThreshold + }) + } + disabled={loading} + required + hint={ + priceError && getProductErrorMessage(priceError, intl) + } + /> + ) : ( + + )} + + + {listing ? ( + + onChange(listing.id, { + costPrice: e.target.value, + price: listing.price, + preorderThreshold: listing.preorderThreshold + }) + } + disabled={loading} + hint={ + costPriceError + ? getProductErrorMessage(costPriceError, intl) + : "" + } + /> + ) : ( + + )} - ) - )} - - - + ); + }, + () => ( + + + + + + ) + )} + + ); }; diff --git a/src/shipping/components/ShippingZoneCountriesAssignDialog/ShippingZoneCountriesAssignDialog.tsx b/src/shipping/components/ShippingZoneCountriesAssignDialog/ShippingZoneCountriesAssignDialog.tsx index c8c0be231..5b1f0924f 100644 --- a/src/shipping/components/ShippingZoneCountriesAssignDialog/ShippingZoneCountriesAssignDialog.tsx +++ b/src/shipping/components/ShippingZoneCountriesAssignDialog/ShippingZoneCountriesAssignDialog.tsx @@ -127,7 +127,14 @@ const ShippingZoneCountriesAssignDialog: React.FC - + + handleRestOfTheWorldChange( + !isRestOfTheWorldSelected + ) + } + > - handleRestOfTheWorldChange( - !isRestOfTheWorldSelected - ) - } /> @@ -171,7 +173,13 @@ const ShippingZoneCountriesAssignDialog: React.FC + + handleCountryChange(country.code, !isChecked) + } + key={country.code} + > {country.country} @@ -179,12 +187,7 @@ const ShippingZoneCountriesAssignDialog: React.FC - - handleCountryChange(country.code, !isChecked) - } - /> + ); diff --git a/src/shipping/components/ShippingZoneCountriesAssignDialog/styles.ts b/src/shipping/components/ShippingZoneCountriesAssignDialog/styles.ts index 99317cecf..41427749f 100644 --- a/src/shipping/components/ShippingZoneCountriesAssignDialog/styles.ts +++ b/src/shipping/components/ShippingZoneCountriesAssignDialog/styles.ts @@ -2,6 +2,10 @@ import { makeStyles } from "@saleor/macaw-ui"; export const useStyles = makeStyles( theme => ({ + clickableRow: { + cursor: "pointer", + userSelect: "none" + }, checkboxCell: { paddingLeft: 0 }, diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 84941aa1c..2b004ceb9 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -127,7 +127,12 @@ exports[`Storyshots Attributes / Attributes default 1`] = ` value="" />
@@ -13999,7 +14131,12 @@ exports[`Storyshots Generics / Select with autocomplete naked and disabled 1`] = value="Afghanistan" />
@@ -23503,7 +23641,12 @@ exports[`Storyshots Shipping zones details / Settings Card default 1`] = ` value="" />
- Taxes + Tax group
- Taxes + Tax group
@@ -164703,7 +165051,7 @@ exports[`Storyshots Views / Product types / Create product type form errors 1`] class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - Taxes + Tax group
- Taxes + Tax group
@@ -165250,7 +165604,7 @@ exports[`Storyshots Views / Product types / Create product type loading 1`] = ` class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id" data-shrink="false" > - Taxes + Tax group
- Taxes + Tax group
@@ -165789,7 +166149,7 @@ exports[`Storyshots Views / Product types / Product type details default 1`] = ` class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - Taxes + Tax group
- Taxes + Tax group
@@ -166922,7 +167288,7 @@ exports[`Storyshots Views / Product types / Product type details form errors 1`] class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - Taxes + Tax group
- Taxes + Tax group
@@ -168061,7 +168433,7 @@ exports[`Storyshots Views / Product types / Product type details loading 1`] = ` class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id" data-shrink="false" > - Taxes + Tax group
- Taxes + Tax group
@@ -168782,7 +169160,7 @@ exports[`Storyshots Views / Product types / Product type details no attributes 1 class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - Taxes + Tax group
- Taxes + Tax group
@@ -177927,7 +178311,12 @@ exports[`Storyshots Views / Products / Create multiple variants choose values 1` value="" />
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Configurable + Yes
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Configurable + Yes
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Configurable + Yes
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Configurable + Yes
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Simple + No
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Simple + No
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Simple + No
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Configurable + Yes
Product Type
- - ... - + + ... + +
- Product Type + Configurable
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Configurable + Yes
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Simple + No
Product Type
- - Versatile - + + Versatile + +
- Product Type + Configurable
- Configurable + Yes
+
Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency
-
+
+ -
- - - - - - - - + + + + + + - - - - - - + - - - - -
- Channel Name - - Selling Price - - Cost price -
+ Selling Price + + Cost price +
- Test channel - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- - Test channel other - -
- -
- -
-
- USD -
-
- -
-
-
+  * + +
- +
-
-
- USD -
+ USD
-
+
-
-
+
+ + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + + + + Test channel other + + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + + +
+
Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency
-
+
+ -
- - - - - - - - + + + + + + - - - - - - + - - - - -
- Channel Name - - Selling Price - - Cost price -
+ Selling Price + + Cost price +
- Test channel - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- - Test channel other - -
- -
- -
-
- USD -
-
- -
-
-
+  * + +
- +
-
-
- USD -
+ USD
-
+
-
-
+
+ + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + + + + Test channel other + + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + + +
+
Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency
-
+
+ -
- - - - - - - - + + + + + + - - - - - - + - - - - -
- Channel Name - - Selling Price - - Cost price -
+ Selling Price + + Cost price +
- Test channel - -
- -
- -
-
- USD -
-
- -
-
-
-
- -
- -
-
- USD -
-
- -
-
-
- - Test channel other - -
- -
- -
-
- USD -
-
- -
-
-
+  * + +
- +
-
-
- USD -
+ USD
-
+
-
-
+
+ + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + + + + Test channel other + + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + +
+ +
+ +
+
+ USD +
+
+ +
+
+ + + +