import { useState } from "react"; import { observer } from "mobx-react"; import Image from "next/image"; import Link from "next/link"; import { useRouter, useParams, useSearchParams } from "next/navigation"; import useSWR, { mutate } from "swr"; // icons import { MoveLeft, MoveRight, RefreshCw } from "lucide-react"; // ui import { Button } from "@plane/ui"; // components import { EmptyState } from "@/components/empty-state"; import { Exporter, SingleExport } from "@/components/exporter"; import { ImportExportSettingsLoader } from "@/components/ui"; // constants import { EmptyStateType } from "@/constants/empty-state"; import { EXPORT_SERVICES_LIST } from "@/constants/fetch-keys"; import { EXPORTERS_LIST } from "@/constants/workspace"; // hooks import { useUser } from "@/hooks/store"; // services import { IntegrationService } from "@/services/integrations"; const integrationService = new IntegrationService(); const IntegrationGuide = observer(() => { // states const [refreshing, setRefreshing] = useState(false); const per_page = 10; const [cursor, setCursor] = useState(`10:0:0`); // router const router = useRouter(); const { workspaceSlug } = useParams(); const searchParams = useSearchParams(); const provider = searchParams.get("provider"); // store hooks const { data: currentUser } = useUser(); const { data: exporterServices } = useSWR( workspaceSlug && cursor ? EXPORT_SERVICES_LIST(workspaceSlug as string, cursor, `${per_page}`) : null, workspaceSlug && cursor ? () => integrationService.getExportsServicesList(workspaceSlug as string, cursor, per_page) : null ); const handleCsvClose = () => { router.replace(`/${workspaceSlug?.toString()}/settings/exports`); }; return ( <>
<>
{EXPORTERS_LIST.map((service) => (
{`${service.title}

{service.title}

{service.description}

))}

Previous Exports

{exporterServices && exporterServices?.results ? ( exporterServices?.results?.length > 0 ? (
{exporterServices?.results.map((service) => ( ))}
) : (
) ) : ( )}
{provider && ( handleCsvClose()} data={null} user={currentUser || null} provider={provider} mutateServices={() => mutate(EXPORT_SERVICES_LIST(workspaceSlug as string, `${cursor}`, `${per_page}`))} /> )}
); }); export default IntegrationGuide;