Fix small issues
This commit is contained in:
parent
9879990fcc
commit
4cc48250b2
12 changed files with 161 additions and 196 deletions
|
@ -104,7 +104,7 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({
|
||||||
/>
|
/>
|
||||||
<FormSpacer />
|
<FormSpacer />
|
||||||
<ControlledCheckbox
|
<ControlledCheckbox
|
||||||
name={"valueRequired" as keyof FormData}
|
name={"valueRequired" as keyof AttributePageFormData}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
defaultMessage: "Value Required",
|
defaultMessage: "Value Required",
|
||||||
description: "check to require attribute to have value"
|
description: "check to require attribute to have value"
|
||||||
|
|
|
@ -76,7 +76,7 @@ const AttributeValues: React.FC<AttributeValuesProps> = ({
|
||||||
<Button color="primary" variant="text" onClick={onValueAdd}>
|
<Button color="primary" variant="text" onClick={onValueAdd}>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
defaultMessage="Assign value"
|
defaultMessage="Assign value"
|
||||||
description="add attribute value button"
|
description="assign attribute value button"
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Card from "@material-ui/core/Card";
|
import Card from "@material-ui/core/Card";
|
||||||
import CardContent from "@material-ui/core/CardContent";
|
import CardContent from "@material-ui/core/CardContent";
|
||||||
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
|
|
||||||
import TextField from "@material-ui/core/TextField";
|
import TextField from "@material-ui/core/TextField";
|
||||||
import { RawDraftContentState } from "draft-js";
|
import { RawDraftContentState } from "draft-js";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
@ -13,13 +12,7 @@ import { commonMessages } from "@saleor/intl";
|
||||||
import { maybe } from "../../../misc";
|
import { maybe } from "../../../misc";
|
||||||
import { CategoryDetails_category } from "../../types/CategoryDetails";
|
import { CategoryDetails_category } from "../../types/CategoryDetails";
|
||||||
|
|
||||||
const styles = createStyles({
|
interface CategoryDetailsFormProps {
|
||||||
root: {
|
|
||||||
width: "100%"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
interface CategoryDetailsFormProps extends WithStyles<typeof styles> {
|
|
||||||
category?: CategoryDetails_category;
|
category?: CategoryDetails_category;
|
||||||
data: {
|
data: {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -30,57 +23,52 @@ interface CategoryDetailsFormProps extends WithStyles<typeof styles> {
|
||||||
onChange: (event: React.ChangeEvent<any>) => void;
|
onChange: (event: React.ChangeEvent<any>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CategoryDetailsForm = withStyles(styles, {
|
export const CategoryDetailsForm = ({
|
||||||
name: "CategoryDetailsForm"
|
category,
|
||||||
})(
|
classes,
|
||||||
({
|
disabled,
|
||||||
category,
|
data,
|
||||||
classes,
|
onChange,
|
||||||
disabled,
|
errors
|
||||||
data,
|
}: CategoryDetailsFormProps) => {
|
||||||
onChange,
|
const intl = useIntl();
|
||||||
errors
|
|
||||||
}: CategoryDetailsFormProps) => {
|
|
||||||
const intl = useIntl();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardTitle
|
<CardTitle
|
||||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||||
/>
|
/>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
<TextField
|
<TextField
|
||||||
classes={{ root: classes.root }}
|
|
||||||
label={intl.formatMessage({
|
|
||||||
defaultMessage: "Category Name"
|
|
||||||
})}
|
|
||||||
name="name"
|
|
||||||
disabled={disabled}
|
|
||||||
value={data && data.name}
|
|
||||||
onChange={onChange}
|
|
||||||
error={!!errors.name}
|
|
||||||
helperText={errors.name}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<FormSpacer />
|
|
||||||
<RichTextEditor
|
|
||||||
disabled={disabled}
|
|
||||||
error={!!errors.descriptionJson}
|
|
||||||
helperText={errors.descriptionJson}
|
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
defaultMessage: "Category Description"
|
defaultMessage: "Category Name"
|
||||||
})}
|
})}
|
||||||
initial={maybe(() => JSON.parse(category.descriptionJson))}
|
name="name"
|
||||||
name="description"
|
disabled={disabled}
|
||||||
|
value={data && data.name}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
error={!!errors.name}
|
||||||
|
helperText={errors.name}
|
||||||
|
fullWidth
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
</CardContent>
|
<FormSpacer />
|
||||||
</Card>
|
<RichTextEditor
|
||||||
);
|
disabled={disabled}
|
||||||
}
|
error={!!errors.descriptionJson}
|
||||||
);
|
helperText={errors.descriptionJson}
|
||||||
CategoryDetailsForm.displayName = "CategoryDetailsForm";
|
label={intl.formatMessage({
|
||||||
|
defaultMessage: "Category Description"
|
||||||
|
})}
|
||||||
|
initial={maybe(() => JSON.parse(category.descriptionJson))}
|
||||||
|
name="description"
|
||||||
|
onChange={onChange}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
export default CategoryDetailsForm;
|
export default CategoryDetailsForm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Card from "@material-ui/core/Card";
|
import Card from "@material-ui/core/Card";
|
||||||
import CardContent from "@material-ui/core/CardContent";
|
import CardContent from "@material-ui/core/CardContent";
|
||||||
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
|
|
||||||
import TextField from "@material-ui/core/TextField";
|
import TextField from "@material-ui/core/TextField";
|
||||||
import { RawDraftContentState } from "draft-js";
|
import { RawDraftContentState } from "draft-js";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
@ -14,13 +13,7 @@ import { maybe } from "@saleor/misc";
|
||||||
import { FormErrors } from "@saleor/types";
|
import { FormErrors } from "@saleor/types";
|
||||||
import { CollectionDetails_collection } from "../../types/CollectionDetails";
|
import { CollectionDetails_collection } from "../../types/CollectionDetails";
|
||||||
|
|
||||||
const styles = createStyles({
|
export interface CollectionDetailsProps {
|
||||||
name: {
|
|
||||||
width: "100%"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export interface CollectionDetailsProps extends WithStyles<typeof styles> {
|
|
||||||
collection?: CollectionDetails_collection;
|
collection?: CollectionDetails_collection;
|
||||||
data: {
|
data: {
|
||||||
description: RawDraftContentState;
|
description: RawDraftContentState;
|
||||||
|
@ -31,50 +24,47 @@ export interface CollectionDetailsProps extends WithStyles<typeof styles> {
|
||||||
onChange: (event: React.ChangeEvent<any>) => void;
|
onChange: (event: React.ChangeEvent<any>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CollectionDetails = withStyles(styles, { name: "CollectionDetails" })(
|
const CollectionDetails = ({
|
||||||
({
|
classes,
|
||||||
classes,
|
collection,
|
||||||
collection,
|
disabled,
|
||||||
disabled,
|
data,
|
||||||
data,
|
onChange,
|
||||||
onChange,
|
errors
|
||||||
errors
|
}: CollectionDetailsProps) => {
|
||||||
}: CollectionDetailsProps) => {
|
const intl = useIntl();
|
||||||
const intl = useIntl();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardTitle
|
<CardTitle
|
||||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||||
|
/>
|
||||||
|
<CardContent>
|
||||||
|
<TextField
|
||||||
|
label={intl.formatMessage({
|
||||||
|
defaultMessage: "Name",
|
||||||
|
description: "collection name"
|
||||||
|
})}
|
||||||
|
name="name"
|
||||||
|
disabled={disabled}
|
||||||
|
value={data.name}
|
||||||
|
onChange={onChange}
|
||||||
|
error={!!errors.name}
|
||||||
|
helperText={errors.name}
|
||||||
|
fullWidth
|
||||||
/>
|
/>
|
||||||
<CardContent>
|
<FormSpacer />
|
||||||
<TextField
|
<RichTextEditor
|
||||||
classes={{ root: classes.name }}
|
error={!!errors.descriptionJson}
|
||||||
label={intl.formatMessage({
|
helperText={errors.descriptionJson}
|
||||||
defaultMessage: "Name",
|
initial={maybe(() => JSON.parse(collection.descriptionJson))}
|
||||||
description: "collection name"
|
label={intl.formatMessage(commonMessages.description)}
|
||||||
})}
|
name="description"
|
||||||
name="name"
|
disabled={disabled}
|
||||||
disabled={disabled}
|
onChange={onChange}
|
||||||
value={data.name}
|
/>
|
||||||
onChange={onChange}
|
</CardContent>
|
||||||
error={!!errors.name}
|
</Card>
|
||||||
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;
|
export default CollectionDetails;
|
||||||
|
|
|
@ -127,7 +127,7 @@ const CollectionDetailsPage: React.StatelessComponent<
|
||||||
onChange={change}
|
onChange={change}
|
||||||
>
|
>
|
||||||
<ControlledCheckbox
|
<ControlledCheckbox
|
||||||
name={"isFeatured" as keyof FormData}
|
name={"isFeatured" as keyof CollectionDetailsPageFormData}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
defaultMessage: "Feature on Homepage",
|
defaultMessage: "Feature on Homepage",
|
||||||
description: "switch button"
|
description: "switch button"
|
||||||
|
|
|
@ -21,12 +21,12 @@ const styles = createStyles({
|
||||||
},
|
},
|
||||||
radioLabel: {
|
radioLabel: {
|
||||||
"& > span": {
|
"& > span": {
|
||||||
"& > span": {
|
|
||||||
display: "block",
|
|
||||||
fontSize: "12px"
|
|
||||||
},
|
|
||||||
padding: "6px"
|
padding: "6px"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
secondLabel: {
|
||||||
|
display: "block",
|
||||||
|
fontSize: "12px"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -77,22 +77,22 @@ export const RadioGroupField = withStyles(styles, {
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
>
|
>
|
||||||
{choices.length > 0 ? (
|
{choices.length > 0 ? (
|
||||||
choices.map(choice => {
|
choices.map(choice => (
|
||||||
return (
|
<FormControlLabel
|
||||||
<FormControlLabel
|
value={choice.value}
|
||||||
value={choice.value}
|
className={classes.radioLabel}
|
||||||
className={classes.radioLabel}
|
control={<Radio color="primary" />}
|
||||||
control={<Radio color="primary" />}
|
label={
|
||||||
label={
|
<>
|
||||||
<>
|
{choice.label}
|
||||||
{choice.label}
|
<span className={classes.secondLabel}>
|
||||||
<span>{choice.secondLabel}</span>
|
{choice.secondLabel}
|
||||||
</>
|
</span>
|
||||||
}
|
</>
|
||||||
key={choice.value}
|
}
|
||||||
/>
|
key={choice.value}
|
||||||
);
|
/>
|
||||||
})
|
))
|
||||||
) : (
|
) : (
|
||||||
<MenuItem disabled={true}>
|
<MenuItem disabled={true}>
|
||||||
<FormattedMessage defaultMessage="No results found" />
|
<FormattedMessage defaultMessage="No results found" />
|
||||||
|
|
|
@ -37,12 +37,6 @@ const styles = (theme: Theme) =>
|
||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
paddingTop: "15px",
|
paddingTop: "15px",
|
||||||
textDecoration: "underline"
|
textDecoration: "underline"
|
||||||
},
|
|
||||||
switchContainer: {
|
|
||||||
"& > div": {
|
|
||||||
padding: 0
|
|
||||||
},
|
|
||||||
marginBottom: -theme.spacing.unit
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -154,8 +148,10 @@ export const VisibilityCard = withStyles(styles, {
|
||||||
className={classes.setPublicationDate}
|
className={classes.setPublicationDate}
|
||||||
onClick={() => setPublicationDate(!isPublicationDate)}
|
onClick={() => setPublicationDate(!isPublicationDate)}
|
||||||
>
|
>
|
||||||
{" "}
|
{intl.formatMessage({
|
||||||
Set publication date
|
defaultMessage: "Set publication date",
|
||||||
|
description: "set publication date"
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{isPublicationDate && (
|
{isPublicationDate && (
|
||||||
|
|
|
@ -4,8 +4,8 @@ import React from "react";
|
||||||
export const Attributes = createSvgIcon(
|
export const Attributes = createSvgIcon(
|
||||||
<>
|
<>
|
||||||
<path
|
<path
|
||||||
fill-rule="evenodd"
|
fillRule="evenodd"
|
||||||
clip-rule="evenodd"
|
clipRule="evenodd"
|
||||||
d="M37.9487 10.4808C37.9487 14.4459 34.7343 17.6603 30.7692 17.6603C26.8041 17.6603 23.5897 14.4459 23.5897 10.4808C23.5897 6.51565 26.8041 3.30128 30.7692 3.30128C34.7343 3.30128 37.9487 6.51565 37.9487 10.4808ZM40 10.4808C40 15.5788 35.8672 19.7115 30.7692 19.7115C25.6712 19.7115 21.5385 15.5788 21.5385 10.4808C21.5385 5.38275 25.6712 1.25 30.7692 1.25C35.8672 1.25 40 5.38275 40 10.4808ZM16.4103 9.45484H2.05128V23.8138H16.4103V9.45484ZM0 7.40356V25.8651H18.4615V7.40356H0ZM24.6154 20.7371L13.9566 39.1987H35.2741L24.6154 20.7371ZM24.6154 24.8397L17.5095 37.1474H31.7212L24.6154 24.8397Z"
|
d="M37.9487 10.4808C37.9487 14.4459 34.7343 17.6603 30.7692 17.6603C26.8041 17.6603 23.5897 14.4459 23.5897 10.4808C23.5897 6.51565 26.8041 3.30128 30.7692 3.30128C34.7343 3.30128 37.9487 6.51565 37.9487 10.4808ZM40 10.4808C40 15.5788 35.8672 19.7115 30.7692 19.7115C25.6712 19.7115 21.5385 15.5788 21.5385 10.4808C21.5385 5.38275 25.6712 1.25 30.7692 1.25C35.8672 1.25 40 5.38275 40 10.4808ZM16.4103 9.45484H2.05128V23.8138H16.4103V9.45484ZM0 7.40356V25.8651H18.4615V7.40356H0ZM24.6154 20.7371L13.9566 39.1987H35.2741L24.6154 20.7371ZM24.6154 24.8397L17.5095 37.1474H31.7212L24.6154 24.8397Z"
|
||||||
fill="#06847B"
|
fill="#06847B"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -54,7 +54,7 @@ export const PageCreate: React.StatelessComponent<PageCreateProps> = () => {
|
||||||
page={null}
|
page={null}
|
||||||
onBack={() => navigate(pageListUrl())}
|
onBack={() => navigate(pageListUrl())}
|
||||||
onRemove={() => undefined}
|
onRemove={() => undefined}
|
||||||
onSubmit={formData => {
|
onSubmit={formData =>
|
||||||
pageCreate({
|
pageCreate({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
|
@ -77,8 +77,8 @@ export const PageCreate: React.StatelessComponent<PageCreateProps> = () => {
|
||||||
title: formData.title
|
title: formData.title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}}
|
}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -36,7 +36,7 @@ const ProductTypeListPage: React.StatelessComponent<
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
defaultMessage="create product type"
|
defaultMessage="create product type"
|
||||||
description="button"
|
description="button"
|
||||||
/>{" "}
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
<ProductTypeList disabled={disabled} {...listProps} />
|
<ProductTypeList disabled={disabled} {...listProps} />
|
||||||
|
|
|
@ -25,7 +25,7 @@ const styles = (theme: Theme) =>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
interface ProductDetailsFormProps extends WithStyles<typeof styles> {
|
interface ProductDetailsFormProps {
|
||||||
data: {
|
data: {
|
||||||
description: RawDraftContentState;
|
description: RawDraftContentState;
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -39,54 +39,47 @@ interface ProductDetailsFormProps extends WithStyles<typeof styles> {
|
||||||
onChange(event: any);
|
onChange(event: any);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProductDetailsForm = withStyles(styles, {
|
export const ProductDetailsForm = ({
|
||||||
name: "ProductDetailsForm"
|
classes,
|
||||||
})(
|
data,
|
||||||
({
|
disabled,
|
||||||
classes,
|
errors,
|
||||||
data,
|
initialDescription,
|
||||||
disabled,
|
onChange
|
||||||
errors,
|
}: ProductDetailsFormProps) => {
|
||||||
initialDescription,
|
const intl = useIntl();
|
||||||
onChange
|
|
||||||
}: ProductDetailsFormProps) => {
|
|
||||||
const intl = useIntl();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardTitle
|
<CardTitle
|
||||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||||
|
/>
|
||||||
|
<CardContent>
|
||||||
|
<TextField
|
||||||
|
error={!!errors.name}
|
||||||
|
helperText={errors.name}
|
||||||
|
disabled={disabled}
|
||||||
|
fullWidth
|
||||||
|
label={intl.formatMessage({
|
||||||
|
defaultMessage: "Name",
|
||||||
|
description: "product name"
|
||||||
|
})}
|
||||||
|
name="name"
|
||||||
|
value={data.name}
|
||||||
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
<CardContent>
|
<FormSpacer />
|
||||||
<div className={classes.root}>
|
<RichTextEditor
|
||||||
<TextField
|
disabled={disabled}
|
||||||
error={!!errors.name}
|
error={!!errors.descriptionJson}
|
||||||
helperText={errors.name}
|
helperText={errors.descriptionJson}
|
||||||
disabled={disabled}
|
initial={initialDescription}
|
||||||
fullWidth
|
label={intl.formatMessage(commonMessages.description)}
|
||||||
label={intl.formatMessage({
|
name="description"
|
||||||
defaultMessage: "Name",
|
onChange={onChange}
|
||||||
description: "product name"
|
/>
|
||||||
})}
|
</CardContent>
|
||||||
name="name"
|
</Card>
|
||||||
value={data.name}
|
);
|
||||||
onChange={onChange}
|
};
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<FormSpacer />
|
|
||||||
<RichTextEditor
|
|
||||||
disabled={disabled}
|
|
||||||
error={!!errors.descriptionJson}
|
|
||||||
helperText={errors.descriptionJson}
|
|
||||||
initial={initialDescription}
|
|
||||||
label={intl.formatMessage(commonMessages.description)}
|
|
||||||
name="description"
|
|
||||||
onChange={onChange}
|
|
||||||
/>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
ProductDetailsForm.displayName = "ProductDetailsForm";
|
|
||||||
export default ProductDetailsForm;
|
export default ProductDetailsForm;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// import Button from "@material-ui/core/Button";
|
|
||||||
//
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useIntl } from "react-intl";
|
import { useIntl } from "react-intl";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue