Refactor translations in product type section (#126)

This commit is contained in:
Dominik Żegleń 2019-08-26 19:56:15 +02:00 committed by dominik-zeglen
parent 63e4f9bd34
commit 9abc98bdff
19 changed files with 921 additions and 429 deletions

View file

@ -1,6 +1,6 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2019-08-26T17:50:42.071Z\n"
"POT-Creation-Date: 2019-08-26T17:55:41.507Z\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"MIME-Version: 1.0\n"
@ -223,6 +223,14 @@ msgctxt "button"
msgid "Add product"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.json
#. [src.productTypes.components.ProductTypeListPage.889729490] - button
#. defaultMessage is:
#. Add product type
msgctxt "button"
msgid "Add product type"
msgstr ""
#: build/locale/src/orders/components/OrderDraftDetails/OrderDraftDetails.json
#. [src.orders.components.OrderDraftDetails.2528459381] - button
#. defaultMessage is:
@ -615,6 +623,14 @@ msgctxt "dialog content"
msgid "Are you sure you want to delete {counter,plural,one{this page} other{{displayQuantity} pages}}?"
msgstr ""
#: build/locale/src/productTypes/views/ProductTypeList.json
#. [src.productTypes.views.2294091098] - dialog content
#. defaultMessage is:
#. Are you sure you want to delete {counter,plural,one{this product type} other{{displayQuantity} product types}}?
msgctxt "dialog content"
msgid "Are you sure you want to delete {counter,plural,one{this product type} other{{displayQuantity} product types}}?"
msgstr ""
#: build/locale/src/products/views/ProductList/ProductList.json
#. [src.products.views.ProductList.2742463171] - dialog content
#. defaultMessage is:
@ -679,6 +695,14 @@ msgctxt "delete product"
msgid "Are you sure you want to delete {name}?"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeDeleteDialog/ProductTypeDeleteDialog.json
#. [src.productTypes.components.ProductTypeDeleteDialog.2297471173] - delete product type
#. defaultMessage is:
#. Are you sure you want to delete {name}?
msgctxt "delete product type"
msgid "Are you sure you want to delete {name}?"
msgstr ""
#: build/locale/src/discounts/views/SaleDetails.json
#. [src.discounts.views.1457489953] - dialog content
#. defaultMessage is:
@ -759,6 +783,22 @@ msgctxt "description"
msgid "Are you sure you want to remove this image?"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributeUnassignDialog/ProductTypeAttributeUnassignDialog.json
#. [src.productTypes.components.ProductTypeAttributeUnassignDialog.722498450]
#. defaultMessage is:
#. Are you sure you want to unassign {attributeName} from {productTypeName}?
msgctxt "description"
msgid "Are you sure you want to unassign {attributeName} from {productTypeName}?"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeBulkAttributeUnassignDialog/ProductTypeBulkAttributeUnassignDialog.json
#. [src.productTypes.components.ProductTypeBulkAttributeUnassignDialog.2500510112] - unassign multiple attributes from product type
#. defaultMessage is:
#. Are you sure you want to unassign {counter,plural,one{this attribute} other{{displayQuantity} attributes}} from {productTypeName}?
msgctxt "unassign multiple attributes from product type"
msgid "Are you sure you want to unassign {counter,plural,one{this attribute} other{{displayQuantity} attributes}} from {productTypeName}?"
msgstr ""
#: build/locale/src/discounts/views/SaleDetails.json
#. [src.discounts.views.376977560] - dialog content
#. defaultMessage is:
@ -835,6 +875,14 @@ msgctxt "description"
msgid "Are you sure you want to void this payment?"
msgstr ""
#: build/locale/src/productTypes/components/AssignAttributeDialog/AssignAttributeDialog.json
#. [src.productTypes.components.AssignAttributeDialog.3922579741] - dialog header
#. defaultMessage is:
#. Assign Attribute
msgctxt "dialog header"
msgid "Assign Attribute"
msgstr ""
#: build/locale/src/discounts/components/DiscountCountrySelectDialog/DiscountCountrySelectDialog.json
#. [src.discounts.components.DiscountCountrySelectDialog.1585396479] - dialog header
#. defaultMessage is:
@ -843,6 +891,22 @@ msgctxt "dialog header"
msgid "Assign Countries"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.json
#. [src.productTypes.components.ProductTypeAttributes.1656462109] - button
#. defaultMessage is:
#. Assign attribute
msgctxt "button"
msgid "Assign attribute"
msgstr ""
#: build/locale/src/productTypes/components/AssignAttributeDialog/AssignAttributeDialog.json
#. [src.productTypes.components.AssignAttributeDialog.2173976534] - button
#. defaultMessage is:
#. Assign attributes
msgctxt "button"
msgid "Assign attributes"
msgstr ""
#: build/locale/src/discounts/components/DiscountCategories/DiscountCategories.json
#. [src.discounts.components.DiscountCategories.3973677075] - button
#. defaultMessage is:
@ -915,6 +979,26 @@ msgctxt "description"
msgid "Attribute deleted"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributeEditDialog/ProductTypeAttributeEditDialog.json
#. [src.productTypes.components.ProductTypeAttributeEditDialog.1228425832]
#. defaultMessage is:
#. Attribute name
#: build/locale/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.json
#. [src.productTypes.components.ProductTypeAttributes.1228425832]
#. defaultMessage is:
#. Attribute name
msgctxt "description"
msgid "Attribute name"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributeEditDialog/ProductTypeAttributeEditDialog.json
#. [src.productTypes.components.ProductTypeAttributeEditDialog.335542212]
#. defaultMessage is:
#. Attribute values
msgctxt "description"
msgid "Attribute values"
msgstr ""
#: build/locale/src/intl.json
#. [src.attributes] - attributes section name
#. defaultMessage is:
@ -1279,6 +1363,14 @@ msgctxt "product is configurable"
msgid "Configurable"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeList/ProductTypeList.json
#. [src.productTypes.components.ProductTypeList.2754779425] - product type
#. defaultMessage is:
#. Configurable
msgctxt "product type"
msgid "Configurable"
msgstr ""
#: build/locale/src/intl.json
#. [src.configuration] - configuration section name
#. defaultMessage is:
@ -1439,6 +1531,22 @@ msgctxt "window title"
msgid "Create Product"
msgstr ""
#: build/locale/src/productTypes/views/ProductTypeCreate.json
#. [productTypeCreateHeader] - window title
#. defaultMessage is:
#. Create Product Type
msgctxt "window title"
msgid "Create Product Type"
msgstr ""
#: build/locale/src/productTypes/views/ProductTypeCreate.json
#. [productTypeCreatePageHeader] - header
#. defaultMessage is:
#. Create Product Type
msgctxt "header"
msgid "Create Product Type"
msgstr ""
#: build/locale/src/discounts/components/SaleCreatePage/SaleCreatePage.json
#. [src.discounts.components.SaleCreatePage.3866518732] - page header
#. defaultMessage is:
@ -1779,6 +1887,22 @@ msgctxt "dialog header"
msgid "Delete Product"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeDeleteDialog/ProductTypeDeleteDialog.json
#. [src.productTypes.components.ProductTypeDeleteDialog.924066985] - dialog header
#. defaultMessage is:
#. Delete Product Type
msgctxt "dialog header"
msgid "Delete Product Type"
msgstr ""
#: build/locale/src/productTypes/views/ProductTypeList.json
#. [src.productTypes.views.4080551769] - dialog header
#. defaultMessage is:
#. Delete Product Types
msgctxt "dialog header"
msgid "Delete Product Types"
msgstr ""
#: build/locale/src/products/views/ProductUpdate/ProductUpdate.json
#. [src.products.views.ProductUpdate.1454532689] - dialog header
#. defaultMessage is:
@ -2007,6 +2131,14 @@ msgctxt "description"
msgid "Determine attributes used to create product types"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeList/ProductTypeList.json
#. [src.productTypes.components.ProductTypeList.881286562] - product type
#. defaultMessage is:
#. Digital
msgctxt "product type"
msgid "Digital"
msgstr ""
#: build/locale/src/home/components/HomeScreen.json
#. [homeScreenDisclaimer] - header
#. defaultMessage is:
@ -2503,6 +2635,14 @@ msgctxt "product variant stock"
msgid "Inventory"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeShipping/ProductTypeShipping.json
#. [src.productTypes.components.ProductTypeShipping.2143413921] - switch button
#. defaultMessage is:
#. Is this product shippable?
msgctxt "switch button"
msgid "Is this product shippable?"
msgstr ""
#: build/locale/src/navigation/components/MenuList/MenuList.json
#. [menuListItems] - number of menu items
#. defaultMessage is:
@ -2867,6 +3007,10 @@ msgstr ""
#. [src.attributes.components.AttributeList.1192828581]
#. defaultMessage is:
#. No attributes found
#: build/locale/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.json
#. [src.productTypes.components.ProductTypeAttributes.1192828581]
#. defaultMessage is:
#. No attributes found
msgctxt "description"
msgid "No attributes found"
msgstr ""
@ -2971,6 +3115,14 @@ msgctxt "description"
msgid "No payments waiting for capture"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeList/ProductTypeList.json
#. [src.productTypes.components.ProductTypeList.1126553969]
#. defaultMessage is:
#. No product types found
msgctxt "description"
msgid "No product types found"
msgstr ""
#: build/locale/src/categories/components/CategoryProducts/CategoryProducts.json
#. [src.categories.components.CategoryProducts.1657559629]
#. defaultMessage is:
@ -3007,6 +3159,14 @@ msgctxt "description"
msgid "No products out of stock"
msgstr ""
#: build/locale/src/productTypes/components/AssignAttributeDialog/AssignAttributeDialog.json
#. [src.productTypes.components.AssignAttributeDialog.4205644805]
#. defaultMessage is:
#. No results found
msgctxt "description"
msgid "No results found"
msgstr ""
#: build/locale/src/discounts/components/SaleList/SaleList.json
#. [src.discounts.components.SaleList.4101565527]
#. defaultMessage is:
@ -3543,6 +3703,14 @@ msgctxt "section header"
msgid "Photo View"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeList/ProductTypeList.json
#. [src.productTypes.components.ProductTypeList.966610541] - product type
#. defaultMessage is:
#. Physical
msgctxt "product type"
msgid "Physical"
msgstr ""
#: build/locale/src/attributes/components/AttributeProperties/AttributeProperties.json
#. [src.attributes.components.AttributeProperties.3590282519] - attribute position in storefront filters
#. defaultMessage is:
@ -3659,6 +3827,14 @@ msgctxt "product name"
msgid "Product"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.json
#. [src.productTypes.components.ProductTypeAttributes.3559259966] - section header
#. defaultMessage is:
#. Product Attributes
msgctxt "section header"
msgid "Product Attributes"
msgstr ""
#: build/locale/src/discounts/components/DiscountProducts/DiscountProducts.json
#. [src.discounts.components.DiscountProducts.2697405188]
#. defaultMessage is:
@ -3679,6 +3855,14 @@ msgctxt "description"
msgid "Product Type"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeDetails/ProductTypeDetails.json
#. [src.productTypes.components.ProductTypeDetails.1007996279]
#. defaultMessage is:
#. Product Type Name
msgctxt "description"
msgid "Product Type Name"
msgstr ""
#: build/locale/src/intl.json
#. [src.productTypes] - product types section name
#. defaultMessage is:
@ -3715,6 +3899,14 @@ msgctxt "description"
msgid "Product removed"
msgstr ""
#: build/locale/src/productTypes/views/ProductTypeUpdate/index.json
#. [src.productTypes.views.ProductTypeUpdate.3512959355]
#. defaultMessage is:
#. Product type deleted
msgctxt "description"
msgid "Product type deleted"
msgstr ""
#: build/locale/src/categories/components/CategoryProducts/CategoryProducts.json
#. [src.categories.components.CategoryProducts.2968663655] - section header
#. defaultMessage is:
@ -4147,6 +4339,14 @@ msgctxt "description"
msgid "Saved changes"
msgstr ""
#: build/locale/src/productTypes/components/AssignAttributeDialog/AssignAttributeDialog.json
#. [src.productTypes.components.AssignAttributeDialog.902296540]
#. defaultMessage is:
#. Search Attributes
msgctxt "description"
msgid "Search Attributes"
msgstr ""
#: build/locale/src/orders/components/OrderCustomer/OrderCustomer.json
#. [src.orders.components.OrderCustomer.2433460203]
#. defaultMessage is:
@ -4179,6 +4379,14 @@ msgctxt "description"
msgid "Search Products..."
msgstr ""
#: build/locale/src/productTypes/components/AssignAttributeDialog/AssignAttributeDialog.json
#. [src.productTypes.components.AssignAttributeDialog.524117994]
#. defaultMessage is:
#. Search by attribute name
msgctxt "description"
msgid "Search by attribute name"
msgstr ""
#: build/locale/src/discounts/components/DiscountCountrySelectDialog/DiscountCountrySelectDialog.json
#. [src.discounts.components.DiscountCountrySelectDialog.2110418881] - search box placeholder
#. defaultMessage is:
@ -4267,6 +4475,14 @@ msgctxt "order shipping method name"
msgid "Shipping"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeShipping/ProductTypeShipping.json
#. [src.productTypes.components.ProductTypeShipping.1325966144] - product type shipping settings, section header
#. defaultMessage is:
#. Shipping
msgctxt "product type shipping settings, section header"
msgid "Shipping"
msgstr ""
#: build/locale/src/orders/components/OrderCustomer/OrderCustomer.json
#. [src.orders.components.OrderCustomer.2758581442]
#. defaultMessage is:
@ -4339,6 +4555,14 @@ msgctxt "product is not configurable"
msgid "Simple"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeList/ProductTypeList.json
#. [src.productTypes.components.ProductTypeList.1211157042] - product type
#. defaultMessage is:
#. Simple product
msgctxt "product type"
msgid "Simple product"
msgstr ""
#: build/locale/src/intl.json
#. [src.siteSettings] - site settings section name
#. defaultMessage is:
@ -4359,6 +4583,14 @@ msgctxt "page internal name"
msgid "Slug"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.json
#. [src.productTypes.components.ProductTypeAttributes.3478065224] - attribute internal name
#. defaultMessage is:
#. Slug
msgctxt "attribute internal name"
msgid "Slug"
msgstr ""
#: build/locale/src/orders/components/OrderDraftFinalizeDialog/OrderDraftFinalizeDialog.json
#. [src.orders.components.OrderDraftFinalizeDialog.2968256006]
#. defaultMessage is:
@ -4543,6 +4775,14 @@ msgctxt "description"
msgid "Successfully created new page"
msgstr ""
#: build/locale/src/productTypes/views/ProductTypeCreate.json
#. [src.productTypes.views.3822478981]
#. defaultMessage is:
#. Successfully created product type
msgctxt "description"
msgid "Successfully created product type"
msgstr ""
#: build/locale/src/discounts/views/SaleCreate.json
#. [src.discounts.views.3707049729]
#. defaultMessage is:
@ -4567,6 +4807,14 @@ msgctxt "description"
msgid "Summary"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeList/ProductTypeList.json
#. [src.productTypes.components.ProductTypeList.1240292548] - tax rate for a product type
#. defaultMessage is:
#. Tax
msgctxt "tax rate for a product type"
msgid "Tax"
msgstr ""
#: build/locale/src/intl.json
#. [src.taxes] - taxes section name
#. defaultMessage is:
@ -4579,10 +4827,22 @@ msgstr ""
#. [src.orders.components.OrderPayment.3955023266]
#. defaultMessage is:
#. Taxes
#: build/locale/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.json
#. [productTypeTaxesInputLabel]
#. defaultMessage is:
#. Taxes
msgctxt "description"
msgid "Taxes"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.json
#. [productTypeTaxesHeader] - section header
#. defaultMessage is:
#. Taxes
msgctxt "section header"
msgid "Taxes"
msgstr ""
#: build/locale/src/orders/components/OrderDraftDetailsSummary/OrderDraftDetailsSummary.json
#. [src.orders.components.OrderDraftDetailsSummary.3202709354]
#. defaultMessage is:
@ -4663,6 +4923,14 @@ msgctxt "description"
msgid "This product has no variants"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.json
#. [src.productTypes.components.ProductTypeDetailsPage.1756957616] - switch button
#. defaultMessage is:
#. This product type has variants
msgctxt "switch button"
msgid "This product type has variants"
msgstr ""
#: build/locale/src/discounts/components/SalePricing/SalePricing.json
#. [src.discounts.components.SalePricing.2503204759] - time during which sale is active
#. defaultMessage is:
@ -4803,6 +5071,22 @@ msgctxt "product type"
msgid "Type"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeList/ProductTypeList.json
#. [src.productTypes.components.ProductTypeList.1952810469] - product type is either simple or configurable
#. defaultMessage is:
#. Type
msgctxt "product type is either simple or configurable"
msgid "Type"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeList/ProductTypeList.json
#. [src.productTypes.components.ProductTypeList.2253986440] - product type name
#. defaultMessage is:
#. Type Name
msgctxt "product type name"
msgid "Type Name"
msgstr ""
#: build/locale/src/pages/components/PageSlug/PageSlug.json
#. [src.pages.components.PageSlug.1324178587]
#. defaultMessage is:
@ -4867,6 +5151,30 @@ msgctxt "unassign product from voucher, button"
msgid "Unassign"
msgstr ""
#: build/locale/src/productTypes/views/ProductTypeUpdate/index.json
#. [src.productTypes.views.ProductTypeUpdate.870815507] - unassign attribute from product type, button
#. defaultMessage is:
#. Unassign
msgctxt "unassign attribute from product type, button"
msgid "Unassign"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributeUnassignDialog/ProductTypeAttributeUnassignDialog.json
#. [src.productTypes.components.ProductTypeAttributeUnassignDialog.404238501] - dialog header
#. defaultMessage is:
#. Unassign Attribute From Product Type
msgctxt "dialog header"
msgid "Unassign Attribute From Product Type"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeBulkAttributeUnassignDialog/ProductTypeBulkAttributeUnassignDialog.json
#. [src.productTypes.components.ProductTypeBulkAttributeUnassignDialog.766918870] - dialog header
#. defaultMessage is:
#. Unassign Attribute from Product Type
msgctxt "dialog header"
msgid "Unassign Attribute from Product Type"
msgstr ""
#: build/locale/src/discounts/views/SaleDetails.json
#. [src.discounts.views.1827854264] - dialog header
#. defaultMessage is:
@ -5067,6 +5375,14 @@ msgctxt "description"
msgid "Use variants for products that come in a variety of versions for example different sizes or colors"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeShipping/ProductTypeShipping.json
#. [src.productTypes.components.ProductTypeShipping.2927891783]
#. defaultMessage is:
#. Used to calculate rates for shipping for products of this product type, when specific weight is not given
msgctxt "description"
msgid "Used to calculate rates for shipping for products of this product type, when specific weight is not given"
msgstr ""
#: build/locale/src/customers/components/CustomerDetails/CustomerDetails.json
#. [src.customers.components.CustomerDetails.2968565128] - check to mark this account as active
#. defaultMessage is:
@ -5155,6 +5471,14 @@ msgctxt "attribute values"
msgid "Values"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.json
#. [src.productTypes.components.ProductTypeAttributes.888493112] - section header
#. defaultMessage is:
#. Variant Attributes
msgctxt "section header"
msgid "Variant Attributes"
msgstr ""
#: build/locale/src/products/views/ProductVariant.json
#. [src.products.views.2279302139]
#. defaultMessage is:
@ -5279,6 +5603,14 @@ msgctxt "vouchers section name"
msgid "Vouchers"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeShipping/ProductTypeShipping.json
#. [src.productTypes.components.ProductTypeShipping.746695941]
#. defaultMessage is:
#. Weight
msgctxt "description"
msgid "Weight"
msgstr ""
#: build/locale/src/orders/components/OrderPayment/OrderPayment.json
#. [orderPaymentVATDoesNotApply] - vat not included in order price
#. defaultMessage is:

View file

@ -15,6 +15,7 @@ import Typography from "@material-ui/core/Typography";
import makeStyles from "@material-ui/styles/makeStyles";
import React from "react";
import InfiniteScroll from "react-infinite-scroller";
import { FormattedMessage, useIntl } from "react-intl";
import Checkbox from "@saleor/components/Checkbox";
import ConfirmButton, {
@ -23,7 +24,7 @@ import ConfirmButton, {
import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors";
import useModalDialogOpen from "@saleor/hooks/useModalDialogOpen";
import useSearchQuery from "@saleor/hooks/useSearchQuery";
import i18n from "@saleor/i18n";
import { buttonMessages } from "@saleor/intl";
import { maybe, renderCollection } from "@saleor/misc";
import { FetchMoreProps } from "@saleor/types";
import { SearchAttributes_productType_availableAttributes_edges_node } from "../../containers/SearchAttributes/types/SearchAttributes";
@ -73,6 +74,7 @@ const AssignAttributeDialog: React.FC<AssignAttributeDialogProps> = ({
onSubmit,
onToggle
}: AssignAttributeDialogProps) => {
const intl = useIntl();
const classes = useStyles({});
const [query, onQueryChange, resetQuery] = useSearchQuery(onFetch);
const errors = useModalDialogErrors(apiErrors, open);
@ -84,17 +86,22 @@ const AssignAttributeDialog: React.FC<AssignAttributeDialogProps> = ({
return (
<Dialog onClose={onClose} open={open} fullWidth maxWidth="sm">
<DialogTitle>{i18n.t("Assign Attribute")}</DialogTitle>
<DialogTitle>
<FormattedMessage
defaultMessage="Assign Attribute"
description="dialog header"
/>
</DialogTitle>
<DialogContent>
<TextField
name="query"
value={query}
onChange={onQueryChange}
label={i18n.t("Search Attributes", {
context: "attribute search input label"
label={intl.formatMessage({
defaultMessage: "Search Attributes"
})}
placeholder={i18n.t("Search by attribute name", {
context: "attribute search input placeholder"
placeholder={intl.formatMessage({
defaultMessage: "Search by attribute name"
})}
fullWidth
InputProps={{
@ -153,7 +160,7 @@ const AssignAttributeDialog: React.FC<AssignAttributeDialogProps> = ({
!loading && (
<TableRow>
<TableCell colSpan={2}>
{i18n.t("No results found")}
<FormattedMessage defaultMessage="No results found" />
</TableCell>
</TableRow>
)
@ -173,7 +180,7 @@ const AssignAttributeDialog: React.FC<AssignAttributeDialogProps> = ({
)}
<DialogActions>
<Button onClick={onClose}>
{i18n.t("Cancel", { context: "button" })}
<FormattedMessage {...buttonMessages.cancel} />
</Button>
<ConfirmButton
transitionState={confirmButtonState}
@ -182,7 +189,10 @@ const AssignAttributeDialog: React.FC<AssignAttributeDialogProps> = ({
type="submit"
onClick={onSubmit}
>
{i18n.t("Assign attributes", { context: "button" })}
<FormattedMessage
defaultMessage="Assign attributes"
description="button"
/>
</ConfirmButton>
</DialogActions>
</Dialog>

View file

@ -5,11 +5,12 @@ import DialogContent from "@material-ui/core/DialogContent";
import DialogTitle from "@material-ui/core/DialogTitle";
import TextField from "@material-ui/core/TextField";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import Form from "@saleor/components/Form";
import { FormSpacer } from "@saleor/components/FormSpacer";
import ListField from "@saleor/components/ListField";
import i18n from "../../../i18n";
import { buttonMessages } from "@saleor/intl";
export interface FormData {
name: string;
@ -39,6 +40,8 @@ export interface ProductTypeAttributeEditDialogProps {
const ProductTypeAttributeEditDialog: React.StatelessComponent<
ProductTypeAttributeEditDialogProps
> = ({ disabled, errors, name, opened, title, values, onClose, onConfirm }) => {
const intl = useIntl();
const initialForm: FormData = {
name: name || "",
values: values || []
@ -54,7 +57,9 @@ const ProductTypeAttributeEditDialog: React.StatelessComponent<
disabled={disabled}
error={!!formErrors.name}
fullWidth
label={i18n.t("Attribute name")}
label={intl.formatMessage({
defaultMessage: "Attribute name"
})}
helperText={formErrors.name}
name="name"
value={data.name}
@ -71,7 +76,9 @@ const ProductTypeAttributeEditDialog: React.StatelessComponent<
}
fullWidth
name="values"
label={i18n.t("Attribute values")}
label={intl.formatMessage({
defaultMessage: "Attribute values"
})}
helperText={
formErrors.values ||
formErrors.addValues ||
@ -83,10 +90,10 @@ const ProductTypeAttributeEditDialog: React.StatelessComponent<
</DialogContent>
<DialogActions>
<Button onClick={onClose}>
{i18n.t("Cancel", { context: "button" })}
<FormattedMessage {...buttonMessages.cancel} />
</Button>
<Button color="primary" variant="contained" type="submit">
{i18n.t("Save", { context: "button" })}
<FormattedMessage {...buttonMessages.confirm} />
</Button>
</DialogActions>
</>

View file

@ -1,9 +1,9 @@
import DialogContentText from "@material-ui/core/DialogContentText";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import ActionDialog from "@saleor/components/ActionDialog";
import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton";
import i18n from "@saleor/i18n";
export interface ProductTypeAttributeUnassignDialogProps {
attributeName: string;
@ -23,27 +23,32 @@ const ProductTypeAttributeUnassignDialog: React.FC<
productTypeName,
onClose,
onConfirm
}) => (
<ActionDialog
confirmButtonState={confirmButtonState}
open={open}
onClose={onClose}
onConfirm={onConfirm}
title={i18n.t("Unassign attribute from product type")}
>
<DialogContentText
dangerouslySetInnerHTML={{
__html: i18n.t(
"Are you sure you want to unassign <strong>{{ attributeName }}</strong> from <strong>{{ productTypeName }}</strong>?",
{
attributeName,
productTypeName
}
)
}}
/>
</ActionDialog>
);
}) => {
const intl = useIntl();
return (
<ActionDialog
confirmButtonState={confirmButtonState}
open={open}
onClose={onClose}
onConfirm={onConfirm}
title={intl.formatMessage({
defaultMessage: "Unassign Attribute From Product Type",
description: "dialog header"
})}
>
<DialogContentText>
<FormattedMessage
defaultMessage="Are you sure you want to unassign {attributeName} from {productTypeName}?"
values={{
attributeName: <strong>{attributeName}</strong>,
productTypeName: <strong>{productTypeName}</strong>
}}
/>
</DialogContentText>
</ActionDialog>
);
};
ProductTypeAttributeUnassignDialog.displayName =
"ProductTypeAttributeUnassignDialog";
export default ProductTypeAttributeUnassignDialog;

View file

@ -12,6 +12,7 @@ import TableCell from "@material-ui/core/TableCell";
import TableRow from "@material-ui/core/TableRow";
import DeleteIcon from "@material-ui/icons/Delete";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import CardTitle from "@saleor/components/CardTitle";
import Checkbox from "@saleor/components/Checkbox";
@ -21,7 +22,6 @@ import {
SortableTableRow
} from "@saleor/components/SortableTable";
import TableHead from "@saleor/components/TableHead";
import i18n from "@saleor/i18n";
import { maybe, renderCollection, stopPropagation } from "@saleor/misc";
import { ListActions, ReorderAction } from "@saleor/types";
import { AttributeTypeEnum } from "@saleor/types/globalTypes";
@ -81,105 +81,123 @@ const ProductTypeAttributes = withStyles(styles, {
onAttributeClick,
onAttributeReorder,
onAttributeUnassign
}: ProductTypeAttributesProps & WithStyles<typeof styles>) => (
<Card>
<CardTitle
title={
type === AttributeTypeEnum.PRODUCT
? i18n.t("Product Attributes")
: i18n.t("Variant Attributes")
}
toolbar={
<Button
color="primary"
variant="text"
onClick={() => onAttributeAssign(AttributeTypeEnum[type])}
>
{i18n.t("Assign attribute", { context: "button" })}
</Button>
}
/>
<Table>
<TableHead
colSpan={numberOfColumns}
disabled={disabled}
dragRows
selected={selected}
items={attributes}
toggleAll={toggleAll}
toolbar={toolbar}
>
<TableCell className={classes.colName}>
{i18n.t("Attribute name")}
</TableCell>
<TableCell className={classes.colName}>{i18n.t("Slug")}</TableCell>
<TableCell />
</TableHead>
<SortableTableBody onSortEnd={onAttributeReorder}>
{renderCollection(
attributes,
(attribute, attributeIndex) => {
const isSelected = attribute ? isChecked(attribute.id) : false;
}: ProductTypeAttributesProps & WithStyles<typeof styles>) => {
const intl = useIntl();
return (
<SortableTableRow
selected={isSelected}
className={!!attribute ? classes.link : undefined}
hover={!!attribute}
onClick={
!!attribute
? () => onAttributeClick(attribute.id)
: undefined
}
key={maybe(() => attribute.id)}
index={attributeIndex || 0}
>
<TableCell padding="checkbox">
<Checkbox
checked={isSelected}
disabled={disabled}
disableClickPropagation
onChange={() => toggle(attribute.id)}
/>
</TableCell>
<TableCell className={classes.colName}>
{maybe(() => attribute.name) ? (
attribute.name
) : (
<Skeleton />
)}
</TableCell>
<TableCell className={classes.colSlug}>
{maybe(() => attribute.slug) ? (
attribute.slug
) : (
<Skeleton />
)}
</TableCell>
<TableCell className={classes.iconCell}>
<IconButton
onClick={stopPropagation(() =>
onAttributeUnassign(attribute.id)
return (
<Card>
<CardTitle
title={
type === AttributeTypeEnum.PRODUCT
? intl.formatMessage({
defaultMessage: "Product Attributes",
description: "section header"
})
: intl.formatMessage({
defaultMessage: "Variant Attributes",
description: "section header"
})
}
toolbar={
<Button
color="primary"
variant="text"
onClick={() => onAttributeAssign(AttributeTypeEnum[type])}
>
<FormattedMessage
defaultMessage="Assign attribute"
description="button"
/>
</Button>
}
/>
<Table>
<TableHead
colSpan={numberOfColumns}
disabled={disabled}
dragRows
selected={selected}
items={attributes}
toggleAll={toggleAll}
toolbar={toolbar}
>
<TableCell className={classes.colName}>
<FormattedMessage defaultMessage="Attribute name" />
</TableCell>
<TableCell className={classes.colName}>
<FormattedMessage
defaultMessage="Slug"
description="attribute internal name"
/>
</TableCell>
<TableCell />
</TableHead>
<SortableTableBody onSortEnd={onAttributeReorder}>
{renderCollection(
attributes,
(attribute, attributeIndex) => {
const isSelected = attribute ? isChecked(attribute.id) : false;
return (
<SortableTableRow
selected={isSelected}
className={!!attribute ? classes.link : undefined}
hover={!!attribute}
onClick={
!!attribute
? () => onAttributeClick(attribute.id)
: undefined
}
key={maybe(() => attribute.id)}
index={attributeIndex || 0}
>
<TableCell padding="checkbox">
<Checkbox
checked={isSelected}
disabled={disabled}
disableClickPropagation
onChange={() => toggle(attribute.id)}
/>
</TableCell>
<TableCell className={classes.colName}>
{maybe(() => attribute.name) ? (
attribute.name
) : (
<Skeleton />
)}
>
<DeleteIcon color="primary" />
</IconButton>
</TableCell>
<TableCell className={classes.colSlug}>
{maybe(() => attribute.slug) ? (
attribute.slug
) : (
<Skeleton />
)}
</TableCell>
<TableCell className={classes.iconCell}>
<IconButton
onClick={stopPropagation(() =>
onAttributeUnassign(attribute.id)
)}
>
<DeleteIcon color="primary" />
</IconButton>
</TableCell>
</SortableTableRow>
);
},
() => (
<TableRow>
<TableCell colSpan={numberOfColumns}>
<FormattedMessage defaultMessage="No attributes found" />
</TableCell>
</SortableTableRow>
);
},
() => (
<TableRow>
<TableCell colSpan={numberOfColumns}>
{i18n.t("No attributes found")}
</TableCell>
</TableRow>
)
)}
</SortableTableBody>
</Table>
</Card>
)
</TableRow>
)
)}
</SortableTableBody>
</Table>
</Card>
);
}
);
ProductTypeAttributes.displayName = "ProductTypeAttributes";
export default ProductTypeAttributes;

View file

@ -1,12 +1,12 @@
import DialogContentText from "@material-ui/core/DialogContentText";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import ActionDialog from "@saleor/components/ActionDialog";
import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton";
import i18n from "@saleor/i18n";
export interface ProductTypeBulkAttributeUnassignDialogProps {
attributeQuantity: string;
attributeQuantity: number;
confirmButtonState: ConfirmButtonTransitionState;
open: boolean;
productTypeName: string;
@ -23,27 +23,37 @@ const ProductTypeBulkAttributeUnassignDialog: React.FC<
productTypeName,
onClose,
onConfirm
}) => (
<ActionDialog
confirmButtonState={confirmButtonState}
open={open}
onClose={onClose}
onConfirm={onConfirm}
title={i18n.t("Unassign attribute from product type")}
>
<DialogContentText
dangerouslySetInnerHTML={{
__html: i18n.t(
"Are you sure you want to unassign <strong>{{ attributeQuantity }}</strong> attributes from <strong>{{ productTypeName }}</strong>?",
{
attributeQuantity,
productTypeName
}
)
}}
/>
</ActionDialog>
);
}) => {
const intl = useIntl();
return (
<ActionDialog
confirmButtonState={confirmButtonState}
open={open}
onClose={onClose}
onConfirm={onConfirm}
title={intl.formatMessage({
defaultMessage: "Unassign Attribute from Product Type",
description: "dialog header"
})}
>
<DialogContentText>
<FormattedMessage
defaultMessage="Are you sure you want to unassign {counter, plural,
one {this attribute}
other {{displayQuantity} attributes}
} from {productTypeName}?"
description="unassign multiple attributes from product type"
values={{
attributeQuantity: <strong>{attributeQuantity}</strong>,
counter: attributeQuantity,
productTypeName: <strong>{productTypeName}</strong>
}}
/>
</DialogContentText>
</ActionDialog>
);
};
ProductTypeBulkAttributeUnassignDialog.displayName =
"ProductTypeBulkAttributeUnassignDialog";
export default ProductTypeBulkAttributeUnassignDialog;

View file

@ -1,4 +1,5 @@
import React from "react";
import { useIntl } from "react-intl";
import AppHeader from "@saleor/components/AppHeader";
import CardSpacer from "@saleor/components/CardSpacer";
@ -10,7 +11,7 @@ import PageHeader from "@saleor/components/PageHeader";
import SaveButtonBar from "@saleor/components/SaveButtonBar";
import { ChangeEvent, FormChange } from "@saleor/hooks/useForm";
import useStateFromProps from "@saleor/hooks/useStateFromProps";
import i18n from "@saleor/i18n";
import { sectionNames } from "@saleor/intl";
import { ProductTypeDetails_taxTypes } from "@saleor/productTypes/types/ProductTypeDetails";
import { UserError } from "@saleor/types";
import { WeightUnitsEnum } from "@saleor/types/globalTypes";
@ -67,6 +68,7 @@ const ProductTypeCreatePage: React.StatelessComponent<
onBack,
onSubmit
}: ProductTypeCreatePageProps) => {
const intl = useIntl();
const [taxTypeDisplayName, setTaxTypeDisplayName] = useStateFromProps("");
return (
@ -78,7 +80,9 @@ const ProductTypeCreatePage: React.StatelessComponent<
>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container>
<AppHeader onBack={onBack}>{i18n.t("Product Types")}</AppHeader>
<AppHeader onBack={onBack}>
{intl.formatMessage(sectionNames.productTypes)}
</AppHeader>
<PageHeader title={pageTitle} />
<Grid>
<div>

View file

@ -1,9 +1,9 @@
import DialogContentText from "@material-ui/core/DialogContentText";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import ActionDialog from "@saleor/components/ActionDialog";
import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton";
import i18n from "@saleor/i18n";
export interface ProductTypeDeleteDialogProps {
confirmButtonState: ConfirmButtonTransitionState;
@ -19,25 +19,31 @@ const ProductTypeDeleteDialog: React.FC<ProductTypeDeleteDialogProps> = ({
name,
onClose,
onConfirm
}) => (
<ActionDialog
confirmButtonState={confirmButtonState}
open={open}
onClose={onClose}
onConfirm={onConfirm}
title={i18n.t("Remove product type")}
>
<DialogContentText
dangerouslySetInnerHTML={{
__html: i18n.t(
"Are you sure you want to remove <strong>{{ name }}</strong>?",
{
name
}
)
}}
/>
</ActionDialog>
);
}) => {
const intl = useIntl();
return (
<ActionDialog
confirmButtonState={confirmButtonState}
open={open}
onClose={onClose}
onConfirm={onConfirm}
title={intl.formatMessage({
defaultMessage: "Delete Product Type",
description: "dialog header"
})}
>
<DialogContentText>
<FormattedMessage
defaultMessage="Are you sure you want to delete {name}?"
description="delete product type"
values={{
name: <strong>{name}</strong>
}}
/>
</DialogContentText>
</ActionDialog>
);
};
ProductTypeDeleteDialog.displayName = "ProductTypeDeleteDialog";
export default ProductTypeDeleteDialog;

View file

@ -3,9 +3,10 @@ import CardContent from "@material-ui/core/CardContent";
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
import React from "react";
import { useIntl } from "react-intl";
import CardTitle from "@saleor/components/CardTitle";
import i18n from "@saleor/i18n";
import { commonMessages } from "@saleor/intl";
import { FormErrors } from "@saleor/types";
const styles = createStyles({
@ -24,23 +25,31 @@ interface ProductTypeDetailsProps extends WithStyles<typeof styles> {
}
const ProductTypeDetails = withStyles(styles, { name: "ProductTypeDetails" })(
({ classes, data, disabled, errors, onChange }: ProductTypeDetailsProps) => (
<Card className={classes.root}>
<CardTitle title={i18n.t("Information")} />
<CardContent>
<TextField
disabled={disabled}
error={!!errors.name}
fullWidth
helperText={errors.name}
label={i18n.t("Product Type Name")}
name="name"
onChange={onChange}
value={data.name}
({ classes, data, disabled, errors, onChange }: ProductTypeDetailsProps) => {
const intl = useIntl();
return (
<Card className={classes.root}>
<CardTitle
title={intl.formatMessage(commonMessages.generalInformations)}
/>
</CardContent>
</Card>
)
<CardContent>
<TextField
disabled={disabled}
error={!!errors.name}
fullWidth
helperText={errors.name}
label={intl.formatMessage({
defaultMessage: "Product Type Name"
})}
name="name"
onChange={onChange}
value={data.name}
/>
</CardContent>
</Card>
);
}
);
ProductTypeDetails.displayName = "ProductTypeDetails";
export default ProductTypeDetails;

View file

@ -1,4 +1,5 @@
import React from "react";
import { useIntl } from "react-intl";
import AppHeader from "@saleor/components/AppHeader";
import CardSpacer from "@saleor/components/CardSpacer";
@ -11,7 +12,7 @@ import PageHeader from "@saleor/components/PageHeader";
import SaveButtonBar from "@saleor/components/SaveButtonBar";
import { ChangeEvent, FormChange } from "@saleor/hooks/useForm";
import useStateFromProps from "@saleor/hooks/useStateFromProps";
import i18n from "@saleor/i18n";
import { sectionNames } from "@saleor/intl";
import { maybe } from "@saleor/misc";
import { ListActions, ReorderEvent, UserError } from "@saleor/types";
import { AttributeTypeEnum, WeightUnitsEnum } from "@saleor/types/globalTypes";
@ -90,6 +91,7 @@ const ProductTypeDetailsPage: React.StatelessComponent<
onDelete,
onSubmit
}) => {
const intl = useIntl();
const [taxTypeDisplayName, setTaxTypeDisplayName] = useStateFromProps(
maybe(() => productType.taxType.description)
);
@ -129,7 +131,9 @@ const ProductTypeDetailsPage: React.StatelessComponent<
>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container>
<AppHeader onBack={onBack}>{i18n.t("Product Types")}</AppHeader>
<AppHeader onBack={onBack}>
{intl.formatMessage(sectionNames.productTypes)}
</AppHeader>
<PageHeader title={pageTitle} />
<Grid>
<div>
@ -171,7 +175,10 @@ const ProductTypeDetailsPage: React.StatelessComponent<
<ControlledCheckbox
checked={data.hasVariants}
disabled={disabled}
label={i18n.t("This product type has variants")}
label={intl.formatMessage({
defaultMessage: "This product type has variants",
description: "switch button"
})}
name="hasVariants"
onChange={change}
/>

View file

@ -12,12 +12,12 @@ import TableFooter from "@material-ui/core/TableFooter";
import TableRow from "@material-ui/core/TableRow";
import Typography from "@material-ui/core/Typography";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import Checkbox from "@saleor/components/Checkbox";
import Skeleton from "@saleor/components/Skeleton";
import TableHead from "@saleor/components/TableHead";
import TablePagination from "@saleor/components/TablePagination";
import i18n from "../../../i18n";
import { maybe, renderCollection } from "../../../misc";
import { ListActions, ListProps } from "../../../types";
import { ProductTypeList_productTypes_edges_node } from "../../types/ProductTypeList";
@ -64,115 +64,144 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
toggle,
toggleAll,
toolbar
}: ProductTypeListProps) => (
<Card>
<Table>
<TableHead
colSpan={numberOfColumns}
selected={selected}
disabled={disabled}
items={productTypes}
toggleAll={toggleAll}
toolbar={toolbar}
>
<TableCell className={classes.colName}>
{i18n.t("Type Name", { context: "table header" })}
</TableCell>
<TableCell className={classes.colType}>
{i18n.t("Type", { context: "table header" })}
</TableCell>
<TableCell className={classes.colTax}>
{i18n.t("Tax", { context: "table header" })}
</TableCell>
</TableHead>
<TableFooter>
<TableRow>
<TablePagination
colSpan={numberOfColumns}
hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}
onNextPage={onNextPage}
hasPreviousPage={
pageInfo && !disabled ? pageInfo.hasPreviousPage : false
}
onPreviousPage={onPreviousPage}
/>
</TableRow>
</TableFooter>
<TableBody>
{renderCollection(
productTypes,
productType => {
const isSelected = productType
? isChecked(productType.id)
: false;
return (
<TableRow
className={!!productType ? classes.link : undefined}
hover={!!productType}
key={productType ? productType.id : "skeleton"}
onClick={productType ? onRowClick(productType.id) : undefined}
selected={isSelected}
>
<TableCell padding="checkbox">
<Checkbox
checked={isSelected}
disabled={disabled}
disableClickPropagation
onChange={() => toggle(productType.id)}
/>
</TableCell>
<TableCell className={classes.colName}>
{productType ? (
<>
{productType.name}
<Typography variant="caption">
{maybe(() => productType.hasVariants)
? i18n.t("Configurable", {
context: "product type"
})
: i18n.t("Simple product", {
context: "product type"
})}
</Typography>
</>
) : (
<Skeleton />
)}
</TableCell>
<TableCell className={classes.colType}>
{maybe(() => productType.isShippingRequired) !==
undefined ? (
productType.isShippingRequired ? (
<>{i18n.t("Physical", { context: "product type" })}</>
}: ProductTypeListProps) => {
const intl = useIntl();
return (
<Card>
<Table>
<TableHead
colSpan={numberOfColumns}
selected={selected}
disabled={disabled}
items={productTypes}
toggleAll={toggleAll}
toolbar={toolbar}
>
<TableCell className={classes.colName}>
<FormattedMessage
defaultMessage="Type Name"
description="product type name"
/>
</TableCell>
<TableCell className={classes.colType}>
<FormattedMessage
defaultMessage="Type"
description="product type is either simple or configurable"
/>
</TableCell>
<TableCell className={classes.colTax}>
<FormattedMessage
defaultMessage="Tax"
description="tax rate for a product type"
/>
</TableCell>
</TableHead>
<TableFooter>
<TableRow>
<TablePagination
colSpan={numberOfColumns}
hasNextPage={
pageInfo && !disabled ? pageInfo.hasNextPage : false
}
onNextPage={onNextPage}
hasPreviousPage={
pageInfo && !disabled ? pageInfo.hasPreviousPage : false
}
onPreviousPage={onPreviousPage}
/>
</TableRow>
</TableFooter>
<TableBody>
{renderCollection(
productTypes,
productType => {
const isSelected = productType
? isChecked(productType.id)
: false;
return (
<TableRow
className={!!productType ? classes.link : undefined}
hover={!!productType}
key={productType ? productType.id : "skeleton"}
onClick={
productType ? onRowClick(productType.id) : undefined
}
selected={isSelected}
>
<TableCell padding="checkbox">
<Checkbox
checked={isSelected}
disabled={disabled}
disableClickPropagation
onChange={() => toggle(productType.id)}
/>
</TableCell>
<TableCell className={classes.colName}>
{productType ? (
<>
{productType.name}
<Typography variant="caption">
{maybe(() => productType.hasVariants)
? intl.formatMessage({
defaultMessage: "Configurable",
description: "product type"
})
: intl.formatMessage({
defaultMessage: "Simple product",
description: "product type"
})}
</Typography>
</>
) : (
<>{i18n.t("Digital", { context: "product type" })}</>
)
) : (
<Skeleton />
)}
</TableCell>
<TableCell className={classes.colTax}>
{maybe(() => productType.taxType) ? (
productType.taxType.description
) : (
<Skeleton />
)}
<Skeleton />
)}
</TableCell>
<TableCell className={classes.colType}>
{maybe(() => productType.isShippingRequired) !==
undefined ? (
productType.isShippingRequired ? (
<>
<FormattedMessage
defaultMessage="Physical"
description="product type"
/>
</>
) : (
<>
<FormattedMessage
defaultMessage="Digital"
description="product type"
/>
</>
)
) : (
<Skeleton />
)}
</TableCell>
<TableCell className={classes.colTax}>
{maybe(() => productType.taxType) ? (
productType.taxType.description
) : (
<Skeleton />
)}
</TableCell>
</TableRow>
);
},
() => (
<TableRow>
<TableCell colSpan={numberOfColumns}>
<FormattedMessage defaultMessage="No product types found" />
</TableCell>
</TableRow>
);
},
() => (
<TableRow>
<TableCell colSpan={numberOfColumns}>
{i18n.t("No product types found")}
</TableCell>
</TableRow>
)
)}
</TableBody>
</Table>
</Card>
)
)
)}
</TableBody>
</Table>
</Card>
);
}
);
ProductTypeList.displayName = "ProductTypeList";
export default ProductTypeList;

View file

@ -1,11 +1,12 @@
import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import AppHeader from "@saleor/components/AppHeader";
import Container from "@saleor/components/Container";
import PageHeader from "@saleor/components/PageHeader";
import i18n from "../../../i18n";
import { sectionNames } from "@saleor/intl";
import { ListActions, PageListProps } from "../../../types";
import { ProductTypeList_productTypes_edges_node } from "../../types/ProductTypeList";
import ProductTypeList from "../ProductTypeList";
@ -17,21 +18,31 @@ interface ProductTypeListPageProps extends PageListProps, ListActions {
const ProductTypeListPage: React.StatelessComponent<
ProductTypeListPageProps
> = ({ disabled, onAdd, onBack, ...listProps }) => (
<Container>
<AppHeader onBack={onBack}>{i18n.t("Configuration")}</AppHeader>
<PageHeader title={i18n.t("Product types")}>
<Button
color="primary"
variant="contained"
disabled={disabled}
onClick={onAdd}
>
{i18n.t("Add product type")} <AddIcon />
</Button>
</PageHeader>
<ProductTypeList disabled={disabled} {...listProps} />
</Container>
);
> = ({ disabled, onAdd, onBack, ...listProps }) => {
const intl = useIntl();
return (
<Container>
<AppHeader onBack={onBack}>
{intl.formatMessage(sectionNames.configuration)}
</AppHeader>
<PageHeader title={intl.formatMessage(sectionNames.productTypes)}>
<Button
color="primary"
variant="contained"
disabled={disabled}
onClick={onAdd}
>
<FormattedMessage
defaultMessage="Add product type"
description="button"
/>{" "}
<AddIcon />
</Button>
</PageHeader>
<ProductTypeList disabled={disabled} {...listProps} />
</Container>
);
};
ProductTypeListPage.displayName = "ProductTypeListPage";
export default ProductTypeListPage;

View file

@ -2,10 +2,10 @@ import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import TextField from "@material-ui/core/TextField";
import React from "react";
import { useIntl } from "react-intl";
import CardTitle from "@saleor/components/CardTitle";
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
import i18n from "../../../i18n";
import { WeightUnitsEnum } from "../../../types/globalTypes";
interface ProductTypeShippingProps {
@ -20,34 +20,49 @@ interface ProductTypeShippingProps {
const ProductTypeShipping: React.StatelessComponent<
ProductTypeShippingProps
> = ({ data, defaultWeightUnit, disabled, onChange }) => (
<Card>
<CardTitle title={i18n.t("Shipping")} />
<CardContent>
<ControlledCheckbox
checked={data.isShippingRequired}
disabled={disabled}
label={i18n.t("Is this product shippable?")}
name="isShippingRequired"
onChange={onChange}
> = ({ data, defaultWeightUnit, disabled, onChange }) => {
const intl = useIntl();
return (
<Card>
<CardTitle
title={intl.formatMessage({
defaultMessage: "Shipping",
description: "product type shipping settings, section header"
})}
/>
{data.isShippingRequired && (
<TextField
<CardContent>
<ControlledCheckbox
checked={data.isShippingRequired}
disabled={disabled}
InputProps={{ endAdornment: defaultWeightUnit }}
label={i18n.t("Weight")}
name="weight"
helperText={i18n.t(
"Used to calculate rates for shipping for products of this product type, when specific weight is not given"
)}
type="number"
value={data.weight}
label={intl.formatMessage({
defaultMessage: "Is this product shippable?",
description: "switch button"
})}
name="isShippingRequired"
onChange={onChange}
/>
)}
</CardContent>
</Card>
);
{data.isShippingRequired && (
<TextField
disabled={disabled}
InputProps={{ endAdornment: defaultWeightUnit }}
label={intl.formatMessage({
defaultMessage: "Weight"
})}
name="weight"
helperText={intl.formatMessage({
defaultMessage:
"Used to calculate rates for shipping for products of this product type, when specific weight is not given"
})}
type="number"
value={data.weight}
onChange={onChange}
/>
)}
</CardContent>
</Card>
);
};
ProductTypeShipping.displayName = "ProductTypeShipping";
export default ProductTypeShipping;

View file

@ -2,11 +2,11 @@ import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
import React from "react";
import { useIntl } from "react-intl";
import CardTitle from "@saleor/components/CardTitle";
import SingleAutocompleteSelectField from "@saleor/components/SingleAutocompleteSelectField";
import { ProductTypeDetails_taxTypes } from "@saleor/productTypes/types/ProductTypeDetails";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
import { ProductTypeForm } from "../ProductTypeDetailsPage/ProductTypeDetailsPage";
@ -34,29 +34,42 @@ const ProductTypeTaxes = withStyles(styles, { name: "ProductTypeTaxes" })(
taxTypes,
taxTypeDisplayName,
onChange
}: ProductTypeTaxesProps) => (
<Card className={classes.root}>
<CardTitle title={i18n.t("Taxes")} />
<CardContent>
<SingleAutocompleteSelectField
disabled={disabled}
displayValue={taxTypeDisplayName}
label={i18n.t("Taxes")}
name={"taxType" as keyof ProductTypeForm}
onChange={onChange}
value={data.taxType}
choices={maybe(
() =>
taxTypes.map(c => ({ label: c.description, value: c.taxCode })),
[]
)}
InputProps={{
autoComplete: "off"
}}
}: ProductTypeTaxesProps) => {
const intl = useIntl();
return (
<Card className={classes.root}>
<CardTitle
title={intl.formatMessage({
defaultMessage: "Taxes",
description: "section header",
id: "productTypeTaxesHeader"
})}
/>
</CardContent>
</Card>
)
<CardContent>
<SingleAutocompleteSelectField
disabled={disabled}
displayValue={taxTypeDisplayName}
label={intl.formatMessage({
defaultMessage: "Taxes",
id: "productTypeTaxesInputLabel"
})}
name={"taxType" as keyof ProductTypeForm}
onChange={onChange}
value={data.taxType}
choices={maybe(
() =>
taxTypes.map(c => ({ label: c.description, value: c.taxCode })),
[]
)}
InputProps={{
autoComplete: "off"
}}
/>
</CardContent>
</Card>
);
}
);
ProductTypeTaxes.displayName = "ProductTypeTaxes";
export default ProductTypeTaxes;

View file

@ -1,9 +1,10 @@
import { parse as parseQs } from "qs";
import React from "react";
import { useIntl } from "react-intl";
import { Route, RouteComponentProps, Switch } from "react-router-dom";
import { sectionNames } from "@saleor/intl";
import { WindowTitle } from "../components/WindowTitle";
import i18n from "../i18n";
import {
productTypeAddPath,
productTypeListPath,
@ -40,17 +41,19 @@ const ProductTypeUpdate: React.StatelessComponent<
);
};
export const ProductTypeRouter: React.StatelessComponent<
RouteComponentProps<any>
> = () => (
<>
<WindowTitle title={i18n.t("Product types")} />
<Switch>
<Route exact path={productTypeListPath} component={ProductTypeList} />
<Route exact path={productTypeAddPath} component={ProductTypeCreate} />
<Route path={productTypePath(":id")} component={ProductTypeUpdate} />
</Switch>
</>
);
export const ProductTypeRouter: React.FC = () => {
const intl = useIntl();
return (
<>
<WindowTitle title={intl.formatMessage(sectionNames.productTypes)} />
<Switch>
<Route exact path={productTypeListPath} component={ProductTypeList} />
<Route exact path={productTypeAddPath} component={ProductTypeCreate} />
<Route path={productTypePath(":id")} component={ProductTypeUpdate} />
</Switch>
</>
);
};
ProductTypeRouter.displayName = "ProductTypeRouter";
export default ProductTypeRouter;

View file

@ -1,9 +1,9 @@
import React from "react";
import { useIntl } from "react-intl";
import { WindowTitle } from "@saleor/components/WindowTitle";
import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier";
import i18n from "../../i18n";
import { getMutationState, maybe } from "../../misc";
import ProductTypeCreatePage, {
ProductTypeForm
@ -16,11 +16,14 @@ import { productTypeListUrl, productTypeUrl } from "../urls";
export const ProductTypeCreate: React.StatelessComponent = () => {
const navigate = useNavigator();
const notify = useNotifier();
const intl = useIntl();
const handleCreateSuccess = (updateData: ProductTypeCreateMutation) => {
if (updateData.productTypeCreate.errors.length === 0) {
notify({
text: i18n.t("Successfully created product type")
text: intl.formatMessage({
defaultMessage: "Successfully created product type"
})
});
navigate(productTypeUrl(updateData.productTypeCreate.productType.id));
}
@ -48,7 +51,13 @@ export const ProductTypeCreate: React.StatelessComponent = () => {
<TypedProductTypeCreateDataQuery displayLoader>
{({ data, loading }) => (
<>
<WindowTitle title={i18n.t("Create product type")} />
<WindowTitle
title={intl.formatMessage({
defaultMessage: "Create Product Type",
description: "window title",
id: "productTypeCreateHeader"
})}
/>
<ProductTypeCreatePage
defaultWeightUnit={maybe(() => data.shop.defaultWeightUnit)}
disabled={loading}
@ -57,8 +66,10 @@ export const ProductTypeCreate: React.StatelessComponent = () => {
? createProductTypeData.productTypeCreate.errors
: undefined
}
pageTitle={i18n.t("Create Product Type", {
context: "page title"
pageTitle={intl.formatMessage({
defaultMessage: "Create Product Type",
description: "header",
id: "productTypeCreatePageHeader"
})}
saveButtonBarState={formTransitionState}
taxTypes={maybe(() => data.taxTypes, [])}

View file

@ -2,6 +2,7 @@ import DialogContentText from "@material-ui/core/DialogContentText";
import IconButton from "@material-ui/core/IconButton";
import DeleteIcon from "@material-ui/icons/Delete";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import ActionDialog from "@saleor/components/ActionDialog";
import useBulkActions from "@saleor/hooks/useBulkActions";
@ -10,9 +11,9 @@ import useNotifier from "@saleor/hooks/useNotifier";
import usePaginator, {
createPaginationState
} from "@saleor/hooks/usePaginator";
import { commonMessages } from "@saleor/intl";
import { PAGINATE_BY } from "../../config";
import { configurationMenuUrl } from "../../configuration";
import i18n from "../../i18n";
import { getMutationState, maybe } from "../../misc";
import ProductTypeListPage from "../components/ProductTypeListPage";
import { TypedProductTypeBulkDeleteMutation } from "../mutations";
@ -38,6 +39,7 @@ export const ProductTypeList: React.StatelessComponent<
const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
const intl = useIntl();
const closeModal = () => navigate(productTypeListUrl(), true);
@ -54,7 +56,7 @@ export const ProductTypeList: React.StatelessComponent<
const handleProductTypeBulkDelete = (data: ProductTypeBulkDelete) => {
if (data.productTypeBulkDelete.errors.length === 0) {
notify({
text: i18n.t("Removed product types")
text: intl.formatMessage(commonMessages.savedChanges)
});
reset();
refetch();
@ -126,22 +128,27 @@ export const ProductTypeList: React.StatelessComponent<
onClose={closeModal}
onConfirm={onProductTypeBulkDelete}
open={params.action === "remove"}
title={i18n.t("Remove Product Types")}
title={intl.formatMessage({
defaultMessage: "Delete Product Types",
description: "dialog header"
})}
variant="delete"
>
<DialogContentText
dangerouslySetInnerHTML={{
__html: i18n.t(
"Are you sure you want to remove <strong>{{ number }}</strong> product types?",
{
number: maybe(
() => params.ids.length.toString(),
"..."
)
}
)
}}
/>
<DialogContentText>
<FormattedMessage
defaultMessage="Are you sure you want to delete {counter, plural,
one {this product type}
other {{displayQuantity} product types}
}?"
description="dialog content"
values={{
counter: maybe(() => params.ids.length),
displayQuantity: (
<strong>{maybe(() => params.ids.length)}</strong>
)
}}
/>
</DialogContentText>
</ActionDialog>
</>
);

View file

@ -1,12 +1,13 @@
import Button from "@material-ui/core/Button";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { attributeUrl } from "@saleor/attributes/urls";
import { WindowTitle } from "@saleor/components/WindowTitle";
import useBulkActions from "@saleor/hooks/useBulkActions";
import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier";
import i18n from "@saleor/i18n";
import { commonMessages } from "@saleor/intl";
import { getMutationState, maybe } from "@saleor/misc";
import AssignAttributeDialog from "@saleor/productTypes/components/AssignAttributeDialog";
import { ReorderEvent } from "@saleor/types";
@ -44,6 +45,7 @@ export const ProductTypeUpdate: React.FC<ProductTypeUpdateProps> = ({
const notify = useNotifier();
const productAttributeListActions = useBulkActions();
const variantAttributeListActions = useBulkActions();
const intl = useIntl();
return (
<ProductTypeUpdateErrors>
@ -59,9 +61,7 @@ export const ProductTypeUpdate: React.FC<ProductTypeUpdateProps> = ({
const handleAttributeAssignSuccess = (data: AssignAttribute) => {
if (data.attributeAssign.errors.length === 0) {
notify({
text: i18n.t("Attributes assigned", {
context: "notification"
})
text: intl.formatMessage(commonMessages.savedChanges)
});
closeModal();
} else if (
@ -76,9 +76,7 @@ export const ProductTypeUpdate: React.FC<ProductTypeUpdateProps> = ({
) => {
if (data.attributeUnassign.errors.length === 0) {
notify({
text: i18n.t("Attribute unassigned", {
context: "notification"
})
text: intl.formatMessage(commonMessages.savedChanges)
});
closeModal();
productAttributeListActions.reset();
@ -90,8 +88,8 @@ export const ProductTypeUpdate: React.FC<ProductTypeUpdateProps> = ({
) => {
if (deleteData.productTypeDelete.errors.length === 0) {
notify({
text: i18n.t("Product type deleted", {
context: "notification"
text: intl.formatMessage({
defaultMessage: "Product type deleted"
})
});
navigate(productTypeListUrl(), true);
@ -105,9 +103,7 @@ export const ProductTypeUpdate: React.FC<ProductTypeUpdateProps> = ({
updateData.productTypeUpdate.errors.length === 0
) {
notify({
text: i18n.t("Product type updated", {
context: "notification"
})
text: intl.formatMessage(commonMessages.savedChanges)
});
} else if (
updateData.productTypeUpdate.errors !== null &&
@ -290,9 +286,10 @@ export const ProductTypeUpdate: React.FC<ProductTypeUpdateProps> = ({
)
}
>
{i18n.t("Unassign", {
context: "unassign attribute from product type"
})}
<FormattedMessage
defaultMessage="Unassign"
description="unassign attribute from product type, button"
/>
</Button>
)
}}
@ -315,9 +312,10 @@ export const ProductTypeUpdate: React.FC<ProductTypeUpdateProps> = ({
)
}
>
{i18n.t("Unassign", {
context: "unassign attribute from product type"
})}
<FormattedMessage
defaultMessage="Unassign"
description="unassign attribute from product type, button"
/>
</Button>
)
}}
@ -433,10 +431,7 @@ export const ProductTypeUpdate: React.FC<ProductTypeUpdateProps> = ({
onConfirm={handleProductTypeDelete}
/>
<ProductTypeBulkAttributeUnassignDialog
attributeQuantity={maybe(
() => params.ids.length.toString(),
"..."
)}
attributeQuantity={maybe(() => params.ids.length)}
confirmButtonState={unassignTransactionState}
onClose={closeModal}
onConfirm={handleBulkAttributeUnassign}

View file

@ -7,7 +7,7 @@ import ProductTypeBulkAttributeUnassignDialog, {
import Decorator from "../../Decorator";
const props: ProductTypeBulkAttributeUnassignDialogProps = {
attributeQuantity: "4",
attributeQuantity: 4,
confirmButtonState: "default",
onClose: () => undefined,
onConfirm: () => undefined,