import { Box, Button, Text } from "@saleor/macaw-ui/next";
import { trpcClient } from "../trpc/trpc-client";
import { useForm } from "react-hook-form";
import { Select } from "@saleor/react-hook-form-macaw";
import { useRouter } from "next/router";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { ButtonsBox } from "../ui/buttons-box";
import { ProvidersResolver } from "../providers/providers-resolver";
import { Skeleton } from "../ui/skeleton";
const FormSchema = z.object({
connectionId: z.string().min(7),
});
const EmptyState = () => (
No connections configured
Create a channel connection above to enable bulk synchronization.
);
export const BulkSyncSection = () => {
const { push } = useRouter();
const { data: connections } = trpcClient.channelsProvidersConnection.fetchConnections.useQuery();
const { data: providers } = trpcClient.providersConfigs.getAll.useQuery();
const { control, handleSubmit } = useForm({
defaultValues: {
connectionId: "",
},
resolver: zodResolver(FormSchema),
});
if (!connections || !providers) {
return ;
}
if (connections.length === 0) {
return ;
}
return (
Bulk products synchronization
Choose a connection and start synchronization. Process is running in the browser.
Do not close the app until it is finished
{
push(`/bulk-sync/${values.connectionId}`);
})}
>
);
};