import { AppPaper } from "../../ui/app-paper"; import { FormControlLabel, Grid, Paper, Radio, RadioGroup, Typography } from "@material-ui/core"; import { Skeleton } from "@material-ui/lab"; import { ChannelConfigurationForm } from "./channel-configuration-form"; import { MergedChannelSchema, ProvidersSchema, SingleChannelSchema, SingleProviderSchema, } from "../../../lib/cms/config"; import { ChannelsErrors, ChannelsLoading } from "./types"; import { makeStyles } from "@saleor/macaw-ui"; import { AppTabNavButton } from "../../ui/app-tab-nav-button"; const useStyles = makeStyles((theme) => ({ textCenter: { textAlign: "center", }, })); const ChannelConfigurationSkeleton = () => { return (
); }; interface ChannelConfigurationProps { activeChannel?: MergedChannelSchema | null; providerInstances: SingleProviderSchema[]; saveChannel: (channel: SingleChannelSchema) => any; loading: ChannelsLoading; errors: ChannelsErrors; } export const ChannelConfiguration = ({ activeChannel, providerInstances, saveChannel, loading, errors, }: ChannelConfigurationProps) => { const styles = useStyles(); if (loading.fetching || loading.saving) { return ; } if (!activeChannel) { return ( Please select a channel. ); } if (!providerInstances.length) { return ( Please create at least one provider configuration before you manage its setup in channels.

Go to the Providers tab.
); } return ( {errors.fetching && ( Error fetching available channels )} {errors.saving && ( Error saving channel configuration )} ); };