import { ChannelCollectionData } from "@saleor/channels/utils"; import AppHeader from "@saleor/components/AppHeader"; import { AvailabilityCard } from "@saleor/components/AvailabilityCard"; import { CardSpacer } from "@saleor/components/CardSpacer"; import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton"; import { Container } from "@saleor/components/Container"; import Grid from "@saleor/components/Grid"; import Metadata from "@saleor/components/Metadata"; import PageHeader from "@saleor/components/PageHeader"; import SaveButtonBar from "@saleor/components/SaveButtonBar"; import SeoForm from "@saleor/components/SeoForm"; import { CollectionChannelListingErrorFragment } from "@saleor/fragments/types/CollectionChannelListingErrorFragment"; import { CollectionErrorFragment } from "@saleor/fragments/types/CollectionErrorFragment"; import { SubmitPromise } from "@saleor/hooks/useForm"; import { sectionNames } from "@saleor/intl"; import React from "react"; import { useIntl } from "react-intl"; import CollectionDetails from "../CollectionDetails/CollectionDetails"; import { CollectionImage } from "../CollectionImage/CollectionImage"; import CollectionCreateForm, { CollectionCreateData } from "./form"; export interface CollectionCreatePageProps { channelsCount: number; channelsErrors: CollectionChannelListingErrorFragment[]; currentChannels: ChannelCollectionData[]; disabled: boolean; errors: CollectionErrorFragment[]; saveButtonBarState: ConfirmButtonTransitionState; onBack: () => void; onSubmit: (data: CollectionCreateData) => SubmitPromise; onChannelsChange: (data: ChannelCollectionData[]) => void; openChannelsModal: () => void; } const CollectionCreatePage: React.FC = ({ channelsCount, channelsErrors, currentChannels = [], disabled, errors, saveButtonBarState, onBack, onChannelsChange, openChannelsModal, onSubmit }: CollectionCreatePageProps) => { const intl = useIntl(); return ( {({ change, data, handlers, hasChanged, submit }) => ( {intl.formatMessage(sectionNames.collections)}
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} />
)}
); }; CollectionCreatePage.displayName = "CollectionCreatePage"; export default CollectionCreatePage;