Use prettier

This commit is contained in:
dominik-zeglen 2019-08-22 18:25:55 +02:00
parent a472c8cd1a
commit 8a71976c4b
27 changed files with 110 additions and 165 deletions

View file

@ -24,9 +24,10 @@ const AttributeBulkDeleteDialog: React.StatelessComponent<
confirmButtonState={confirmButtonState}
onClose={onClose}
onConfirm={onConfirm}
title={intl.formatMessage({defaultMessage: "Delete attributes",
description: "dialog title",
})}
title={intl.formatMessage({
defaultMessage: "Delete attributes",
description: "dialog title"
})}
variant="delete"
>
<DialogContentText>

View file

@ -29,9 +29,10 @@ const AttributeDeleteDialog: React.FC<AttributeDeleteDialogProps> = ({
confirmButtonState={confirmButtonState}
onConfirm={onConfirm}
variant="delete"
title={intl.formatMessage({defaultMessage: "Delete attribute",
description: "dialog title",
})}
title={intl.formatMessage({
defaultMessage: "Delete attribute",
description: "dialog title"
})}
>
<DialogContentText>
<FormattedMessage

View file

@ -32,15 +32,17 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({
const intl = useIntl();
const inputTypeChoices = [
{
label: intl.formatMessage({defaultMessage: "Dropdown",
description: "product attribute type",
}),
label: intl.formatMessage({
defaultMessage: "Dropdown",
description: "product attribute type"
}),
value: AttributeInputTypeEnum.DROPDOWN
},
{
label: intl.formatMessage({defaultMessage: "Multiple Select",
description: "product attribute type",
}),
label: intl.formatMessage({
defaultMessage: "Multiple Select",
description: "product attribute type"
}),
value: AttributeInputTypeEnum.MULTISELECT
}
];
@ -54,9 +56,10 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({
<TextField
disabled={disabled}
error={!!errors.name}
label={intl.formatMessage({defaultMessage: "Default Label",
description: "attribute's label",
})}
label={intl.formatMessage({
defaultMessage: "Default Label",
description: "attribute's label"
})}
name={"name" as keyof AttributePageFormData}
fullWidth
helperText={errors.name}
@ -67,18 +70,20 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({
<TextField
disabled={disabled}
error={!!errors.slug}
label={intl.formatMessage({defaultMessage: "Attribute Code",
description: "attribute's slug short code label",
})}
label={intl.formatMessage({
defaultMessage: "Attribute Code",
description: "attribute's slug short code label"
})}
name={"slug" as keyof AttributePageFormData}
placeholder={slugify(data.name).toLowerCase()}
fullWidth
helperText={
errors.slug ||
intl.formatMessage({defaultMessage:
intl.formatMessage({
defaultMessage:
"This is used internally. Make sure you dont use spaces",
description: "attribute slug input field helper text",
})
description: "attribute slug input field helper text"
})
}
value={data.slug}
onChange={onChange}
@ -89,9 +94,10 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({
disabled={disabled || !canChangeType}
error={!!errors.inputType}
hint={errors.inputType}
label={intl.formatMessage({defaultMessage: "Catalog Input type for Store Owner",
description: "attribute's editor component",
})}
label={intl.formatMessage({
defaultMessage: "Catalog Input type for Store Owner",
description: "attribute's editor component"
})}
name="inputType"
onChange={onChange}
value={data.inputType}
@ -99,9 +105,10 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({
<FormSpacer />
<ControlledSwitch
checked={data.valueRequired}
label={intl.formatMessage({defaultMessage: "Value Required",
description: "check to require attribute to have value",
})}
label={intl.formatMessage({
defaultMessage: "Value Required",
description: "check to require attribute to have value"
})}
name={"valueRequired" as keyof AttributePageFormData}
onChange={onChange}
/>

View file

@ -83,37 +83,30 @@ const AttributeList: React.StatelessComponent<AttributeListProps> = ({
toolbar={toolbar}
>
<TableCell className={classes.colSlug}>
<FormattedMessage
defaultMessage="Attribute Code"
/>
<FormattedMessage defaultMessage="Attribute Code" />
</TableCell>
<TableCell className={classes.colName}>
<FormattedMessage
defaultMessage="Default Label"
description="attribute's label'"
/>
</TableCell>
<TableCell className={classes.colVisible}>
<FormattedMessage
defaultMessage="Visible"
description="attribute is visible"
/>
</TableCell>
<TableCell className={classes.colSearchable}>
<FormattedMessage
defaultMessage="Searchable"
description="attribute can be searched in dashboard"
/>
</TableCell>
<TableCell className={classes.colFaceted}>
<FormattedMessage
defaultMessage="Use in faceted search"
description="attribute can be searched in storefront"
/>
</TableCell>
</TableHead>
@ -185,10 +178,7 @@ const AttributeList: React.StatelessComponent<AttributeListProps> = ({
() => (
<TableRow>
<TableCell colSpan={numberOfColumns}>
<FormattedMessage
defaultMessage="No attributes found"
/>
<FormattedMessage defaultMessage="No attributes found" />
</TableCell>
</TableRow>
)

View file

@ -119,8 +119,7 @@ const AttributePage: React.FC<AttributePageProps> = ({
attribute === null
? intl.formatMessage({
defaultMessage: "Create New Attribute",
description: "page title",
description: "page title"
})
: maybe(() => attribute.name)
}

View file

@ -35,15 +35,13 @@ const AttributeValueDeleteDialog: React.FC<AttributeValueDeleteDialogProps> = ({
variant="delete"
title={intl.formatMessage({
defaultMessage: "Delete attribute value",
description: "dialog title",
description: "dialog title"
})}
>
<DialogContentText>
{useName ? (
<FormattedMessage
defaultMessage='Are you sure you want to delete "{ name }" value? If you delete it you wont be able to assign it to any of the products with "{ attributeName }" attribute.'
values={{
attributeName,
name
@ -53,7 +51,6 @@ const AttributeValueDeleteDialog: React.FC<AttributeValueDeleteDialogProps> = ({
<FormattedMessage
defaultMessage='Are you sure you want to delete "{ name }" value?'
description="delete attribute value"
values={{
name
}}

View file

@ -54,13 +54,11 @@ const AttributeValueEditDialog: React.StatelessComponent<
<FormattedMessage
defaultMessage="Add Value"
description="add attribute value"
/>
) : (
<FormattedMessage
defaultMessage="Edit Value"
description="edit attribute value"
/>
)}
</DialogTitle>
@ -77,8 +75,7 @@ const AttributeValueEditDialog: React.StatelessComponent<
name={"name" as keyof AttributeValueEditDialogFormData}
label={intl.formatMessage({
defaultMessage: "Name",
description: "attribute name",
description: "attribute name"
})}
value={data.name}
onChange={change}

View file

@ -70,15 +70,13 @@ const AttributeValues: React.FC<AttributeValuesProps> = ({
<CardTitle
title={intl.formatMessage({
defaultMessage: "Attribute Values",
description: "section header",
description: "section header"
})}
toolbar={
<Button color="primary" variant="text" onClick={onValueAdd}>
<FormattedMessage
defaultMessage="Add value"
description="add attribute value button"
/>
</Button>
}
@ -91,14 +89,12 @@ const AttributeValues: React.FC<AttributeValuesProps> = ({
<FormattedMessage
defaultMessage="Admin"
description="attribute values list: slug column header"
/>
</TableCell>
<TableCell className={classes.columnStore}>
<FormattedMessage
defaultMessage="Default Store View"
description="attribute values list: name column header"
/>
</TableCell>
<TableCell />
@ -137,7 +133,6 @@ const AttributeValues: React.FC<AttributeValuesProps> = ({
<FormattedMessage
defaultMessage="No values found"
description="No attribute values found"
/>
</TableCell>
</TableRow>

View file

@ -67,8 +67,7 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
if (data.attributeDelete.errors.length === 0) {
notify({
text: intl.formatMessage({
defaultMessage: "Attribute deleted",
defaultMessage: "Attribute deleted"
})
});
navigate(attributeListUrl());
@ -79,8 +78,7 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
notify({
text: intl.formatMessage({
defaultMessage: "Value deleted",
description: "attribute value deleted",
description: "attribute value deleted"
})
});
closeModal();
@ -102,8 +100,7 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
notify({
text: intl.formatMessage({
defaultMessage: "Added new value",
description: "added new attribute value",
description: "added new attribute value"
})
});
closeModal();

View file

@ -74,8 +74,7 @@ const AttributeList: React.FC<AttributeListProps> = ({ params }) => {
notify({
text: intl.formatMessage({
defaultMessage: "Attributes successfully delete",
description: "deleted multiple attributes",
description: "deleted multiple attributes"
})
});
reset();

View file

@ -61,8 +61,7 @@ const CategoryBackground: React.FC<CategoryBackgroundProps> = props => {
<CardTitle
title={intl.formatMessage({
defaultMessage: "Background image (optional)",
description: "section header",
description: "section header"
})}
toolbar={
<>

View file

@ -61,8 +61,7 @@ export const CategoryCreatePage: React.StatelessComponent<
<PageHeader
title={intl.formatMessage({
defaultMessage: "Create New Category",
description: "page header",
description: "page header"
})}
/>
<div>
@ -76,8 +75,7 @@ export const CategoryCreatePage: React.StatelessComponent<
<SeoForm
helperText={intl.formatMessage({
defaultMessage:
"Add search engine title and description to make this category easier to find",
"Add search engine title and description to make this category easier to find"
})}
title={data.seoTitle}
titlePlaceholder={data.name}

View file

@ -41,7 +41,6 @@ const CategoryDeleteDialog = withStyles(styles, {
<FormattedMessage
defaultMessage="Delete category"
description="dialog title"
/>
</DialogTitle>
<DialogContent>
@ -49,7 +48,6 @@ const CategoryDeleteDialog = withStyles(styles, {
<FormattedMessage
defaultMessage="Are you sure you want to delete {categoryName}?"
description="delete category"
values={{
categoryName: <strong>{name}</strong>
}}

View file

@ -54,8 +54,7 @@ export const CategoryDetailsForm = withStyles(styles, {
<TextField
classes={{ root: classes.root }}
label={intl.formatMessage({
defaultMessage: "Category Name",
defaultMessage: "Category Name"
})}
name="name"
disabled={disabled}
@ -71,8 +70,7 @@ export const CategoryDetailsForm = withStyles(styles, {
error={!!errors.descriptionJson}
helperText={errors.descriptionJson}
label={intl.formatMessage({
defaultMessage: "Category Description",
defaultMessage: "Category Description"
})}
initial={maybe(() => JSON.parse(category.descriptionJson))}
name="description"

View file

@ -96,15 +96,13 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
<CardTitle
title={intl.formatMessage({
defaultMessage: "All Subcategories",
description: "section header",
description: "section header"
})}
toolbar={
<Button color="primary" variant="text" onClick={onAdd}>
<FormattedMessage
defaultMessage="Add subcategory"
description="button"
/>
</Button>
}
@ -120,23 +118,18 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
toolbar={toolbar}
>
<TableCell className={classes.colName}>
<FormattedMessage
defaultMessage="Category Name"
/>
<FormattedMessage defaultMessage="Category Name" />
</TableCell>
<TableCell className={classes.colSubcategories}>
<FormattedMessage
defaultMessage="Subcategories"
description="number of subcategories"
/>
</TableCell>
<TableCell className={classes.colProducts}>
<FormattedMessage
defaultMessage="No. of Products"
description="number of products"
/>
</TableCell>
</TableHead>
@ -207,15 +200,9 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
<TableRow>
<TableCell colSpan={numberOfColumns}>
{isRoot ? (
<FormattedMessage
defaultMessage="No categories found"
/>
<FormattedMessage defaultMessage="No categories found" />
) : (
<FormattedMessage
defaultMessage="No subcategories found"
/>
<FormattedMessage defaultMessage="No subcategories found" />
)}
</TableCell>
</TableRow>

View file

@ -46,7 +46,6 @@ export const CategoryListPage: React.StatelessComponent<CategoryTableProps> = ({
<FormattedMessage
defaultMessage="Add category"
description="button"
/>
<AddIcon />
</Button>

View file

@ -69,15 +69,13 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
<CardTitle
title={intl.formatMessage({
defaultMessage: "Products",
description: "section header",
description: "section header"
})}
toolbar={
<Button variant="text" color="primary" onClick={onAddProduct}>
<FormattedMessage
defaultMessage="Add product"
description="button"
/>
</Button>
}
@ -90,13 +88,13 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
<FormattedMessage
defaultMessage="Name"
description="product name"
/>
</TableCell>
<TableCell>
<FormattedMessage defaultMessage="Type"
<FormattedMessage
defaultMessage="Type"
description="product type"
/>
/>
</TableCell>
</TableRow>
</TableHead>
@ -143,8 +141,7 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
() => (
<TableRow>
<TableCell colSpan={3}>
<FormattedMessage defaultMessage="No products found"
/>
<FormattedMessage defaultMessage="No products found" />
</TableCell>
</TableRow>
)

View file

@ -145,8 +145,7 @@ export const CategoryUpdatePage: React.StatelessComponent<
<SeoForm
helperText={intl.formatMessage({
defaultMessage:
"Add search engine title and description to make this category easier to find",
"Add search engine title and description to make this category easier to find"
})}
title={data.seoTitle}
titlePlaceholder={data.name}
@ -162,17 +161,19 @@ export const CategoryUpdatePage: React.StatelessComponent<
isActive={currentTab === CategoryPageTab.categories}
changeTab={changeTab}
>
<FormattedMessage defaultMessage="Subcategories"
<FormattedMessage
defaultMessage="Subcategories"
description="number of subcategories in category"
/>
/>
</CategoriesTab>
<ProductsTab
isActive={currentTab === CategoryPageTab.products}
changeTab={changeTab}
>
<FormattedMessage defaultMessage="Products"
<FormattedMessage
defaultMessage="Products"
description="number of products in category"
/>
/>
</ProductsTab>
</TabContainer>
<CardSpacer />

View file

@ -25,8 +25,7 @@ export const CategoryCreateView: React.StatelessComponent<
if (data.categoryCreate.errors.length === 0) {
notify({
text: intl.formatMessage({
defaultMessage: "Category created",
defaultMessage: "Category created"
})
});
navigate(categoryUrl(data.categoryCreate.category.id));
@ -51,8 +50,7 @@ export const CategoryCreateView: React.StatelessComponent<
<WindowTitle
title={intl.formatMessage({
defaultMessage: "Create category",
description: "window title",
description: "window title"
})}
/>
<CategoryCreatePage

View file

@ -77,8 +77,7 @@ const CollectionCreatePage: React.StatelessComponent<
<PageHeader
title={intl.formatMessage({
defaultMessage: "Add collection",
description: "page header",
description: "page header"
})}
/>
<Grid>
@ -132,8 +131,7 @@ const CollectionCreatePage: React.StatelessComponent<
descriptionPlaceholder=""
helperText={intl.formatMessage({
defaultMessage:
"Add search engine title and description to make this collection easier to find",
"Add search engine title and description to make this collection easier to find"
})}
title={data.seoTitle}
titlePlaceholder={data.name}

View file

@ -52,8 +52,7 @@ const CollectionDetails = withStyles(styles, { name: "CollectionDetails" })(
classes={{ root: classes.name }}
label={intl.formatMessage({
defaultMessage: "Name",
description: "collection name",
description: "collection name"
})}
name="name"
disabled={disabled}

View file

@ -111,8 +111,7 @@ const CollectionDetailsPage: React.StatelessComponent<
descriptionPlaceholder=""
helperText={intl.formatMessage({
defaultMessage:
"Add search engine title and description to make this collection easier to find",
"Add search engine title and description to make this collection easier to find"
})}
title={data.seoTitle}
titlePlaceholder={maybe(() => collection.name)}
@ -134,8 +133,7 @@ const CollectionDetailsPage: React.StatelessComponent<
onChange={change}
label={intl.formatMessage({
defaultMessage: "Feature on Homepage",
description: "switch button",
description: "switch button"
})}
/>
</VisibilityCard>

View file

@ -81,8 +81,7 @@ export const CollectionImage = withStyles(styles)(
<CardTitle
title={intl.formatMessage({
defaultMessage: "Background image (optional)",
description: "section header",
description: "section header"
})}
toolbar={
<>

View file

@ -83,17 +83,16 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
toolbar={toolbar}
>
<TableCell className={classes.colName}>
<FormattedMessage defaultMessage="Category Name"
/>
<FormattedMessage defaultMessage="Category Name" />
</TableCell>
<TableCell className={classes.colProducts}>
<FormattedMessage defaultMessage="No. of Products"
/>
<FormattedMessage defaultMessage="No. of Products" />
</TableCell>
<TableCell className={classes.colAvailability}>
<FormattedMessage defaultMessage="Availability"
<FormattedMessage
defaultMessage="Availability"
description="collection availability"
/>
/>
</TableCell>
</TableHead>
<TableFooter>
@ -159,13 +158,11 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
collection.isPublished
? intl.formatMessage({
defaultMessage: "Published",
description: "collection is published",
description: "collection is published"
})
: intl.formatMessage({
defaultMessage: "Not published",
description: "collection is not published",
description: "collection is not published"
})
}
/>
@ -179,8 +176,7 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
() => (
<TableRow>
<TableCell colSpan={numberOfColumns}>
<FormattedMessage defaultMessage="No collections found"
/>
<FormattedMessage defaultMessage="No collections found" />
</TableCell>
</TableRow>
)

View file

@ -30,9 +30,10 @@ const CollectionListPage: React.StatelessComponent<CollectionListPageProps> = ({
variant="contained"
onClick={onAdd}
>
<FormattedMessage defaultMessage="Add collection"
<FormattedMessage
defaultMessage="Add collection"
description="button"
/>
/>
<AddIcon />
</Button>
</PageHeader>

View file

@ -31,30 +31,28 @@ import {
} from "../types/UnassignCollectionProduct";
interface CollectionUpdateOperationsProps {
children: (
props: {
updateCollectionWithHomepage: PartialMutationProviderOutput<
CollectionUpdateWithHomepage,
CollectionUpdateWithHomepageVariables
>;
assignProduct: PartialMutationProviderOutput<
CollectionAssignProduct,
CollectionAssignProductVariables
>;
unassignProduct: PartialMutationProviderOutput<
UnassignCollectionProduct,
UnassignCollectionProductVariables
>;
updateCollection: PartialMutationProviderOutput<
CollectionUpdate,
CollectionUpdateVariables
>;
removeCollection: PartialMutationProviderOutput<
RemoveCollection,
RemoveCollectionVariables
>;
}
) => React.ReactNode;
children: (props: {
updateCollectionWithHomepage: PartialMutationProviderOutput<
CollectionUpdateWithHomepage,
CollectionUpdateWithHomepageVariables
>;
assignProduct: PartialMutationProviderOutput<
CollectionAssignProduct,
CollectionAssignProductVariables
>;
unassignProduct: PartialMutationProviderOutput<
UnassignCollectionProduct,
UnassignCollectionProductVariables
>;
updateCollection: PartialMutationProviderOutput<
CollectionUpdate,
CollectionUpdateVariables
>;
removeCollection: PartialMutationProviderOutput<
RemoveCollection,
RemoveCollectionVariables
>;
}) => React.ReactNode;
onUpdate: (data: CollectionUpdate) => void;
onProductAssign: (data: CollectionAssignProduct) => void;
onProductUnassign: (data: UnassignCollectionProduct) => void;

View file

@ -20,8 +20,7 @@ export const CollectionCreate: React.FC = () => {
if (data.collectionCreate.errors.length === 0) {
notify({
text: intl.formatMessage({
defaultMessage: "Created collection",
defaultMessage: "Created collection"
})
});
navigate(collectionUrl(data.collectionCreate.collection.id));
@ -50,8 +49,7 @@ export const CollectionCreate: React.FC = () => {
<WindowTitle
title={intl.formatMessage({
defaultMessage: "Create collection",
description: "window title",
description: "window title"
})}
/>
<CollectionCreatePage