Fix types
This commit is contained in:
parent
636ddca9e3
commit
7ce4008c47
4 changed files with 1562 additions and 1077 deletions
|
@ -11,16 +11,20 @@ import PageHeader from "@saleor/components/PageHeader";
|
|||
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
||||
import { sectionNames } from "@saleor/intl";
|
||||
import { UserError } from "../../../types";
|
||||
import { SaleType } from "../../../types/globalTypes";
|
||||
import { SaleType as SaleTypeEnum } from "../../../types/globalTypes";
|
||||
import DiscountDates from "../DiscountDates";
|
||||
import SaleInfo from "../SaleInfo";
|
||||
import SalePricing from "../SalePricing";
|
||||
import SaleType from "../SaleType";
|
||||
|
||||
export interface FormData {
|
||||
endDate: string;
|
||||
endTime: string;
|
||||
hasEndDate: boolean;
|
||||
name: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
startTime: string;
|
||||
type: SaleTypeEnum;
|
||||
value: string;
|
||||
type: SaleType;
|
||||
}
|
||||
|
||||
export interface SaleCreatePageProps {
|
||||
|
@ -44,9 +48,12 @@ const SaleCreatePage: React.StatelessComponent<SaleCreatePageProps> = ({
|
|||
|
||||
const initialForm: FormData = {
|
||||
endDate: "",
|
||||
endTime: "",
|
||||
hasEndDate: false,
|
||||
name: "",
|
||||
startDate: "",
|
||||
type: SaleType.FIXED,
|
||||
startTime: "",
|
||||
type: SaleTypeEnum.FIXED,
|
||||
value: ""
|
||||
};
|
||||
return (
|
||||
|
@ -71,10 +78,12 @@ const SaleCreatePage: React.StatelessComponent<SaleCreatePageProps> = ({
|
|||
onChange={change}
|
||||
/>
|
||||
<CardSpacer />
|
||||
<SalePricing
|
||||
<SaleType data={data} disabled={disabled} onChange={change} />
|
||||
<CardSpacer />
|
||||
<DiscountDates
|
||||
data={data}
|
||||
defaultCurrency={defaultCurrency}
|
||||
disabled={disabled}
|
||||
defaultCurrency={defaultCurrency}
|
||||
errors={formErrors}
|
||||
onChange={change}
|
||||
/>
|
||||
|
|
|
@ -162,7 +162,7 @@ const ProductVariantCreatePrices: React.FC<
|
|||
<Hr className={classes.hrAttribute} />
|
||||
{priceAttributeValues &&
|
||||
priceAttributeValues.map(attributeValue => (
|
||||
<>
|
||||
<React.Fragment key={attributeValue.id}>
|
||||
<FormSpacer />
|
||||
<Grid variant="uniform">
|
||||
<div className={classes.label}>
|
||||
|
@ -198,7 +198,7 @@ const ProductVariantCreatePrices: React.FC<
|
|||
/>
|
||||
</div>
|
||||
</Grid>
|
||||
</>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
|
@ -272,7 +272,7 @@ const ProductVariantCreatePrices: React.FC<
|
|||
<Hr className={classes.hrAttribute} />
|
||||
{stockAttributeValues &&
|
||||
stockAttributeValues.map(attributeValue => (
|
||||
<>
|
||||
<React.Fragment key={attributeValue.id}>
|
||||
<FormSpacer />
|
||||
<Grid variant="uniform">
|
||||
<div className={classes.label}>
|
||||
|
@ -301,7 +301,7 @@ const ProductVariantCreatePrices: React.FC<
|
|||
/>
|
||||
</div>
|
||||
</Grid>
|
||||
</>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
|
|
|
@ -200,6 +200,7 @@ const ProductVariantCreateSummary: React.FC<
|
|||
style={{
|
||||
color: colors[valueIndex % colors.length]
|
||||
}}
|
||||
key={value}
|
||||
>
|
||||
{value}
|
||||
</span>
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue