2019-08-09 10:26:22 +00:00
|
|
|
import React from "react";
|
2019-08-26 21:26:36 +00:00
|
|
|
import { useIntl } from "react-intl";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
import AppHeader from "@saleor/components/AppHeader";
|
|
|
|
import Container from "@saleor/components/Container";
|
|
|
|
import Grid from "@saleor/components/Grid";
|
|
|
|
import PageHeader from "@saleor/components/PageHeader";
|
2019-08-26 21:26:36 +00:00
|
|
|
import { sectionNames } from "@saleor/intl";
|
2019-08-09 11:14:35 +00:00
|
|
|
import { ListActions, PageListProps } from "@saleor/types";
|
|
|
|
import { WeightUnitsEnum } from "@saleor/types/globalTypes";
|
2019-06-19 14:40:52 +00:00
|
|
|
import { ShippingZoneFragment } from "../../types/ShippingZoneFragment";
|
|
|
|
import ShippingWeightUnitForm from "../ShippingWeightUnitForm";
|
|
|
|
import ShippingZonesList from "../ShippingZonesList";
|
|
|
|
|
|
|
|
export interface ShippingZonesListPageProps extends PageListProps, ListActions {
|
|
|
|
defaultWeightUnit: WeightUnitsEnum;
|
|
|
|
shippingZones: ShippingZoneFragment[];
|
|
|
|
onBack: () => void;
|
|
|
|
onRemove: (id: string) => void;
|
|
|
|
onSubmit: (unit: WeightUnitsEnum) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ShippingZonesListPage: React.StatelessComponent<
|
|
|
|
ShippingZonesListPageProps
|
2019-08-26 21:26:36 +00:00
|
|
|
> = ({ defaultWeightUnit, disabled, onBack, onSubmit, ...listProps }) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Container>
|
|
|
|
<AppHeader onBack={onBack}>
|
|
|
|
{intl.formatMessage(sectionNames.configuration)}
|
|
|
|
</AppHeader>
|
|
|
|
<PageHeader
|
|
|
|
title={intl.formatMessage({
|
|
|
|
defaultMessage: "Shipping",
|
|
|
|
description: "header"
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
<Grid>
|
|
|
|
<div>
|
|
|
|
<ShippingZonesList disabled={disabled} {...listProps} />
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<ShippingWeightUnitForm
|
|
|
|
defaultWeightUnit={defaultWeightUnit}
|
|
|
|
disabled={disabled}
|
|
|
|
onSubmit={onSubmit}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</Grid>
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
};
|
2019-06-19 14:40:52 +00:00
|
|
|
ShippingZonesListPage.displayName = "ShippingZonesListPage";
|
|
|
|
export default ShippingZonesListPage;
|