import { useState } from "react"; import { observer } from "mobx-react-lite"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/router"; import { useTheme } from "next-themes"; import useSWR, { mutate } from "swr"; // hooks import { MoveLeft, MoveRight, RefreshCw } from "lucide-react"; import { Button } from "@plane/ui"; import { EmptyState, getEmptyStateImagePath } from "components/empty-state"; import { Exporter, SingleExport } from "components/exporter"; import { ImportExportSettingsLoader } from "components/ui"; import { WORKSPACE_SETTINGS_EMPTY_STATE_DETAILS } from "constants/empty-state"; import { EXPORT_SERVICES_LIST } from "constants/fetch-keys"; import { EXPORTERS_LIST } from "constants/workspace"; import { useUser } from "hooks/store"; import useUserAuth from "hooks/use-user-auth"; // services import { IntegrationService } from "services/integrations"; // components // ui // icons // fetch-keys // constants // services 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, provider } = router.query; // theme const { resolvedTheme } = useTheme(); // store hooks const { currentUser, currentUserLoader } = useUser(); // custom hooks const {} = useUserAuth({ user: currentUser, isLoading: currentUserLoader }); 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 emptyStateDetail = WORKSPACE_SETTINGS_EMPTY_STATE_DETAILS["export"]; const isLightMode = resolvedTheme ? resolvedTheme === "light" : currentUser?.theme.theme === "light"; const emptyStateImage = getEmptyStateImagePath("workspace-settings", "exports", isLightMode); 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} provider={provider} mutateServices={() => mutate(EXPORT_SERVICES_LIST(workspaceSlug as string, `${cursor}`, `${per_page}`))} /> )}
); }); export default IntegrationGuide;