diff --git a/apps/app/components/integration/github/index.ts b/apps/app/components/integration/github/index.ts new file mode 100644 index 000000000..c215e9a0c --- /dev/null +++ b/apps/app/components/integration/github/index.ts @@ -0,0 +1,9 @@ +export * from "./auth"; +export * from "./import-configure"; +export * from "./import-confirm"; +export * from "./import-data"; +export * from "./import-users"; +export * from "./repo-details"; +export * from "./root"; +export * from "./select-repository"; +export * from "./single-user-select"; diff --git a/apps/app/components/integration/github/root.tsx b/apps/app/components/integration/github/root.tsx index f5ace7909..2c9e430db 100644 --- a/apps/app/components/integration/github/root.tsx +++ b/apps/app/components/integration/github/root.tsx @@ -1,14 +1,15 @@ -import { FC, useState } from "react"; +import React, { useState } from "react"; import Link from "next/link"; import Image from "next/image"; import { useRouter } from "next/router"; -import { mutate } from "swr"; +import useSWR, { mutate } from "swr"; // react-hook-form import { useForm } from "react-hook-form"; // services +import IntegrationService from "services/integration"; import GithubIntegrationService from "services/integration/github.service"; // hooks import useToast from "hooks/use-toast"; @@ -24,22 +25,15 @@ import { import { CogIcon, CloudUploadIcon, UsersIcon, CheckIcon } from "components/icons"; import { ArrowLeftIcon, ListBulletIcon } from "@heroicons/react/24/outline"; // images -import GithubLogo from "public/logos/github-square.png"; +import GithubLogo from "public/services/github.png"; // types -import { - IAppIntegrations, - IGithubRepoCollaborator, - IGithubServiceImportFormData, - IWorkspaceIntegrations, -} from "types"; +import { IGithubRepoCollaborator, IGithubServiceImportFormData } from "types"; // fetch-keys -import { IMPORTER_SERVICES_LIST } from "constants/fetch-keys"; - -type Props = { - provider: string | undefined; - appIntegrations: IAppIntegrations[] | undefined; - workspaceIntegrations: IWorkspaceIntegrations[] | undefined; -}; +import { + APP_INTEGRATIONS, + IMPORTER_SERVICES_LIST, + WORKSPACE_INTEGRATIONS, +} from "constants/fetch-keys"; export type TIntegrationSteps = | "import-configure" @@ -95,18 +89,14 @@ const integrationWorkflowData = [ }, ]; -export const GithubIntegrationRoot: FC = ({ - provider, - appIntegrations, - workspaceIntegrations, -}) => { +export const GithubImporterRoot = () => { const [currentStep, setCurrentStep] = useState({ state: "import-configure", }); const [users, setUsers] = useState([]); const router = useRouter(); - const { workspaceSlug } = router.query; + const { workspaceSlug, provider } = router.query; const { setToastAlert } = useToast(); @@ -114,6 +104,17 @@ export const GithubIntegrationRoot: FC = ({ defaultValues: defaultFormValues, }); + const { data: appIntegrations } = useSWR(APP_INTEGRATIONS, () => + IntegrationService.getAppIntegrationsList() + ); + + const { data: workspaceIntegrations } = useSWR( + workspaceSlug ? WORKSPACE_INTEGRATIONS(workspaceSlug as string) : null, + workspaceSlug + ? () => IntegrationService.getWorkspaceIntegrationsList(workspaceSlug as string) + : null + ); + const activeIntegrationState = () => { const currentElementIndex = integrationWorkflowData.findIndex( (i) => i?.key === currentStep?.state @@ -189,9 +190,8 @@ export const GithubIntegrationRoot: FC = ({
{integrationWorkflowData.map((integration, index) => ( - <> +
= ({ {" "}
)} - +
))}
@@ -230,7 +230,7 @@ export const GithubIntegrationRoot: FC = ({ {currentStep?.state === "import-configure" && ( diff --git a/apps/app/components/integration/guide.tsx b/apps/app/components/integration/guide.tsx index 060dbdc26..ce33f16d2 100644 --- a/apps/app/components/integration/guide.tsx +++ b/apps/app/components/integration/guide.tsx @@ -1,45 +1,44 @@ -import { FC, useState } from "react"; +import { useState } from "react"; import Link from "next/link"; import Image from "next/image"; import { useRouter } from "next/router"; -import { mutate } from "swr"; +import useSWR, { mutate } from "swr"; -// icons -import { ArrowRightIcon } from "components/icons"; +// services +import IntegrationService from "services/integration"; // components -import { DeleteImportModal, GithubIntegrationRoot, SingleImport } from "components/integration"; -// icons -import { ArrowPathIcon } from "@heroicons/react/24/outline"; +import { + DeleteImportModal, + GithubImporterRoot, + JiraImporterRoot, + SingleImport, +} from "components/integration"; // ui import { Loader, PrimaryButton } from "components/ui"; -// images -import GithubLogo from "public/logos/github-square.png"; +// icons +import { ArrowPathIcon } from "@heroicons/react/24/outline"; +import { ArrowRightIcon } from "components/icons"; // types -import { IAppIntegrations, IImporterService, IWorkspaceIntegrations } from "types"; +import { IImporterService } from "types"; // fetch-keys import { IMPORTER_SERVICES_LIST } from "constants/fetch-keys"; +// constants +import { IMPORTERS_EXPORTERS_LIST } from "constants/workspace"; -type Props = { - provider: string | undefined; - appIntegrations: IAppIntegrations[] | undefined; - workspaceIntegrations: IWorkspaceIntegrations[] | undefined; - importerServices: IImporterService[] | undefined; -}; - -const IntegrationGuide: FC = ({ - provider, - appIntegrations, - workspaceIntegrations, - importerServices, -}) => { +const IntegrationGuide = () => { const [refreshing, setRefreshing] = useState(false); const [deleteImportModal, setDeleteImportModal] = useState(false); const [importToDelete, setImportToDelete] = useState(null); const router = useRouter(); - const { workspaceSlug } = router.query; + const { workspaceSlug, provider } = router.query; + + const { data: importerServices } = useSWR( + workspaceSlug ? IMPORTER_SERVICES_LIST(workspaceSlug as string) : null, + workspaceSlug ? () => IntegrationService.getImporterServicesList(workspaceSlug as string) : null + ); const handleDeleteImport = (importService: IImporterService) => { setImportToDelete(importService); @@ -53,10 +52,10 @@ const IntegrationGuide: FC = ({ handleClose={() => setDeleteImportModal(false)} data={importToDelete} /> -
+
{!provider && ( <> -
+
Relocation Guide
@@ -64,109 +63,92 @@ const IntegrationGuide: FC = ({ services. This tool will guide you to relocate the issue to Plane.
-
-
Read More
- +
-
- {appIntegrations ? ( - appIntegrations.length > 0 ? ( - appIntegrations.map((integration, index) => ( -
-
-
- {integration?.provider === "github" && ( - GithubLogo - )} -
-
-
-

{integration?.title}

-
-
- Activate GitHub integrations on individual projects to sync with - specific repositories. -
-
-
- - Import Now - -
-
- -

- Previous Imports - -

- {importerServices ? ( - importerServices.length > 0 ? ( -
-
- {importerServices.map((service) => ( - handleDeleteImport(service)} - /> - ))} -
-
- ) : ( -
- No previous imports available. -
- ) - ) : ( - - - - - - - )} +
+ {IMPORTERS_EXPORTERS_LIST.map((service) => ( +
+
+
+ {`${service.title} +
+
+

{service.title}

+

{service.description}

+
+ - )) - ) : ( -
- Integrations not available.
+
+ ))} +
+
+

+ Previous Imports + +

+ {importerServices ? ( + importerServices.length > 0 ? ( +
+
+ {importerServices.map((service) => ( + handleDeleteImport(service)} + /> + ))} +
+
+ ) : ( +
No previous imports available.
) ) : ( - - - + + + + + )}
)} - {provider && provider === "github" && ( - - )} + {provider && provider === "github" && } + {provider && provider === "jira" && }
); diff --git a/apps/app/components/integration/index.ts b/apps/app/components/integration/index.ts index df7f4de25..e970bbd84 100644 --- a/apps/app/components/integration/index.ts +++ b/apps/app/components/integration/index.ts @@ -3,16 +3,8 @@ export * from "./delete-import-modal"; export * from "./guide"; export * from "./single-import"; -// github integration -// authenticate -export * from "./github/auth"; -// layout -export * from "./github/root"; -// components -export * from "./github/import-configure"; -export * from "./github/import-data"; -export * from "./github/repo-details"; -export * from "./github/import-users"; -export * from "./github/import-confirm"; -export * from "./github/select-repository"; -export * from "./github/single-user-select"; +// github +export * from "./github"; + +// jira +export * from "./jira"; diff --git a/apps/app/components/integration/jira/index.ts b/apps/app/components/integration/jira/index.ts new file mode 100644 index 000000000..1efe34c51 --- /dev/null +++ b/apps/app/components/integration/jira/index.ts @@ -0,0 +1 @@ +export * from "./root"; diff --git a/apps/app/components/integration/jira/root.tsx b/apps/app/components/integration/jira/root.tsx new file mode 100644 index 000000000..15a89c3e4 --- /dev/null +++ b/apps/app/components/integration/jira/root.tsx @@ -0,0 +1 @@ +export const JiraImporterRoot = () => <>; diff --git a/apps/app/constants/workspace.ts b/apps/app/constants/workspace.ts index 6533e08cf..24f886af9 100644 --- a/apps/app/constants/workspace.ts +++ b/apps/app/constants/workspace.ts @@ -1,8 +1,12 @@ +// onboarding images import Welcome from "public/onboarding/welcome.svg"; import Issue from "public/onboarding/issue.svg"; import Cycle from "public/onboarding/cycle.svg"; import Module from "public/onboarding/module.svg"; import CommandMenu from "public/onboarding/command-menu.svg"; +// services images +import GithubLogo from "public/services/github.png"; +import JiraLogo from "public/services/jira.png"; export const ROLE = { 5: "Guest", @@ -62,3 +66,20 @@ export const ONBOARDING_CARDS = { description: "With Command Menu, you can create, update and navigate across the platform.", }, }; + +export const IMPORTERS_EXPORTERS_LIST = [ + { + provider: "github", + type: "import", + title: "GitHub", + description: "Import issues from GitHub repositories and sync them.", + logo: GithubLogo, + }, + { + provider: "jira", + type: "import", + title: "Jira", + description: "Import issues and epics from Jira projects and epics.", + logo: JiraLogo, + }, +]; diff --git a/apps/app/pages/[workspaceSlug]/settings/import-export.tsx b/apps/app/pages/[workspaceSlug]/settings/import-export.tsx index a51d08efc..5b458dd72 100644 --- a/apps/app/pages/[workspaceSlug]/settings/import-export.tsx +++ b/apps/app/pages/[workspaceSlug]/settings/import-export.tsx @@ -1,13 +1,7 @@ import { useRouter } from "next/router"; -import useSWR from "swr"; - // lib import { requiredWorkspaceAdmin } from "lib/auth"; -// services -import IntegrationService from "services/integration"; -// hooks -import useToast from "hooks/use-toast"; // layouts import AppLayout from "layouts/app-layout"; import IntegrationGuide from "components/integration/guide"; @@ -16,34 +10,10 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; // types import { UserAuth } from "types"; import type { GetServerSideProps, NextPage } from "next"; -// fetch-keys -import { - APP_INTEGRATIONS, - IMPORTER_SERVICES_LIST, - WORKSPACE_INTEGRATIONS, -} from "constants/fetch-keys"; const ImportExport: NextPage = (props) => { - const { setToastAlert } = useToast(); - const router = useRouter(); - const { workspaceSlug, provider } = router.query; - - const { data: appIntegrations } = useSWR(APP_INTEGRATIONS, () => - IntegrationService.getAppIntegrationsList() - ); - - const { data: workspaceIntegrations } = useSWR( - workspaceSlug ? WORKSPACE_INTEGRATIONS(workspaceSlug as string) : null, - workspaceSlug - ? () => IntegrationService.getWorkspaceIntegrationsList(workspaceSlug as string) - : null - ); - - const { data: importerServices } = useSWR( - workspaceSlug ? IMPORTER_SERVICES_LIST(workspaceSlug as string) : null, - workspaceSlug ? () => IntegrationService.getImporterServicesList(workspaceSlug as string) : null - ); + const { workspaceSlug } = router.query; return ( = (props) => { } settingsLayout > - + ); }; diff --git a/apps/app/public/services/github.png b/apps/app/public/services/github.png new file mode 100644 index 000000000..527ba79f2 Binary files /dev/null and b/apps/app/public/services/github.png differ diff --git a/apps/app/public/services/jira.png b/apps/app/public/services/jira.png new file mode 100644 index 000000000..ca9db1926 Binary files /dev/null and b/apps/app/public/services/jira.png differ