import { useState } from "react"; import Link from "next/link"; import Image from "next/image"; import { useRouter } from "next/router"; import { useTheme } from "next-themes"; import useSWR, { mutate } from "swr"; import { observer } from "mobx-react-lite"; // hooks import { useUser } from "hooks/store"; import useUserAuth from "hooks/use-user-auth"; // services import { IntegrationService } from "services/integrations"; // components import { Exporter, SingleExport } from "components/exporter"; import { EmptyState, getEmptyStateImagePath } from "components/empty-state"; // ui import { Button } from "@plane/ui"; import { ImportExportSettingsLoader } from "components/ui"; // icons import { MoveLeft, MoveRight, RefreshCw } from "lucide-react"; // fetch-keys import { EXPORT_SERVICES_LIST } from "constants/fetch-keys"; // constants import { EXPORTERS_LIST } from "constants/workspace"; import { WORKSPACE_SETTINGS_EMPTY_STATE_DETAILS } from "constants/empty-state"; // 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;