Refactor collection section translations (#108)
* Refactor translations in collections section * Update pot file * Improve descriptions * Do not share 'published' message
This commit is contained in:
parent
a909276df3
commit
2073f6ad21
13 changed files with 1173 additions and 690 deletions
|
@ -1,6 +1,6 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"POT-Creation-Date: 2019-08-16T19:32:53.076Z\n"
|
||||
"POT-Creation-Date: 2019-08-20T12:12:53.399Z\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -39,6 +39,22 @@ msgctxt "button"
|
|||
msgid "Add category"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionCreatePage/CollectionCreatePage.json
|
||||
#. [collectionCreatePageHeader] - page header
|
||||
#. defaultMessage is:
|
||||
#. Add collection
|
||||
msgctxt "page header"
|
||||
msgid "Add collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionListPage/CollectionListPage.json
|
||||
#. [collectionListPageAddCollectionButton] - button
|
||||
#. defaultMessage is:
|
||||
#. Add collection
|
||||
msgctxt "button"
|
||||
msgid "Add collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryProducts/CategoryProducts.json
|
||||
#. [categoryProductsAddProductButton] - button
|
||||
#. defaultMessage is:
|
||||
|
@ -63,6 +79,18 @@ msgctxt "description"
|
|||
msgid "Add search engine title and description to make this category easier to find"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionCreatePage/CollectionCreatePage.json
|
||||
#. [collectionSeo]
|
||||
#. defaultMessage is:
|
||||
#. Add search engine title and description to make this collection easier to find
|
||||
#: build/locale/src/collections/components/CollectionDetailsPage/CollectionDetailsPage.json
|
||||
#. [collectionSeo]
|
||||
#. defaultMessage is:
|
||||
#. Add search engine title and description to make this collection easier to find
|
||||
msgctxt "description"
|
||||
msgid "Add search engine title and description to make this collection easier to find"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryList/CategoryList.json
|
||||
#. [categoryListAddSubcategoryButton] - button
|
||||
#. defaultMessage is:
|
||||
|
@ -87,6 +115,14 @@ msgctxt "added new attribute value"
|
|||
msgid "Added new value"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsAddedProduct]
|
||||
#. defaultMessage is:
|
||||
#. Added product to collection
|
||||
msgctxt "description"
|
||||
msgid "Added product to collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeValues/AttributeValues.json
|
||||
#. [attributeValuesSlugColumnHeader] - attribute values list: slug column header
|
||||
#. defaultMessage is:
|
||||
|
@ -104,86 +140,142 @@ msgid "All Subcategories"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeValueDeleteDialog/AttributeValueDeleteDialog.json
|
||||
#. [attributeValueDeleteDialogContentWithoutAttributeName] - remove attribute value
|
||||
#. [attributeValueDeleteDialogContentWithoutAttributeName] - delete attribute value
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove "{name}" value?
|
||||
msgctxt "remove attribute value"
|
||||
msgid "Are you sure you want to remove \"{name}\" value?"
|
||||
#. Are you sure you want to delete "{name}" value?
|
||||
msgctxt "delete attribute value"
|
||||
msgid "Are you sure you want to delete \"{name}\" value?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeValueDeleteDialog/AttributeValueDeleteDialog.json
|
||||
#. [attributeValueDeleteDialogContentWithAttributeName]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove "{name}" value? If you remove it you won’t be able to assign it to any of the products with "{attributeName}" attribute.
|
||||
#. Are you sure you want to delete "{name}" value? If you delete it you won’t be able to assign it to any of the products with "{attributeName}" attribute.
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to remove \"{name}\" value? If you remove it you won’t be able to assign it to any of the products with \"{attributeName}\" attribute."
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeBulkDeleteDialog/AttributeBulkDeleteDialog.json
|
||||
#. [attributeBulkDeleteDialogContent] - dialog content
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {counter,plural,one{this attribute} other{{displayQuantity} attributes}}?
|
||||
msgctxt "dialog content"
|
||||
msgid "Are you sure you want to remove {counter,plural,one{this attribute} other{{displayQuantity} attributes}}?"
|
||||
msgid "Are you sure you want to delete \"{name}\" value? If you delete it you won’t be able to assign it to any of the products with \"{attributeName}\" attribute."
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeDeleteDialog/AttributeDeleteDialog.json
|
||||
#. [attributeDeleteDialogContent] - dialog content
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {name}?
|
||||
#. Are you sure you want to delete {attributeName}?
|
||||
msgctxt "dialog content"
|
||||
msgid "Are you sure you want to remove {name}?"
|
||||
msgid "Are you sure you want to delete {attributeName}?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryDeleteDialog/CategoryDeleteDialog.json
|
||||
#. [<categoryDeleteDialogContent<] - delete category
|
||||
#. [categoryDeleteDialogContent] - delete category
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {name}?
|
||||
#. Are you sure you want to delete {categoryName}?
|
||||
msgctxt "delete category"
|
||||
msgid "Are you sure you want to remove {name}?"
|
||||
msgid "Are you sure you want to delete {categoryName}?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteCategoryDialogContent] - remove category
|
||||
#. [categoryDetailsDeleteCategoryDialogContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {name}?
|
||||
msgctxt "remove category"
|
||||
msgid "Are you sure you want to remove {name}?"
|
||||
#. Are you sure you want to delete {categoryName}?
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to delete {categoryName}?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeBulkDeleteDialog/AttributeBulkDeleteDialog.json
|
||||
#. [attributeBulkDeleteDialogContent] - dialog content
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to delete {counter,plural,one{this attribute} other{{displayQuantity} attributes}}?
|
||||
msgctxt "dialog content"
|
||||
msgid "Are you sure you want to delete {counter,plural,one{this attribute} other{{displayQuantity} attributes}}?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteCategoriesDialogContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {number} categories?
|
||||
#. Are you sure you want to delete {counter,plural,one{this attribute} other{{displayQuantity} categories}}?
|
||||
#: build/locale/src/categories/views/CategoryList.json
|
||||
#. [categoryListDeleteCategoriesDialogContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {number} categories?
|
||||
#. Are you sure you want to delete {counter,plural,one{this attribute} other{{displayQuantity} categories}}?
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to remove {number} categories?"
|
||||
msgid "Are you sure you want to delete {counter,plural,one{this attribute} other{{displayQuantity} categories}}?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteProductsDialogContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {number} products?
|
||||
#. Are you sure you want to delete {counter,plural,one{this attribute} other{{displayQuantity} products}}?
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to remove {number} products?"
|
||||
msgid "Are you sure you want to delete {counter,plural,one{this attribute} other{{displayQuantity} products}}?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListPublishCollectionsDialogContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to publish {number} collections?
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to publish {number} collections?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsRemoveImageContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove collection's image?
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to remove collection's image?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsRemoveCollectionDialogContent] - remove image
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {name}?
|
||||
msgctxt "remove image"
|
||||
msgid "Are you sure you want to remove {name}?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListRemoveCollectionsDialogContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to remove {number} collections?
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to remove {number} collections?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsUnassignProductsDialogContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to unassign {number} products?
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to unassign {number} products?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListUnpublishCollectionsDialogContent]
|
||||
#. defaultMessage is:
|
||||
#. Are you sure you want to unpublish {number} collections?
|
||||
msgctxt "description"
|
||||
msgid "Are you sure you want to unpublish {number} collections?"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionProducts/CollectionProducts.json
|
||||
#. [collectionProductsAssignProductButton] - button
|
||||
#. defaultMessage is:
|
||||
#. Assign product
|
||||
msgctxt "button"
|
||||
msgid "Assign product"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeDetails/AttributeDetails.json
|
||||
#. [attributeDetailsSlugInputLabel] - attribute slug input field
|
||||
#. [attributeDetailsSlugInputLabel] - attribute's slug short code label
|
||||
#. defaultMessage is:
|
||||
#. Attribute Code
|
||||
msgctxt "attribute slug input field"
|
||||
msgctxt "attribute's slug short code label"
|
||||
msgid "Attribute Code"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeList/AttributeList.json
|
||||
#. [attributeListSlugColumnHeader] - attribute list: slug column header
|
||||
#. [attributeListSlugColumnHeader]
|
||||
#. defaultMessage is:
|
||||
#. Attribute Code
|
||||
msgctxt "attribute list: slug column header"
|
||||
msgctxt "description"
|
||||
msgid "Attribute Code"
|
||||
msgstr ""
|
||||
|
||||
|
@ -198,9 +290,9 @@ msgstr ""
|
|||
#: build/locale/src/attributes/views/AttributeDetails/AttributeDetails.json
|
||||
#. [attributeDetailsAttributeRemoveSuccess]
|
||||
#. defaultMessage is:
|
||||
#. Attribute removed
|
||||
#. Attribute deleted
|
||||
msgctxt "description"
|
||||
msgid "Attribute removed"
|
||||
msgid "Attribute deleted"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
|
@ -212,17 +304,37 @@ msgid "Attributes"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/views/AttributeList/AttributeList.json
|
||||
#. [attributeListAttributesRemoved] - remove multiple attributes
|
||||
#. [attributeListAttributesDeleted] - deleted multiple attributes
|
||||
#. defaultMessage is:
|
||||
#. Attributes successfully removed
|
||||
msgctxt "remove multiple attributes"
|
||||
msgid "Attributes successfully removed"
|
||||
#. Attributes successfully delete
|
||||
msgctxt "deleted multiple attributes"
|
||||
msgid "Attributes successfully delete"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionList/CollectionList.json
|
||||
#. [collectionListAvailabilityColumnHeader] - collection list: availability column header
|
||||
#. defaultMessage is:
|
||||
#. Availability
|
||||
msgctxt "collection list: availability column header"
|
||||
msgid "Availability"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [availability]
|
||||
#. defaultMessage is:
|
||||
#. Availability
|
||||
msgctxt "description"
|
||||
msgid "Availability"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryBackground/CategoryBackground.json
|
||||
#. [categoryBackgroundHeader] - section header
|
||||
#. defaultMessage is:
|
||||
#. Background image (optional)
|
||||
#: build/locale/src/collections/components/CollectionImage/CollectionImage.json
|
||||
#. [collectionImageHeader] - section header
|
||||
#. defaultMessage is:
|
||||
#. Background image (optional)
|
||||
msgctxt "section header"
|
||||
msgid "Background image (optional)"
|
||||
msgstr ""
|
||||
|
@ -236,10 +348,10 @@ msgid "Cancel"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeDetails/AttributeDetails.json
|
||||
#. [attributeDetailsInputTypeField] - attribute editor component type select field label
|
||||
#. [attributeDetailsInputTypeField] - attribute's editor component
|
||||
#. defaultMessage is:
|
||||
#. Catalog Input type for Store Owner
|
||||
msgctxt "attribute editor component type select field label"
|
||||
msgctxt "attribute's editor component"
|
||||
msgid "Catalog Input type for Store Owner"
|
||||
msgstr ""
|
||||
|
||||
|
@ -251,19 +363,31 @@ msgctxt "categories section name"
|
|||
msgid "Categories"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsCategoriesRemoved]
|
||||
#: build/locale/src/categories/components/CategoryDetailsForm/CategoryDetailsForm.json
|
||||
#. [categoryDetailsFormDescriptionInputLabel]
|
||||
#. defaultMessage is:
|
||||
#. Categories removed
|
||||
#. Category Description
|
||||
msgctxt "description"
|
||||
msgid "Categories removed"
|
||||
msgid "Category Description"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryList/CategoryList.json
|
||||
#. [categoryListNameColumnHeader] - category list: name column header
|
||||
#: build/locale/src/categories/components/CategoryDetailsForm/CategoryDetailsForm.json
|
||||
#. [categoryDetailsFormNameInputLabel]
|
||||
#. defaultMessage is:
|
||||
#. Category Name
|
||||
msgctxt "category list: name column header"
|
||||
#: build/locale/src/categories/components/CategoryList/CategoryList.json
|
||||
#. [categoryListNameColumnHeader]
|
||||
#. defaultMessage is:
|
||||
#. Category Name
|
||||
msgctxt "description"
|
||||
msgid "Category Name"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionList/CollectionList.json
|
||||
#. [collectionListNameColumnHeader] - collection list: name column header
|
||||
#. defaultMessage is:
|
||||
#. Category Name
|
||||
msgctxt "collection list: name column header"
|
||||
msgid "Category Name"
|
||||
msgstr ""
|
||||
|
||||
|
@ -283,6 +407,22 @@ msgctxt "description"
|
|||
msgid "Category deleted"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListChangedPublication]
|
||||
#. defaultMessage is:
|
||||
#. Changed publication status
|
||||
msgctxt "description"
|
||||
msgid "Changed publication status"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [collections] - collections section name
|
||||
#. defaultMessage is:
|
||||
#. Collections
|
||||
msgctxt "collections section name"
|
||||
msgid "Collections"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [confirm]
|
||||
#. defaultMessage is:
|
||||
|
@ -315,6 +455,22 @@ msgctxt "window title"
|
|||
msgid "Create category"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionCreate.json
|
||||
#. [collectionCreateWindowTitle] - window title
|
||||
#. defaultMessage is:
|
||||
#. Create collection
|
||||
msgctxt "window title"
|
||||
msgid "Create collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionCreate.json
|
||||
#. [collectionCreateCreatedCollection]
|
||||
#. defaultMessage is:
|
||||
#. Created collection
|
||||
msgctxt "description"
|
||||
msgid "Created collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeProperties/AttributeProperties.json
|
||||
#. [attributePropertiesDashboard] - attribute properties regarding dashboard
|
||||
#. defaultMessage is:
|
||||
|
@ -324,18 +480,18 @@ msgid "Dashboard Properties"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeDetails/AttributeDetails.json
|
||||
#. [attributeDetailsNameInputLabel] - attribute label input field
|
||||
#. [attributeDetailsNameInputLabel] - attribute's label
|
||||
#. defaultMessage is:
|
||||
#. Default Label
|
||||
msgctxt "attribute label input field"
|
||||
msgctxt "attribute's label"
|
||||
msgid "Default Label"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeList/AttributeList.json
|
||||
#. [attributeListNameColumnHeader] - attribute list: name column header
|
||||
#. [attributeListNameColumnHeader] - attribute's label'
|
||||
#. defaultMessage is:
|
||||
#. Default Label
|
||||
msgctxt "attribute list: name column header"
|
||||
msgctxt "attribute's label'"
|
||||
msgid "Default Label"
|
||||
msgstr ""
|
||||
|
||||
|
@ -347,6 +503,42 @@ msgctxt "attribute values list: name column header"
|
|||
msgid "Default Store View"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeDeleteDialog/AttributeDeleteDialog.json
|
||||
#. [attributeDeleteDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Delete attribute
|
||||
msgctxt "dialog title"
|
||||
msgid "Delete attribute"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeValueDeleteDialog/AttributeValueDeleteDialog.json
|
||||
#. [attributeValueDeleteDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Delete attribute value
|
||||
msgctxt "dialog title"
|
||||
msgid "Delete attribute value"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeBulkDeleteDialog/AttributeBulkDeleteDialog.json
|
||||
#. [attributeBulkDeleteDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Delete attributes
|
||||
msgctxt "dialog title"
|
||||
msgid "Delete attributes"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteSubcategoriesDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Delete categories
|
||||
#: build/locale/src/categories/views/CategoryList.json
|
||||
#. [categoryListDeleteSubcategoriesDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Delete categories
|
||||
msgctxt "dialog title"
|
||||
msgid "Delete categories"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryDeleteDialog/CategoryDeleteDialog.json
|
||||
#. [categoryDeleteDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
|
@ -359,6 +551,14 @@ msgctxt "dialog title"
|
|||
msgid "Delete category"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteProductsDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Delete products
|
||||
msgctxt "dialog title"
|
||||
msgid "Delete products"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [description]
|
||||
#. defaultMessage is:
|
||||
|
@ -368,10 +568,10 @@ msgid "Description"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeDetails/AttributeDetails.json
|
||||
#. [attributeDetailsInputTypeDropdown] - attribute editor component type
|
||||
#. [attributeDetailsInputTypeDropdown] - product attribute type
|
||||
#. defaultMessage is:
|
||||
#. Dropdown
|
||||
msgctxt "attribute editor component type"
|
||||
msgctxt "product attribute type"
|
||||
msgid "Dropdown"
|
||||
msgstr ""
|
||||
|
||||
|
@ -383,6 +583,14 @@ msgctxt "edit attribute value"
|
|||
msgid "Edit Value"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionDetailsPage/CollectionDetailsPage.json
|
||||
#. [collectionDetailsPageFeatureInputLabel] - switch button
|
||||
#. defaultMessage is:
|
||||
#. Feature on Homepage
|
||||
msgctxt "switch button"
|
||||
msgid "Feature on Homepage"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [generalInformations]
|
||||
#. defaultMessage is:
|
||||
|
@ -400,10 +608,10 @@ msgid "If enabled, you’ll be able to use this attribute to filter products in
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeDetails/AttributeDetails.json
|
||||
#. [attributeDetailsInputTypeMultiselect] - attribute editor component type
|
||||
#. [attributeDetailsInputTypeMultiselect] - product attribute type
|
||||
#. defaultMessage is:
|
||||
#. Multiple Select
|
||||
msgctxt "attribute editor component type"
|
||||
msgctxt "product attribute type"
|
||||
msgid "Multiple Select"
|
||||
msgstr ""
|
||||
|
||||
|
@ -415,16 +623,24 @@ msgctxt "attribute name"
|
|||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryDetailsForm/CategoryDetailsForm.json
|
||||
#. [categoryDetailsFormNameInputLabel] - category name
|
||||
#: build/locale/src/categories/components/CategoryProducts/CategoryProducts.json
|
||||
#. [categoryProductsNameHeader] - product name
|
||||
#. defaultMessage is:
|
||||
#. Name
|
||||
msgctxt "category name"
|
||||
msgctxt "product name"
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryProducts/CategoryProducts.json
|
||||
#. [categoryProductsNameHeader] - product list: product name column header
|
||||
#: build/locale/src/collections/components/CollectionDetails/CollectionDetails.json
|
||||
#. [collectionDetailsNameInputLabel] - collection name
|
||||
#. defaultMessage is:
|
||||
#. Name
|
||||
msgctxt "collection name"
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionProducts/CollectionProducts.json
|
||||
#. [collectionProductsNameColumnHeader] - product list: product name column header
|
||||
#. defaultMessage is:
|
||||
#. Name
|
||||
msgctxt "product list: product name column header"
|
||||
|
@ -432,10 +648,10 @@ msgid "Name"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeList/AttributeList.json
|
||||
#. [AttributeListNoAttributes] - no attributes found with present filters
|
||||
#. [AttributeListNoAttributes]
|
||||
#. defaultMessage is:
|
||||
#. No attributes found
|
||||
msgctxt "no attributes found with present filters"
|
||||
msgctxt "description"
|
||||
msgid "No attributes found"
|
||||
msgstr ""
|
||||
|
||||
|
@ -447,10 +663,22 @@ msgctxt "description"
|
|||
msgid "No categories found"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionList/CollectionList.json
|
||||
#. [collectionListNoCollections]
|
||||
#. defaultMessage is:
|
||||
#. No collections found
|
||||
msgctxt "description"
|
||||
msgid "No collections found"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryProducts/CategoryProducts.json
|
||||
#. [categoryProductsNoProducts]
|
||||
#. defaultMessage is:
|
||||
#. No products found
|
||||
#: build/locale/src/collections/components/CollectionProducts/CollectionProducts.json
|
||||
#. [collectionProductsNoProducts]
|
||||
#. defaultMessage is:
|
||||
#. No products found
|
||||
msgctxt "description"
|
||||
msgid "No products found"
|
||||
msgstr ""
|
||||
|
@ -471,14 +699,30 @@ msgctxt "No attribute values found"
|
|||
msgid "No values found"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryList/CategoryList.json
|
||||
#. [categoryListNumberOfProductsColumnHeader] - category list: number of products column header
|
||||
#: build/locale/src/collections/components/CollectionList/CollectionList.json
|
||||
#. [collectionListProductsColumnHeader] - collection list: number of products column header
|
||||
#. defaultMessage is:
|
||||
#. No. Products
|
||||
msgctxt "category list: number of products column header"
|
||||
msgctxt "collection list: number of products column header"
|
||||
msgid "No. Products"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryList/CategoryList.json
|
||||
#. [categoryListNumberOfProductsColumnHeader] - number of products
|
||||
#. defaultMessage is:
|
||||
#. No. of Products
|
||||
msgctxt "number of products"
|
||||
msgid "No. of Products"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [notPublished]
|
||||
#. defaultMessage is:
|
||||
#. Not published
|
||||
msgctxt "description"
|
||||
msgid "Not published"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [optionalField] - field is optional
|
||||
#. defaultMessage is:
|
||||
|
@ -504,27 +748,27 @@ msgid "Products"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryUpdatePage/CategoryUpdatePage.json
|
||||
#. [categoryUpdatePageProductsColumnHeader] - category list: number of products column header
|
||||
#. [categoryUpdatePageProductsColumnHeader] - number of products in category
|
||||
#. defaultMessage is:
|
||||
#. Products
|
||||
msgctxt "category list: number of products column header"
|
||||
msgctxt "number of products in category"
|
||||
msgid "Products"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryProductsCard/CategoryProductsCard.json
|
||||
#. [categoryProductsCardHeader] - products in category section header
|
||||
#. [categoryProductsCardHeader] - section header
|
||||
#. defaultMessage is:
|
||||
#. Products in {name}
|
||||
msgctxt "products in category section header"
|
||||
msgid "Products in {name}"
|
||||
#. Products in {categoryName}
|
||||
msgctxt "section header"
|
||||
msgid "Products in {categoryName}"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsProductsRemoved]
|
||||
#: build/locale/src/collections/components/CollectionProducts/CollectionProducts.json
|
||||
#. [collectionProductsHeader] - products in collection
|
||||
#. defaultMessage is:
|
||||
#. Products removed
|
||||
msgctxt "description"
|
||||
msgid "Products removed"
|
||||
#. Products in {name}
|
||||
msgctxt "products in collection"
|
||||
msgid "Products in {name}"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
|
@ -535,64 +779,100 @@ msgctxt "description"
|
|||
msgid "Properties"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListPublish] - publish collections
|
||||
#. defaultMessage is:
|
||||
#. Publish
|
||||
msgctxt "publish collections"
|
||||
msgid "Publish"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListPublishCollectionsDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Publish collections
|
||||
msgctxt "dialog title"
|
||||
msgid "Publish collections"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionProducts/CollectionProducts.json
|
||||
#. [collectionPublishedColumnHeader] - product list: published column header
|
||||
#. defaultMessage is:
|
||||
#. Published
|
||||
msgctxt "product list: published column header"
|
||||
msgid "Published"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [published]
|
||||
#. defaultMessage is:
|
||||
#. Published
|
||||
msgctxt "description"
|
||||
msgid "Published"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteCategoryDialogContentAdditionalText]
|
||||
#. defaultMessage is:
|
||||
#. Remember that this will also remove all products assigned to this category.
|
||||
#. Remember this will also delete all products assigned to this category.
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteCategoriesDialogContentAdditionalText]
|
||||
#. defaultMessage is:
|
||||
#. Remember that this will also remove all products assigned to this category.
|
||||
#. Remember this will also delete all products assigned to this category.
|
||||
#: build/locale/src/categories/views/CategoryList.json
|
||||
#. [categoryListDeleteCategoriesDialogContentAdditionalText]
|
||||
#. defaultMessage is:
|
||||
#. Remember that this will also remove all products assigned to this category.
|
||||
#. Remember this will also delete all products assigned to this category.
|
||||
msgctxt "description"
|
||||
msgid "Remember that this will also remove all products assigned to this category."
|
||||
msgid "Remember this will also delete all products assigned to this category."
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeDeleteDialog/AttributeDeleteDialog.json
|
||||
#. [attributeDeleteDialogTitle] - dialog title
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsRemoveCollectionDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Remove attribute
|
||||
#. Remove Collection
|
||||
msgctxt "dialog title"
|
||||
msgid "Remove attribute"
|
||||
msgid "Remove Collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeValueDeleteDialog/AttributeValueDeleteDialog.json
|
||||
#. [attributeValueDeleteDialogTitle] - dialog title
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListRemoveCollectionsDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Remove attribute value
|
||||
#. Remove collections
|
||||
msgctxt "dialog title"
|
||||
msgid "Remove attribute value"
|
||||
msgid "Remove collections"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeBulkDeleteDialog/AttributeBulkDeleteDialog.json
|
||||
#. [attributeBulkDeleteDialogTitle] - dialog title
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsRemoveImageTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Remove attributes
|
||||
#. Remove image
|
||||
msgctxt "dialog title"
|
||||
msgid "Remove attributes"
|
||||
msgid "Remove image"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteSubcategoriesDialogTitle] - dialog title
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsRemovedCollection]
|
||||
#. defaultMessage is:
|
||||
#. Remove categories
|
||||
#: build/locale/src/categories/views/CategoryList.json
|
||||
#. [categoryListDeleteSubcategoriesDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Remove categories
|
||||
msgctxt "dialog title"
|
||||
msgid "Remove categories"
|
||||
#. Removed collection
|
||||
msgctxt "description"
|
||||
msgid "Removed collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/views/CategoryDetails.json
|
||||
#. [categoryDetailsDeleteProductsDialogTitle] - dialog title
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListRemovedCollections]
|
||||
#. defaultMessage is:
|
||||
#. Remove products
|
||||
msgctxt "dialog title"
|
||||
msgid "Remove products"
|
||||
#. Removed collections
|
||||
msgctxt "description"
|
||||
msgid "Removed collections"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsRemovedProduct]
|
||||
#. defaultMessage is:
|
||||
#. Removed product from collection
|
||||
msgctxt "description"
|
||||
msgid "Removed product from collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
|
@ -604,10 +884,10 @@ msgid "Saved changes"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeList/AttributeList.json
|
||||
#. [attributeListSearchableColumnHeader] - attribute list: attribute can be searched in dashboard column header
|
||||
#. [attributeListSearchableColumnHeader] - attribute can be searched in dashboard
|
||||
#. defaultMessage is:
|
||||
#. Searchable
|
||||
msgctxt "attribute list: attribute can be searched in dashboard column header"
|
||||
msgctxt "attribute can be searched in dashboard"
|
||||
msgid "Searchable"
|
||||
msgstr ""
|
||||
|
||||
|
@ -620,18 +900,18 @@ msgid "Storefront Properties"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryList/CategoryList.json
|
||||
#. [categoryListSubcategoriesColumnHeader] - category list: subcategories column header
|
||||
#. [categoryListSubcategoriesColumnHeader] - number of subcategories
|
||||
#. defaultMessage is:
|
||||
#. Subcategories
|
||||
msgctxt "category list: subcategories column header"
|
||||
msgctxt "number of subcategories"
|
||||
msgid "Subcategories"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryUpdatePage/CategoryUpdatePage.json
|
||||
#. [categoryUpdatePageSubcategoriesColumnHeader] - category list: number of subcategories column header
|
||||
#. [categoryUpdatePageSubcategoriesColumnHeader] - number of subcategories in category
|
||||
#. defaultMessage is:
|
||||
#. Subcategories
|
||||
msgctxt "category list: number of subcategories column header"
|
||||
msgctxt "number of subcategories in category"
|
||||
msgid "Subcategories"
|
||||
msgstr ""
|
||||
|
||||
|
@ -652,13 +932,61 @@ msgid "This is used internally. Make sure you don’t use spaces"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/categories/components/CategoryProducts/CategoryProducts.json
|
||||
#. [categoryProductsTypeHeader] - product list: product type column header
|
||||
#. [categoryProductsTypeHeader] - product type
|
||||
#. defaultMessage is:
|
||||
#. Type
|
||||
msgctxt "product type"
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/components/CollectionProducts/CollectionProducts.json
|
||||
#. [collectionProductsTypeProductList] - product list: product type column header
|
||||
#. defaultMessage is:
|
||||
#. Type
|
||||
msgctxt "product list: product type column header"
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsUnassignButton] - unassign product from collection button
|
||||
#. defaultMessage is:
|
||||
#. Unassign
|
||||
msgctxt "unassign product from collection button"
|
||||
msgid "Unassign"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsUnassignProductsDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Unassign products from collection
|
||||
msgctxt "dialog title"
|
||||
msgid "Unassign products from collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListUnpublish] - unpublish collections
|
||||
#. defaultMessage is:
|
||||
#. Unpublish
|
||||
msgctxt "unpublish collections"
|
||||
msgid "Unpublish"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionList.json
|
||||
#. [collectionListUnpublishCollectionsDialogTitle] - dialog title
|
||||
#. defaultMessage is:
|
||||
#. Unpublish collections
|
||||
msgctxt "dialog title"
|
||||
msgid "Unpublish collections"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/collections/views/CollectionDetails.json
|
||||
#. [collectionDetailsUpdatedCollection]
|
||||
#. defaultMessage is:
|
||||
#. Updated collection
|
||||
msgctxt "description"
|
||||
msgid "Updated collection"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/intl.json
|
||||
#. [uploadImage] - button
|
||||
#. defaultMessage is:
|
||||
|
@ -684,10 +1012,10 @@ msgid "Use in faceted navigation"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeList/AttributeList.json
|
||||
#. [attributeListFacetedColumnHeader] - attribute list: attribute can be searched in storefront column header
|
||||
#. [attributeListFacetedColumnHeader] - attribute can be searched in storefront
|
||||
#. defaultMessage is:
|
||||
#. Use in faceted search
|
||||
msgctxt "attribute list: attribute can be searched in storefront column header"
|
||||
msgctxt "attribute can be searched in storefront"
|
||||
msgid "Use in faceted search"
|
||||
msgstr ""
|
||||
|
||||
|
@ -700,18 +1028,18 @@ msgid "Value Required"
|
|||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/views/AttributeDetails/AttributeDetails.json
|
||||
#. [attributeDetailsAttributeValueRemoveSuccess] - attribute value removed
|
||||
#. [attributeDetailsAttributeValueDeleteSuccess] - attribute value deleted
|
||||
#. defaultMessage is:
|
||||
#. Value removed
|
||||
msgctxt "attribute value removed"
|
||||
msgid "Value removed"
|
||||
#. Value deleted
|
||||
msgctxt "attribute value deleted"
|
||||
msgid "Value deleted"
|
||||
msgstr ""
|
||||
|
||||
#: build/locale/src/attributes/components/AttributeList/AttributeList.json
|
||||
#. [attributeListVisibilityColumnHeader] - attribute list: visibility column header
|
||||
#. [attributeListVisibilityColumnHeader] - attribute is visible
|
||||
#. defaultMessage is:
|
||||
#. Visible
|
||||
msgctxt "attribute list: visibility column header"
|
||||
msgctxt "attribute is visible"
|
||||
msgid "Visible"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import Card from "@material-ui/core/Card";
|
|||
import CardContent from "@material-ui/core/CardContent";
|
||||
import { ContentState, convertToRaw, RawDraftContentState } from "draft-js";
|
||||
import React from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
import AppHeader from "@saleor/components/AppHeader";
|
||||
import { CardSpacer } from "@saleor/components/CardSpacer";
|
||||
|
@ -14,7 +15,7 @@ import PageHeader from "@saleor/components/PageHeader";
|
|||
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
||||
import SeoForm from "@saleor/components/SeoForm";
|
||||
import VisibilityCard from "@saleor/components/VisibilityCard";
|
||||
import i18n from "../../../i18n";
|
||||
import { commonMessages, sectionNames } from "@saleor/intl";
|
||||
import { UserError } from "../../../types";
|
||||
import CollectionDetails from "../CollectionDetails/CollectionDetails";
|
||||
import { CollectionImage } from "../CollectionImage/CollectionImage";
|
||||
|
@ -63,105 +64,110 @@ const CollectionCreatePage: React.StatelessComponent<
|
|||
saveButtonBarState,
|
||||
onBack,
|
||||
onSubmit
|
||||
}: CollectionCreatePageProps) => (
|
||||
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
|
||||
{({ change, data, errors: formErrors, hasChanged, submit }) => (
|
||||
<Container>
|
||||
<AppHeader onBack={onBack}>{i18n.t("Collections")}</AppHeader>
|
||||
<PageHeader
|
||||
title={i18n.t("Add collection", {
|
||||
context: "page title"
|
||||
})}
|
||||
/>
|
||||
<Grid>
|
||||
<div>
|
||||
<CollectionDetails
|
||||
data={data}
|
||||
disabled={disabled}
|
||||
errors={formErrors}
|
||||
onChange={change}
|
||||
/>
|
||||
<CardSpacer />
|
||||
<CollectionImage
|
||||
image={
|
||||
data.backgroundImage.url
|
||||
? {
|
||||
__typename: "Image",
|
||||
alt: data.backgroundImageAlt,
|
||||
url: data.backgroundImage.url
|
||||
}
|
||||
: null
|
||||
}
|
||||
onImageDelete={() =>
|
||||
change({
|
||||
target: {
|
||||
name: "backgroundImage",
|
||||
value: {
|
||||
url: null,
|
||||
value: null
|
||||
}
|
||||
}
|
||||
} as any)
|
||||
}
|
||||
onImageUpload={file =>
|
||||
change({
|
||||
target: {
|
||||
name: "backgroundImage",
|
||||
value: {
|
||||
url: URL.createObjectURL(file),
|
||||
value: file
|
||||
}
|
||||
}
|
||||
} as any)
|
||||
}
|
||||
onChange={change}
|
||||
data={data}
|
||||
/>
|
||||
<CardSpacer />
|
||||
<SeoForm
|
||||
description={data.seoDescription}
|
||||
disabled={disabled}
|
||||
descriptionPlaceholder=""
|
||||
helperText={i18n.t(
|
||||
"Add search engine title and description to make this collection easier to find",
|
||||
{
|
||||
context: "help text"
|
||||
}
|
||||
)}
|
||||
title={data.seoTitle}
|
||||
titlePlaceholder={data.name}
|
||||
onChange={change}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
}: CollectionCreatePageProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
|
||||
{({ change, data, errors: formErrors, hasChanged, submit }) => (
|
||||
<Container>
|
||||
<AppHeader onBack={onBack}>
|
||||
{intl.formatMessage(sectionNames.collections)}
|
||||
</AppHeader>
|
||||
<PageHeader
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Add collection",
|
||||
description: "page header",
|
||||
id: "collectionCreatePageHeader"
|
||||
})}
|
||||
/>
|
||||
<Grid>
|
||||
<div>
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={i18n.t("Availability", {
|
||||
context: "collection status"
|
||||
})}
|
||||
/>
|
||||
<CardContent>
|
||||
<VisibilityCard
|
||||
data={data}
|
||||
errors={formErrors}
|
||||
disabled={disabled}
|
||||
onChange={change}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<CollectionDetails
|
||||
data={data}
|
||||
disabled={disabled}
|
||||
errors={formErrors}
|
||||
onChange={change}
|
||||
/>
|
||||
<CardSpacer />
|
||||
<CollectionImage
|
||||
image={
|
||||
data.backgroundImage.url
|
||||
? {
|
||||
__typename: "Image",
|
||||
alt: data.backgroundImageAlt,
|
||||
url: data.backgroundImage.url
|
||||
}
|
||||
: null
|
||||
}
|
||||
onImageDelete={() =>
|
||||
change({
|
||||
target: {
|
||||
name: "backgroundImage",
|
||||
value: {
|
||||
url: null,
|
||||
value: null
|
||||
}
|
||||
}
|
||||
} as any)
|
||||
}
|
||||
onImageUpload={file =>
|
||||
change({
|
||||
target: {
|
||||
name: "backgroundImage",
|
||||
value: {
|
||||
url: URL.createObjectURL(file),
|
||||
value: file
|
||||
}
|
||||
}
|
||||
} as any)
|
||||
}
|
||||
onChange={change}
|
||||
data={data}
|
||||
/>
|
||||
<CardSpacer />
|
||||
<SeoForm
|
||||
description={data.seoDescription}
|
||||
disabled={disabled}
|
||||
descriptionPlaceholder=""
|
||||
helperText={intl.formatMessage({
|
||||
defaultMessage:
|
||||
"Add search engine title and description to make this collection easier to find",
|
||||
id: "collectionSeo"
|
||||
})}
|
||||
title={data.seoTitle}
|
||||
titlePlaceholder={data.name}
|
||||
onChange={change}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Grid>
|
||||
<SaveButtonBar
|
||||
state={saveButtonBarState}
|
||||
disabled={disabled || !hasChanged}
|
||||
onCancel={onBack}
|
||||
onSave={submit}
|
||||
/>
|
||||
</Container>
|
||||
)}
|
||||
</Form>
|
||||
);
|
||||
<div>
|
||||
<div>
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage(commonMessages.availability)}
|
||||
/>
|
||||
<CardContent>
|
||||
<VisibilityCard
|
||||
data={data}
|
||||
errors={formErrors}
|
||||
disabled={disabled}
|
||||
onChange={change}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</Grid>
|
||||
<SaveButtonBar
|
||||
state={saveButtonBarState}
|
||||
disabled={disabled || !hasChanged}
|
||||
onCancel={onBack}
|
||||
onSave={submit}
|
||||
/>
|
||||
</Container>
|
||||
)}
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
CollectionCreatePage.displayName = "CollectionCreatePage";
|
||||
export default CollectionCreatePage;
|
||||
|
|
|
@ -4,13 +4,14 @@ import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
|
|||
import TextField from "@material-ui/core/TextField";
|
||||
import { RawDraftContentState } from "draft-js";
|
||||
import React from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
import CardTitle from "@saleor/components/CardTitle";
|
||||
import FormSpacer from "@saleor/components/FormSpacer";
|
||||
import RichTextEditor from "@saleor/components/RichTextEditor";
|
||||
import i18n from "../../../i18n";
|
||||
import { maybe } from "../../../misc";
|
||||
import { FormErrors } from "../../../types";
|
||||
import { commonMessages } from "@saleor/intl";
|
||||
import { maybe } from "@saleor/misc";
|
||||
import { FormErrors } from "@saleor/types";
|
||||
import { CollectionDetails_collection } from "../../types/CollectionDetails";
|
||||
|
||||
const styles = createStyles({
|
||||
|
@ -38,33 +39,43 @@ const CollectionDetails = withStyles(styles, { name: "CollectionDetails" })(
|
|||
data,
|
||||
onChange,
|
||||
errors
|
||||
}: CollectionDetailsProps) => (
|
||||
<Card>
|
||||
<CardTitle title={i18n.t("General information")} />
|
||||
<CardContent>
|
||||
<TextField
|
||||
classes={{ root: classes.name }}
|
||||
label={i18n.t("Name")}
|
||||
name="name"
|
||||
disabled={disabled}
|
||||
value={data.name}
|
||||
onChange={onChange}
|
||||
error={!!errors.name}
|
||||
helperText={errors.name}
|
||||
}: CollectionDetailsProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||
/>
|
||||
<FormSpacer />
|
||||
<RichTextEditor
|
||||
error={!!errors.descriptionJson}
|
||||
helperText={errors.descriptionJson}
|
||||
initial={maybe(() => JSON.parse(collection.descriptionJson))}
|
||||
label={i18n.t("Description")}
|
||||
name="description"
|
||||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
<CardContent>
|
||||
<TextField
|
||||
classes={{ root: classes.name }}
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Name",
|
||||
description: "collection name",
|
||||
id: "collectionDetailsNameInputLabel"
|
||||
})}
|
||||
name="name"
|
||||
disabled={disabled}
|
||||
value={data.name}
|
||||
onChange={onChange}
|
||||
error={!!errors.name}
|
||||
helperText={errors.name}
|
||||
/>
|
||||
<FormSpacer />
|
||||
<RichTextEditor
|
||||
error={!!errors.descriptionJson}
|
||||
helperText={errors.descriptionJson}
|
||||
initial={maybe(() => JSON.parse(collection.descriptionJson))}
|
||||
label={intl.formatMessage(commonMessages.description)}
|
||||
name="description"
|
||||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
);
|
||||
CollectionDetails.displayName = "CollectionDetails";
|
||||
export default CollectionDetails;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { RawDraftContentState } from "draft-js";
|
||||
import React from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
import AppHeader from "@saleor/components/AppHeader";
|
||||
import { CardSpacer } from "@saleor/components/CardSpacer";
|
||||
|
@ -12,7 +13,7 @@ import PageHeader from "@saleor/components/PageHeader";
|
|||
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
||||
import SeoForm from "@saleor/components/SeoForm";
|
||||
import VisibilityCard from "@saleor/components/VisibilityCard";
|
||||
import i18n from "../../../i18n";
|
||||
import { sectionNames } from "@saleor/intl";
|
||||
import { maybe } from "../../../misc";
|
||||
import { ListActions, PageListProps } from "../../../types";
|
||||
import { CollectionDetails_collection } from "../../types/CollectionDetails";
|
||||
|
@ -57,6 +58,8 @@ const CollectionDetailsPage: React.StatelessComponent<
|
|||
onSubmit,
|
||||
...collectionProductsProps
|
||||
}: CollectionDetailsPageProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Form
|
||||
initial={{
|
||||
|
@ -74,7 +77,9 @@ const CollectionDetailsPage: React.StatelessComponent<
|
|||
>
|
||||
{({ change, data, errors: formErrors, hasChanged, submit }) => (
|
||||
<Container>
|
||||
<AppHeader onBack={onBack}>{i18n.t("Collections")}</AppHeader>
|
||||
<AppHeader onBack={onBack}>
|
||||
{intl.formatMessage(sectionNames.collections)}
|
||||
</AppHeader>
|
||||
<PageHeader title={maybe(() => collection.name)} />
|
||||
<Grid>
|
||||
<div>
|
||||
|
@ -104,12 +109,11 @@ const CollectionDetailsPage: React.StatelessComponent<
|
|||
description={data.seoDescription}
|
||||
disabled={disabled}
|
||||
descriptionPlaceholder=""
|
||||
helperText={i18n.t(
|
||||
"Add search engine title and description to make this collection easier to find",
|
||||
{
|
||||
context: "help text"
|
||||
}
|
||||
)}
|
||||
helperText={intl.formatMessage({
|
||||
defaultMessage:
|
||||
"Add search engine title and description to make this collection easier to find",
|
||||
id: "collectionSeo"
|
||||
})}
|
||||
title={data.seoTitle}
|
||||
titlePlaceholder={maybe(() => collection.name)}
|
||||
onChange={change}
|
||||
|
@ -128,8 +132,10 @@ const CollectionDetailsPage: React.StatelessComponent<
|
|||
disabled={disabled}
|
||||
name="isFeatured"
|
||||
onChange={change}
|
||||
label={i18n.t("Feature on Homepage", {
|
||||
context: "button"
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Feature on Homepage",
|
||||
description: "switch button",
|
||||
id: "collectionDetailsPageFeatureInputLabel"
|
||||
})}
|
||||
/>
|
||||
</VisibilityCard>
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
} from "@material-ui/core/styles";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import React from "react";
|
||||
import { FormattedMessage, useIntl } from "react-intl";
|
||||
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Card from "@material-ui/core/Card";
|
||||
|
@ -15,7 +16,7 @@ import Hr from "@saleor/components/Hr";
|
|||
import ImageTile from "@saleor/components/ImageTile";
|
||||
import ImageUpload from "@saleor/components/ImageUpload";
|
||||
import Skeleton from "@saleor/components/Skeleton";
|
||||
import i18n from "../../../i18n";
|
||||
import { commonMessages } from "@saleor/intl";
|
||||
import { CollectionDetails_collection_backgroundImage } from "../../types/CollectionDetails";
|
||||
|
||||
const styles = (theme: Theme) =>
|
||||
|
@ -51,7 +52,7 @@ const styles = (theme: Theme) =>
|
|||
}
|
||||
});
|
||||
|
||||
export interface CollectionImageProps extends WithStyles<typeof styles> {
|
||||
export interface CollectionImageProps {
|
||||
data: {
|
||||
backgroundImageAlt: string;
|
||||
};
|
||||
|
@ -62,80 +63,79 @@ export interface CollectionImageProps extends WithStyles<typeof styles> {
|
|||
}
|
||||
|
||||
export const CollectionImage = withStyles(styles)(
|
||||
class CollectionImageComponent extends React.Component<
|
||||
CollectionImageProps,
|
||||
{}
|
||||
> {
|
||||
imgInputAnchor = React.createRef<HTMLInputElement>();
|
||||
({
|
||||
classes,
|
||||
data,
|
||||
onImageUpload,
|
||||
image,
|
||||
onChange,
|
||||
onImageDelete
|
||||
}: CollectionImageProps & WithStyles<typeof styles>) => {
|
||||
const anchor = React.useRef<HTMLInputElement>();
|
||||
const intl = useIntl();
|
||||
|
||||
clickImgInput = () => this.imgInputAnchor.current.click();
|
||||
const handleImageUploadButtonClick = () => anchor.current.click();
|
||||
|
||||
render() {
|
||||
const {
|
||||
classes,
|
||||
data,
|
||||
onImageUpload,
|
||||
image,
|
||||
onChange,
|
||||
onImageDelete
|
||||
} = this.props;
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={i18n.t("Background image (optional)")}
|
||||
toolbar={
|
||||
<>
|
||||
<Button
|
||||
variant="text"
|
||||
color="primary"
|
||||
onClick={this.clickImgInput}
|
||||
>
|
||||
{i18n.t("Upload image")}
|
||||
</Button>
|
||||
<input
|
||||
className={classes.fileField}
|
||||
id="fileUpload"
|
||||
onChange={event => onImageUpload(event.target.files[0])}
|
||||
type="file"
|
||||
ref={this.imgInputAnchor}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
{image === undefined ? (
|
||||
<CardContent>
|
||||
<div>
|
||||
<div className={classes.imageContainer}>
|
||||
<Skeleton />
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
) : image === null ? (
|
||||
<ImageUpload onImageUpload={onImageUpload} />
|
||||
) : (
|
||||
<CardContent>
|
||||
<ImageTile image={image} onImageDelete={onImageDelete} />
|
||||
</CardContent>
|
||||
)}
|
||||
{image && (
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Background image (optional)",
|
||||
description: "section header",
|
||||
id: "collectionImageHeader"
|
||||
})}
|
||||
toolbar={
|
||||
<>
|
||||
<Hr />
|
||||
<CardContent>
|
||||
<TextField
|
||||
name="backgroundImageAlt"
|
||||
label={i18n.t("Description")}
|
||||
helperText={i18n.t("Optional")}
|
||||
value={data.backgroundImageAlt}
|
||||
onChange={onChange}
|
||||
fullWidth
|
||||
multiline
|
||||
/>
|
||||
</CardContent>
|
||||
<Button
|
||||
variant="text"
|
||||
color="primary"
|
||||
onClick={handleImageUploadButtonClick}
|
||||
>
|
||||
<FormattedMessage {...commonMessages.uploadImage} />
|
||||
</Button>
|
||||
<input
|
||||
className={classes.fileField}
|
||||
id="fileUpload"
|
||||
onChange={event => onImageUpload(event.target.files[0])}
|
||||
type="file"
|
||||
ref={anchor}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
}
|
||||
/>
|
||||
{image === undefined ? (
|
||||
<CardContent>
|
||||
<div>
|
||||
<div className={classes.imageContainer}>
|
||||
<Skeleton />
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
) : image === null ? (
|
||||
<ImageUpload onImageUpload={onImageUpload} />
|
||||
) : (
|
||||
<CardContent>
|
||||
<ImageTile image={image} onImageDelete={onImageDelete} />
|
||||
</CardContent>
|
||||
)}
|
||||
{image && (
|
||||
<>
|
||||
<Hr />
|
||||
<CardContent>
|
||||
<TextField
|
||||
name="backgroundImageAlt"
|
||||
label={intl.formatMessage(commonMessages.description)}
|
||||
helperText={intl.formatMessage(commonMessages.optionalField)}
|
||||
value={data.backgroundImageAlt}
|
||||
onChange={onChange}
|
||||
fullWidth
|
||||
multiline
|
||||
/>
|
||||
</CardContent>
|
||||
</>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
);
|
||||
CollectionImage.displayName = "CollectionImage";
|
||||
|
|
|
@ -11,13 +11,13 @@ import TableCell from "@material-ui/core/TableCell";
|
|||
import TableFooter from "@material-ui/core/TableFooter";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import React from "react";
|
||||
import { FormattedMessage, useIntl } from "react-intl";
|
||||
|
||||
import Checkbox from "@saleor/components/Checkbox";
|
||||
import Skeleton from "@saleor/components/Skeleton";
|
||||
import StatusLabel from "@saleor/components/StatusLabel";
|
||||
import TableHead from "@saleor/components/TableHead";
|
||||
import TablePagination from "@saleor/components/TablePagination";
|
||||
import i18n from "@saleor/i18n";
|
||||
import { maybe, renderCollection } from "@saleor/misc";
|
||||
import { ListActions, ListProps } from "@saleor/types";
|
||||
import { CollectionList_collections_edges_node } from "../../types/CollectionList";
|
||||
|
@ -68,107 +68,136 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
|
|||
toggle,
|
||||
toggleAll,
|
||||
toolbar
|
||||
}: CollectionListProps) => (
|
||||
<Card>
|
||||
<Table>
|
||||
<TableHead
|
||||
colSpan={numberOfColumns}
|
||||
selected={selected}
|
||||
disabled={disabled}
|
||||
items={collections}
|
||||
toggleAll={toggleAll}
|
||||
toolbar={toolbar}
|
||||
>
|
||||
<TableCell className={classes.colName}>
|
||||
{i18n.t("Category Name", { context: "table cell" })}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colProducts}>
|
||||
{i18n
|
||||
.t("No. Products", { context: "table cell" })
|
||||
.replace(" ", "\xa0")}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colAvailability}>
|
||||
{i18n.t("Availability", { context: "table cell" })}
|
||||
</TableCell>
|
||||
</TableHead>
|
||||
<TableFooter>
|
||||
<TableRow>
|
||||
<TablePagination
|
||||
colSpan={numberOfColumns}
|
||||
settings={settings}
|
||||
hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}
|
||||
onNextPage={onNextPage}
|
||||
onUpdateListSettings={onUpdateListSettings}
|
||||
hasPreviousPage={
|
||||
pageInfo && !disabled ? pageInfo.hasPreviousPage : false
|
||||
}
|
||||
onPreviousPage={onPreviousPage}
|
||||
/>
|
||||
</TableRow>
|
||||
</TableFooter>
|
||||
<TableBody>
|
||||
{renderCollection(
|
||||
collections,
|
||||
collection => {
|
||||
const isSelected = collection ? isChecked(collection.id) : false;
|
||||
return (
|
||||
<TableRow
|
||||
className={classes.tableRow}
|
||||
hover={!!collection}
|
||||
onClick={collection ? onRowClick(collection.id) : undefined}
|
||||
key={collection ? collection.id : "skeleton"}
|
||||
selected={isSelected}
|
||||
>
|
||||
<TableCell padding="checkbox">
|
||||
<Checkbox
|
||||
checked={isSelected}
|
||||
disabled={disabled}
|
||||
disableClickPropagation
|
||||
onChange={() => toggle(collection.id)}
|
||||
}: CollectionListProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<Table>
|
||||
<TableHead
|
||||
colSpan={numberOfColumns}
|
||||
selected={selected}
|
||||
disabled={disabled}
|
||||
items={collections}
|
||||
toggleAll={toggleAll}
|
||||
toolbar={toolbar}
|
||||
>
|
||||
<TableCell className={classes.colName}>
|
||||
<FormattedMessage
|
||||
defaultMessage="Category Name"
|
||||
id="collectionListNameColumnHeader"
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className={classes.colProducts}>
|
||||
<FormattedMessage
|
||||
defaultMessage="No. of Products"
|
||||
id="collectionListProductsColumnHeader"
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className={classes.colAvailability}>
|
||||
<FormattedMessage
|
||||
defaultMessage="Availability"
|
||||
description="collection availability"
|
||||
id="collectionListAvailabilityColumnHeader"
|
||||
/>
|
||||
</TableCell>
|
||||
</TableHead>
|
||||
<TableFooter>
|
||||
<TableRow>
|
||||
<TablePagination
|
||||
colSpan={numberOfColumns}
|
||||
settings={settings}
|
||||
hasNextPage={
|
||||
pageInfo && !disabled ? pageInfo.hasNextPage : false
|
||||
}
|
||||
onNextPage={onNextPage}
|
||||
onUpdateListSettings={onUpdateListSettings}
|
||||
hasPreviousPage={
|
||||
pageInfo && !disabled ? pageInfo.hasPreviousPage : false
|
||||
}
|
||||
onPreviousPage={onPreviousPage}
|
||||
/>
|
||||
</TableRow>
|
||||
</TableFooter>
|
||||
<TableBody>
|
||||
{renderCollection(
|
||||
collections,
|
||||
collection => {
|
||||
const isSelected = collection
|
||||
? isChecked(collection.id)
|
||||
: false;
|
||||
return (
|
||||
<TableRow
|
||||
className={classes.tableRow}
|
||||
hover={!!collection}
|
||||
onClick={collection ? onRowClick(collection.id) : undefined}
|
||||
key={collection ? collection.id : "skeleton"}
|
||||
selected={isSelected}
|
||||
>
|
||||
<TableCell padding="checkbox">
|
||||
<Checkbox
|
||||
checked={isSelected}
|
||||
disabled={disabled}
|
||||
disableClickPropagation
|
||||
onChange={() => toggle(collection.id)}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className={classes.colName}>
|
||||
{maybe<React.ReactNode>(
|
||||
() => collection.name,
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colProducts}>
|
||||
{maybe<React.ReactNode>(
|
||||
() => collection.products.totalCount,
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colAvailability}>
|
||||
{maybe(
|
||||
() => (
|
||||
<StatusLabel
|
||||
status={
|
||||
collection.isPublished ? "success" : "error"
|
||||
}
|
||||
label={
|
||||
collection.isPublished
|
||||
? intl.formatMessage({
|
||||
defaultMessage: "Published",
|
||||
description: "collection is published",
|
||||
id: "collectionListPublished"
|
||||
})
|
||||
: intl.formatMessage({
|
||||
defaultMessage: "Not published",
|
||||
description: "collection is not published",
|
||||
id: "collectionListNotPublished"
|
||||
})
|
||||
}
|
||||
/>
|
||||
),
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
},
|
||||
() => (
|
||||
<TableRow>
|
||||
<TableCell colSpan={numberOfColumns}>
|
||||
<FormattedMessage
|
||||
defaultMessage="No collections found"
|
||||
id="collectionListNoCollections"
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className={classes.colName}>
|
||||
{maybe<React.ReactNode>(
|
||||
() => collection.name,
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colProducts}>
|
||||
{maybe<React.ReactNode>(
|
||||
() => collection.products.totalCount,
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colAvailability}>
|
||||
{maybe(
|
||||
() => (
|
||||
<StatusLabel
|
||||
status={collection.isPublished ? "success" : "error"}
|
||||
label={
|
||||
collection.isPublished
|
||||
? i18n.t("Published")
|
||||
: i18n.t("Not published")
|
||||
}
|
||||
/>
|
||||
),
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
},
|
||||
() => (
|
||||
<TableRow>
|
||||
<TableCell colSpan={numberOfColumns}>
|
||||
{i18n.t("No collections found")}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
)
|
||||
)
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
);
|
||||
CollectionList.displayName = "CollectionList";
|
||||
export default CollectionList;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
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 { Container } from "@saleor/components/Container";
|
||||
import PageHeader from "@saleor/components/PageHeader";
|
||||
import i18n from "@saleor/i18n";
|
||||
import { sectionNames } from "@saleor/intl";
|
||||
import { ListActions, PageListProps } from "@saleor/types";
|
||||
import { CollectionList_collections_edges_node } from "../../types/CollectionList";
|
||||
import CollectionList from "../CollectionList/CollectionList";
|
||||
|
@ -17,21 +18,29 @@ const CollectionListPage: React.StatelessComponent<CollectionListPageProps> = ({
|
|||
disabled,
|
||||
onAdd,
|
||||
...listProps
|
||||
}) => (
|
||||
<Container>
|
||||
<PageHeader title={i18n.t("Collections", { context: "page title" })}>
|
||||
<Button
|
||||
color="primary"
|
||||
disabled={disabled}
|
||||
variant="contained"
|
||||
onClick={onAdd}
|
||||
>
|
||||
{i18n.t("Add collection", { context: "button" })}
|
||||
<AddIcon />
|
||||
</Button>
|
||||
</PageHeader>
|
||||
<CollectionList disabled={disabled} {...listProps} />
|
||||
</Container>
|
||||
);
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<PageHeader title={intl.formatMessage(sectionNames.collections)}>
|
||||
<Button
|
||||
color="primary"
|
||||
disabled={disabled}
|
||||
variant="contained"
|
||||
onClick={onAdd}
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Add collection"
|
||||
description="button"
|
||||
id="collectionListPageAddCollectionButton"
|
||||
/>
|
||||
<AddIcon />
|
||||
</Button>
|
||||
</PageHeader>
|
||||
<CollectionList disabled={disabled} {...listProps} />
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
CollectionListPage.displayName = "CollectionListPage";
|
||||
export default CollectionListPage;
|
||||
|
|
|
@ -14,6 +14,7 @@ import TableFooter from "@material-ui/core/TableFooter";
|
|||
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";
|
||||
|
@ -24,7 +25,6 @@ import TableCellAvatar, {
|
|||
} from "@saleor/components/TableCellAvatar";
|
||||
import TableHead from "@saleor/components/TableHead";
|
||||
import TablePagination from "@saleor/components/TablePagination";
|
||||
import i18n from "../../../i18n";
|
||||
import { maybe, renderCollection } from "../../../misc";
|
||||
import { ListActions, PageListProps } from "../../../types";
|
||||
import { CollectionDetails_collection } from "../../types/CollectionDetails";
|
||||
|
@ -83,137 +83,170 @@ const CollectionProducts = withStyles(styles, { name: "CollectionProducts" })(
|
|||
toggle,
|
||||
toggleAll,
|
||||
toolbar
|
||||
}: CollectionProductsProps) => (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={
|
||||
!!collection ? (
|
||||
i18n.t("Products in {{ collectionName }}", {
|
||||
collectionName: collection.name
|
||||
})
|
||||
) : (
|
||||
<Skeleton />
|
||||
)
|
||||
}
|
||||
toolbar={
|
||||
<Button
|
||||
disabled={disabled}
|
||||
variant="text"
|
||||
color="primary"
|
||||
onClick={onAdd}
|
||||
>
|
||||
{i18n.t("Assign product", {
|
||||
context: "button"
|
||||
})}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<Table className={classes.table}>
|
||||
<TableHead
|
||||
colSpan={numberOfColumns}
|
||||
selected={selected}
|
||||
disabled={disabled}
|
||||
items={maybe(() => collection.products.edges.map(edge => edge.node))}
|
||||
toggleAll={toggleAll}
|
||||
toolbar={toolbar}
|
||||
>
|
||||
<TableCell className={classes.colName}>
|
||||
<span className={classes.colNameLabel}>
|
||||
{i18n.t("Name", { context: "table header" })}
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell className={classes.colType}>
|
||||
{i18n.t("Type", { context: "table header" })}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colPublished}>
|
||||
{i18n.t("Published", { context: "table header" })}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colActions} />
|
||||
</TableHead>
|
||||
<TableFooter>
|
||||
<TableRow>
|
||||
<TablePagination
|
||||
colSpan={numberOfColumns}
|
||||
hasNextPage={maybe(() => pageInfo.hasNextPage)}
|
||||
onNextPage={onNextPage}
|
||||
hasPreviousPage={maybe(() => pageInfo.hasPreviousPage)}
|
||||
onPreviousPage={onPreviousPage}
|
||||
/>
|
||||
</TableRow>
|
||||
</TableFooter>
|
||||
<TableBody>
|
||||
{renderCollection(
|
||||
maybe(() => collection.products.edges.map(edge => edge.node)),
|
||||
product => {
|
||||
const isSelected = product ? isChecked(product.id) : false;
|
||||
}: CollectionProductsProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
className={classes.tableRow}
|
||||
hover={!!product}
|
||||
onClick={!!product ? onRowClick(product.id) : undefined}
|
||||
key={product ? product.id : "skeleton"}
|
||||
selected={isSelected}
|
||||
>
|
||||
<TableCell padding="checkbox">
|
||||
<Checkbox
|
||||
checked={isSelected}
|
||||
disabled={disabled}
|
||||
disableClickPropagation
|
||||
onChange={() => toggle(product.id)}
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={
|
||||
!!collection ? (
|
||||
intl.formatMessage({
|
||||
defaultMessage: "Products in {name}",
|
||||
description: "products in collection",
|
||||
id: "collectionProductsHeader"
|
||||
})
|
||||
) : (
|
||||
<Skeleton />
|
||||
)
|
||||
}
|
||||
toolbar={
|
||||
<Button
|
||||
disabled={disabled}
|
||||
variant="text"
|
||||
color="primary"
|
||||
onClick={onAdd}
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Assign product"
|
||||
description="button"
|
||||
id="collectionProductsAssignProductButton"
|
||||
/>
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<Table className={classes.table}>
|
||||
<TableHead
|
||||
colSpan={numberOfColumns}
|
||||
selected={selected}
|
||||
disabled={disabled}
|
||||
items={maybe(() =>
|
||||
collection.products.edges.map(edge => edge.node)
|
||||
)}
|
||||
toggleAll={toggleAll}
|
||||
toolbar={toolbar}
|
||||
>
|
||||
<TableCell className={classes.colName}>
|
||||
<span className={classes.colNameLabel}>
|
||||
<FormattedMessage
|
||||
defaultMessage="Name"
|
||||
description="product name"
|
||||
id="collectionProductsNameColumnHeader"
|
||||
/>
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell className={classes.colType}>
|
||||
<FormattedMessage
|
||||
defaultMessage="Type"
|
||||
description="product type"
|
||||
id="collectionProductsTypeProductList"
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className={classes.colPublished}>
|
||||
<FormattedMessage
|
||||
defaultMessage="Published"
|
||||
description="product is published"
|
||||
id="collectionPublishedColumnHeader"
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className={classes.colActions} />
|
||||
</TableHead>
|
||||
<TableFooter>
|
||||
<TableRow>
|
||||
<TablePagination
|
||||
colSpan={numberOfColumns}
|
||||
hasNextPage={maybe(() => pageInfo.hasNextPage)}
|
||||
onNextPage={onNextPage}
|
||||
hasPreviousPage={maybe(() => pageInfo.hasPreviousPage)}
|
||||
onPreviousPage={onPreviousPage}
|
||||
/>
|
||||
</TableRow>
|
||||
</TableFooter>
|
||||
<TableBody>
|
||||
{renderCollection(
|
||||
maybe(() => collection.products.edges.map(edge => edge.node)),
|
||||
product => {
|
||||
const isSelected = product ? isChecked(product.id) : false;
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
className={classes.tableRow}
|
||||
hover={!!product}
|
||||
onClick={!!product ? onRowClick(product.id) : undefined}
|
||||
key={product ? product.id : "skeleton"}
|
||||
selected={isSelected}
|
||||
>
|
||||
<TableCell padding="checkbox">
|
||||
<Checkbox
|
||||
checked={isSelected}
|
||||
disabled={disabled}
|
||||
disableClickPropagation
|
||||
onChange={() => toggle(product.id)}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCellAvatar
|
||||
className={classes.colName}
|
||||
thumbnail={maybe(() => product.thumbnail.url)}
|
||||
>
|
||||
{maybe<React.ReactNode>(() => product.name, <Skeleton />)}
|
||||
</TableCellAvatar>
|
||||
<TableCell className={classes.colType}>
|
||||
{maybe<React.ReactNode>(
|
||||
() => product.productType.name,
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colPublished}>
|
||||
{maybe(
|
||||
() => (
|
||||
<StatusLabel
|
||||
label={
|
||||
product.isPublished
|
||||
? intl.formatMessage({
|
||||
defaultMessage: "Published",
|
||||
description: "product is published",
|
||||
id: "collectionProductsPublished"
|
||||
})
|
||||
: intl.formatMessage({
|
||||
defaultMessage: "Not published",
|
||||
description: "product is not published",
|
||||
id: "collectionProductsNotPublished"
|
||||
})
|
||||
}
|
||||
status={product.isPublished ? "success" : "error"}
|
||||
/>
|
||||
),
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colActions}>
|
||||
<IconButton
|
||||
disabled={!product}
|
||||
onClick={event => onProductUnassign(product.id, event)}
|
||||
>
|
||||
<DeleteIcon color="primary" />
|
||||
</IconButton>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
},
|
||||
() => (
|
||||
<TableRow>
|
||||
<TableCell />
|
||||
<TableCell colSpan={numberOfColumns}>
|
||||
<FormattedMessage
|
||||
defaultMessage="No products found"
|
||||
id="collectionProductsNoProducts"
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCellAvatar
|
||||
className={classes.colName}
|
||||
thumbnail={maybe(() => product.thumbnail.url)}
|
||||
>
|
||||
{maybe<React.ReactNode>(() => product.name, <Skeleton />)}
|
||||
</TableCellAvatar>
|
||||
<TableCell className={classes.colType}>
|
||||
{maybe<React.ReactNode>(
|
||||
() => product.productType.name,
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colPublished}>
|
||||
{maybe(
|
||||
() => (
|
||||
<StatusLabel
|
||||
label={
|
||||
product.isPublished
|
||||
? i18n.t("Published")
|
||||
: i18n.t("Not published")
|
||||
}
|
||||
status={product.isPublished ? "success" : "error"}
|
||||
/>
|
||||
),
|
||||
<Skeleton />
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colActions}>
|
||||
<IconButton
|
||||
disabled={!product}
|
||||
onClick={event => onProductUnassign(product.id, event)}
|
||||
>
|
||||
<DeleteIcon color="primary" />
|
||||
</IconButton>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
},
|
||||
() => (
|
||||
<TableRow>
|
||||
<TableCell />
|
||||
<TableCell colSpan={numberOfColumns}>
|
||||
{i18n.t("No products found")}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
)
|
||||
)
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
);
|
||||
CollectionProducts.displayName = "CollectionProducts";
|
||||
export default CollectionProducts;
|
||||
|
|
|
@ -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 {
|
||||
collectionAddPath,
|
||||
collectionListPath,
|
||||
|
@ -39,14 +40,18 @@ const CollectionDetails: React.StatelessComponent<
|
|||
);
|
||||
};
|
||||
|
||||
const Component = () => (
|
||||
<>
|
||||
<WindowTitle title={i18n.t("Collections")} />
|
||||
<Switch>
|
||||
<Route exact path={collectionListPath} component={CollectionList} />
|
||||
<Route exact path={collectionAddPath} component={CollectionCreate} />
|
||||
<Route path={collectionPath(":id")} component={CollectionDetails} />
|
||||
</Switch>
|
||||
</>
|
||||
);
|
||||
const Component = () => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<>
|
||||
<WindowTitle title={intl.formatMessage(sectionNames.collections)} />
|
||||
<Switch>
|
||||
<Route exact path={collectionListPath} component={CollectionList} />
|
||||
<Route exact path={collectionAddPath} component={CollectionCreate} />
|
||||
<Route path={collectionPath(":id")} component={CollectionDetails} />
|
||||
</Switch>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Component;
|
||||
|
|
|
@ -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 { CollectionCreateInput } from "../../types/globalTypes";
|
||||
import CollectionCreatePage from "../components/CollectionCreatePage/CollectionCreatePage";
|
||||
|
@ -11,15 +11,17 @@ import { TypedCollectionCreateMutation } from "../mutations";
|
|||
import { CreateCollection } from "../types/CreateCollection";
|
||||
import { collectionListUrl, collectionUrl } from "../urls";
|
||||
|
||||
export const CollectionCreate: React.StatelessComponent<{}> = () => {
|
||||
export const CollectionCreate: React.FC = () => {
|
||||
const navigate = useNavigator();
|
||||
const notify = useNotifier();
|
||||
const intl = useIntl();
|
||||
|
||||
const handleCollectionCreateSuccess = (data: CreateCollection) => {
|
||||
if (data.collectionCreate.errors.length === 0) {
|
||||
notify({
|
||||
text: i18n.t("Created collection", {
|
||||
context: "notification"
|
||||
text: intl.formatMessage({
|
||||
defaultMessage: "Created collection",
|
||||
id: "collectionCreateCreatedCollection"
|
||||
})
|
||||
});
|
||||
navigate(collectionUrl(data.collectionCreate.collection.id));
|
||||
|
@ -45,7 +47,13 @@ export const CollectionCreate: React.StatelessComponent<{}> = () => {
|
|||
);
|
||||
return (
|
||||
<>
|
||||
<WindowTitle title={i18n.t("Create collection")} />
|
||||
<WindowTitle
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Create collection",
|
||||
description: "window title",
|
||||
id: "collectionCreateWindowTitle"
|
||||
})}
|
||||
/>
|
||||
<CollectionCreatePage
|
||||
errors={maybe(() => data.collectionCreate.errors, [])}
|
||||
onBack={() => navigate(collectionListUrl())}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Button from "@material-ui/core/Button";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import React from "react";
|
||||
import { FormattedMessage, useIntl } from "react-intl";
|
||||
|
||||
import ActionDialog from "@saleor/components/ActionDialog";
|
||||
import AssignProductDialog from "@saleor/components/AssignProductDialog";
|
||||
|
@ -11,9 +12,9 @@ import useNotifier from "@saleor/hooks/useNotifier";
|
|||
import usePaginator, {
|
||||
createPaginationState
|
||||
} from "@saleor/hooks/usePaginator";
|
||||
import { commonMessages } from "@saleor/intl";
|
||||
import { DEFAULT_INITIAL_SEARCH_DATA, PAGINATE_BY } from "../../config";
|
||||
import SearchProducts from "../../containers/SearchProducts";
|
||||
import i18n from "../../i18n";
|
||||
import { getMutationState, maybe } from "../../misc";
|
||||
import { productUrl } from "../../products/urls";
|
||||
import { CollectionInput } from "../../types/globalTypes";
|
||||
|
@ -47,6 +48,7 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
params.ids
|
||||
);
|
||||
const paginate = usePaginator();
|
||||
const intl = useIntl();
|
||||
|
||||
const closeModal = () =>
|
||||
navigate(
|
||||
|
@ -77,9 +79,7 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
const handleCollectionUpdate = (data: CollectionUpdate) => {
|
||||
if (data.collectionUpdate.errors.length === 0) {
|
||||
notify({
|
||||
text: i18n.t("Updated collection", {
|
||||
context: "notification"
|
||||
})
|
||||
text: intl.formatMessage(commonMessages.savedChanges)
|
||||
});
|
||||
navigate(collectionUrl(id));
|
||||
} else {
|
||||
|
@ -98,8 +98,9 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
const handleProductAssign = (data: CollectionAssignProduct) => {
|
||||
if (data.collectionAddProducts.errors.length === 0) {
|
||||
notify({
|
||||
text: i18n.t("Added product to collection", {
|
||||
context: "notification"
|
||||
text: intl.formatMessage({
|
||||
defaultMessage: "Added product to collection",
|
||||
id: "collectionDetailsAddedProduct"
|
||||
})
|
||||
});
|
||||
navigate(collectionUrl(id), true);
|
||||
|
@ -109,8 +110,9 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
const handleProductUnassign = (data: UnassignCollectionProduct) => {
|
||||
if (data.collectionRemoveProducts.errors.length === 0) {
|
||||
notify({
|
||||
text: i18n.t("Removed product from collection", {
|
||||
context: "notification"
|
||||
text: intl.formatMessage({
|
||||
defaultMessage: "Deleted product from collection",
|
||||
id: "collectionDetailsDeletedProduct"
|
||||
})
|
||||
});
|
||||
reset();
|
||||
|
@ -121,8 +123,9 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
const handleCollectionRemove = (data: RemoveCollection) => {
|
||||
if (data.collectionDelete.errors.length === 0) {
|
||||
notify({
|
||||
text: i18n.t("Removed collection", {
|
||||
context: "notification"
|
||||
text: intl.formatMessage({
|
||||
defaultMessage: "Deleted collection",
|
||||
id: "collectionDetailsDeletedCollection"
|
||||
})
|
||||
});
|
||||
navigate(collectionListUrl());
|
||||
|
@ -272,7 +275,11 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
)
|
||||
}
|
||||
>
|
||||
{i18n.t("Unassign")}
|
||||
<FormattedMessage
|
||||
defaultMessage="Unassign"
|
||||
description="unassign product from collection, button"
|
||||
id="collectionDetailsUnassignButton"
|
||||
/>
|
||||
</Button>
|
||||
}
|
||||
isChecked={isSelected}
|
||||
|
@ -308,25 +315,26 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
onClose={closeModal}
|
||||
onConfirm={() => removeCollection.mutate({ id })}
|
||||
open={params.action === "remove"}
|
||||
title={i18n.t("Remove collection", {
|
||||
context: "modal title"
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Delete Collection",
|
||||
description: "dialog title",
|
||||
id: "collectionDetailsDeleteCollectionDialogTitle"
|
||||
})}
|
||||
variant="delete"
|
||||
>
|
||||
<DialogContentText
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: i18n.t(
|
||||
"Are you sure you want to remove <strong>{{ collectionName }}</strong>?",
|
||||
{
|
||||
collectionName: maybe(
|
||||
() => data.collection.name,
|
||||
"..."
|
||||
),
|
||||
context: "modal"
|
||||
}
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<DialogContentText>
|
||||
<FormattedMessage
|
||||
defaultMessage="Are you sure you want to delete {collectionName}?"
|
||||
id="collectionDetailsDeleteCollectionDialogContent"
|
||||
values={{
|
||||
collectionName: (
|
||||
<strong>
|
||||
{maybe(() => data.collection.name, "...")}
|
||||
</strong>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</DialogContentText>
|
||||
</ActionDialog>
|
||||
<ActionDialog
|
||||
confirmButtonState={unassignTransitionState}
|
||||
|
@ -339,24 +347,24 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
})
|
||||
}
|
||||
open={params.action === "unassign"}
|
||||
title={i18n.t("Unassign products from collection", {
|
||||
context: "modal title"
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Unassign products from collection",
|
||||
description: "dialog title",
|
||||
id: "collectionDetailsUnassignProductsDialogTitle"
|
||||
})}
|
||||
>
|
||||
<DialogContentText
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: i18n.t(
|
||||
"Are you sure you want to unassign <strong>{{ number }}</strong> products?",
|
||||
{
|
||||
context: "modal",
|
||||
number: maybe(
|
||||
() => params.ids.length.toString(),
|
||||
"..."
|
||||
)
|
||||
}
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<DialogContentText>
|
||||
<FormattedMessage
|
||||
defaultMessage="Are you sure you want to unassign {counter, plural,
|
||||
one {this product}
|
||||
other {{displayQuantity} products}
|
||||
}?"
|
||||
id="collectionDetailsUnassignProductsDialogContent"
|
||||
values={{
|
||||
number: <strong>{params.ids.length}</strong>
|
||||
}}
|
||||
/>
|
||||
</DialogContentText>
|
||||
</ActionDialog>
|
||||
<ActionDialog
|
||||
confirmButtonState={imageRemoveTransitionState}
|
||||
|
@ -370,15 +378,18 @@ export const CollectionDetails: React.StatelessComponent<
|
|||
})
|
||||
}
|
||||
open={params.action === "removeImage"}
|
||||
title={i18n.t("Remove image", {
|
||||
context: "modal title"
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Delete image",
|
||||
description: "dialog title",
|
||||
id: "collectionDetailsDeleteImageTitle"
|
||||
})}
|
||||
variant="delete"
|
||||
>
|
||||
<DialogContentText>
|
||||
{i18n.t(
|
||||
"Are you sure you want to remove collection's image?"
|
||||
)}
|
||||
<FormattedMessage
|
||||
defaultMessage="Are you sure you want to delete collection's image?"
|
||||
id="collectionDetailsDeleteImageContent"
|
||||
/>
|
||||
</DialogContentText>
|
||||
</ActionDialog>
|
||||
</>
|
||||
|
|
|
@ -3,6 +3,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";
|
||||
|
@ -12,7 +13,7 @@ import useNotifier from "@saleor/hooks/useNotifier";
|
|||
import usePaginator, {
|
||||
createPaginationState
|
||||
} from "@saleor/hooks/usePaginator";
|
||||
import i18n from "@saleor/i18n";
|
||||
import { commonMessages } from "@saleor/intl";
|
||||
import { getMutationState, maybe } from "@saleor/misc";
|
||||
import { ListViews } from "@saleor/types";
|
||||
import CollectionListPage from "../components/CollectionListPage/CollectionListPage";
|
||||
|
@ -47,6 +48,7 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
|
|||
const { updateListSettings, settings } = useListSettings(
|
||||
ListViews.COLLECTION_LIST
|
||||
);
|
||||
const intl = useIntl();
|
||||
|
||||
const closeModal = () =>
|
||||
navigate(
|
||||
|
@ -79,7 +81,7 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
|
|||
const handleCollectionBulkDelete = (data: CollectionBulkDelete) => {
|
||||
if (data.collectionBulkDelete.errors.length === 0) {
|
||||
notify({
|
||||
text: i18n.t("Removed collections")
|
||||
text: intl.formatMessage(commonMessages.savedChanges)
|
||||
});
|
||||
refetch();
|
||||
reset();
|
||||
|
@ -90,7 +92,7 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
|
|||
const handleCollectionBulkPublish = (data: CollectionBulkPublish) => {
|
||||
if (data.collectionBulkPublish.errors.length === 0) {
|
||||
notify({
|
||||
text: i18n.t("Changed publication status")
|
||||
text: intl.formatMessage(commonMessages.savedChanges)
|
||||
});
|
||||
refetch();
|
||||
reset();
|
||||
|
@ -147,13 +149,21 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
|
|||
openModal("unpublish", listElements)
|
||||
}
|
||||
>
|
||||
{i18n.t("Unpublish")}
|
||||
<FormattedMessage
|
||||
defaultMessage="Unpublish"
|
||||
description="unpublish collections"
|
||||
id="collectionListUnpublish"
|
||||
/>
|
||||
</Button>
|
||||
<Button
|
||||
color="primary"
|
||||
onClick={() => openModal("publish", listElements)}
|
||||
>
|
||||
{i18n.t("Publish")}
|
||||
<FormattedMessage
|
||||
defaultMessage="Publish"
|
||||
description="publish collections"
|
||||
id="collectionListPublish"
|
||||
/>
|
||||
</Button>
|
||||
<IconButton
|
||||
color="primary"
|
||||
|
@ -169,7 +179,10 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
|
|||
toggleAll={toggleAll}
|
||||
/>
|
||||
<ActionDialog
|
||||
open={params.action === "publish"}
|
||||
open={
|
||||
params.action === "publish" &&
|
||||
maybe(() => params.ids.length > 0)
|
||||
}
|
||||
onClose={closeModal}
|
||||
confirmButtonState={bulkPublishTransitionState}
|
||||
onConfirm={() =>
|
||||
|
@ -181,24 +194,30 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
|
|||
})
|
||||
}
|
||||
variant="default"
|
||||
title={i18n.t("Publish collections")}
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Publish collections",
|
||||
description: "dialog title",
|
||||
id: "collectionListPublishCollectionsDialogTitle"
|
||||
})}
|
||||
>
|
||||
<DialogContentText
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: i18n.t(
|
||||
"Are you sure you want to publish <strong>{{ number }}</strong> collections?",
|
||||
{
|
||||
number: maybe(
|
||||
() => params.ids.length.toString(),
|
||||
"..."
|
||||
)
|
||||
}
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<DialogContentText>
|
||||
<FormattedMessage
|
||||
defaultMessage="Are you sure you want to publish {counter, plural,
|
||||
one {this collection}
|
||||
other {{displayQuantity} collections}
|
||||
}?"
|
||||
id="collectionListPublishCollectionsDialogContent"
|
||||
values={{
|
||||
number: params.ids.length
|
||||
}}
|
||||
/>
|
||||
</DialogContentText>
|
||||
</ActionDialog>
|
||||
<ActionDialog
|
||||
open={params.action === "unpublish"}
|
||||
open={
|
||||
params.action === "unpublish" &&
|
||||
maybe(() => params.ids.length > 0)
|
||||
}
|
||||
onClose={closeModal}
|
||||
confirmButtonState={bulkPublishTransitionState}
|
||||
onConfirm={() =>
|
||||
|
@ -210,24 +229,30 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
|
|||
})
|
||||
}
|
||||
variant="default"
|
||||
title={i18n.t("Unpublish collections")}
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Unpublish collections",
|
||||
description: "dialog title",
|
||||
id: "collectionListUnpublishCollectionsDialogTitle"
|
||||
})}
|
||||
>
|
||||
<DialogContentText
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: i18n.t(
|
||||
"Are you sure you want to unpublish <strong>{{ number }}</strong> collections?",
|
||||
{
|
||||
number: maybe(
|
||||
() => params.ids.length.toString(),
|
||||
"..."
|
||||
)
|
||||
}
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<DialogContentText>
|
||||
<FormattedMessage
|
||||
defaultMessage="Are you sure you want to unpublish {counter, plural,
|
||||
one {this collection}
|
||||
other {{displayQuantity} collections}
|
||||
}?"
|
||||
id="collectionListUnpublishCollectionsDialogContent"
|
||||
values={{
|
||||
number: params.ids.length
|
||||
}}
|
||||
/>
|
||||
</DialogContentText>
|
||||
</ActionDialog>
|
||||
<ActionDialog
|
||||
open={params.action === "remove"}
|
||||
open={
|
||||
params.action === "remove" &&
|
||||
maybe(() => params.ids.length > 0)
|
||||
}
|
||||
onClose={closeModal}
|
||||
confirmButtonState={bulkDeleteTransitionState}
|
||||
onConfirm={() =>
|
||||
|
@ -238,21 +263,24 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
|
|||
})
|
||||
}
|
||||
variant="delete"
|
||||
title={i18n.t("Remove collections")}
|
||||
title={intl.formatMessage({
|
||||
defaultMessage: "Delete collections",
|
||||
description: "dialog title",
|
||||
id: "collectionListDeleteCollectionsDialogTitle"
|
||||
})}
|
||||
>
|
||||
<DialogContentText
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: i18n.t(
|
||||
"Are you sure you want to remove <strong>{{ number }}</strong> collections?",
|
||||
{
|
||||
number: maybe(
|
||||
() => params.ids.length.toString(),
|
||||
"..."
|
||||
)
|
||||
}
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<DialogContentText>
|
||||
<FormattedMessage
|
||||
defaultMessage="Are you sure you want to delete {counter, plural,
|
||||
one {this collection}
|
||||
other {{displayQuantity} collections}
|
||||
}?"
|
||||
id="collectionListDeleteCollectionsDialogContent"
|
||||
values={{
|
||||
number: params.ids.length
|
||||
}}
|
||||
/>
|
||||
</DialogContentText>
|
||||
</ActionDialog>
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { defineMessages } from "react-intl";
|
||||
|
||||
export const commonMessages = defineMessages({
|
||||
availability: {
|
||||
defaultMessage: "Availability",
|
||||
id: "availability"
|
||||
},
|
||||
cancel: {
|
||||
defaultMessage: "Cancel",
|
||||
id: "cancel"
|
||||
|
@ -51,5 +55,10 @@ export const sectionNames = defineMessages({
|
|||
defaultMessage: "Categories",
|
||||
description: "categories section name",
|
||||
id: "categories"
|
||||
},
|
||||
collections: {
|
||||
defaultMessage: "Collections",
|
||||
description: "collections section name",
|
||||
id: "collections"
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue