diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.ts index 871985ce1..a8f0fb385 100644 --- a/frontend/src/const/routes.ts +++ b/frontend/src/const/routes.ts @@ -16,6 +16,12 @@ export const ROUTE_PATHS = Object.freeze({ PasswordResetPage: setRoute("/password-reset", "/_restrict-login-signup/password-reset"), PasswordSetupPage: setRoute("/password-setup", "/_authenticate/password-setup") }, + Admin: { + IntegrationsPage: setRoute( + "/admin/integrations", + "/_authenticate/_inject-org-details/admin/_admin-layout/integrations" + ) + }, Organization: { Settings: { OauthCallbackPage: setRoute( diff --git a/frontend/src/pages/admin/IntegrationsPage/components/IntegrationsPageForm.tsx b/frontend/src/pages/admin/IntegrationsPage/components/IntegrationsPageForm.tsx index b590d45c1..664b2c280 100644 --- a/frontend/src/pages/admin/IntegrationsPage/components/IntegrationsPageForm.tsx +++ b/frontend/src/pages/admin/IntegrationsPage/components/IntegrationsPageForm.tsx @@ -1,12 +1,72 @@ +import { useNavigate, useSearch } from "@tanstack/react-router"; + +import { Tab, TabList, TabPanel, Tabs } from "@app/components/v2"; +import { ROUTE_PATHS } from "@app/const/routes"; import { useGetAdminIntegrationsConfig } from "@app/hooks/api"; +import { AdminIntegrationsConfig } from "@app/hooks/api/admin/types"; import { GitHubAppConnectionForm } from "./GitHubAppConnectionForm"; import { MicrosoftTeamsIntegrationForm } from "./MicrosoftTeamsIntegrationForm"; import { SlackIntegrationForm } from "./SlackIntegrationForm"; +enum IntegrationTabSections { + Workflow = "workflow", + AppConnections = "app-connections" +} + +interface WorkflowTabProps { + adminIntegrationsConfig: AdminIntegrationsConfig; +} + +interface AppConnectionsTabProps { + adminIntegrationsConfig: AdminIntegrationsConfig; +} + +const WorkflowTab = ({ adminIntegrationsConfig }: WorkflowTabProps) => ( +
+ + +
+); + +const AppConnectionsTab = ({ adminIntegrationsConfig }: AppConnectionsTabProps) => ( +
+ +
+); + export const IntegrationsPageForm = () => { const { data: adminIntegrationsConfig } = useGetAdminIntegrationsConfig(); + const navigate = useNavigate({ + from: ROUTE_PATHS.Admin.IntegrationsPage.path + }); + + const selectedTab = useSearch({ + from: ROUTE_PATHS.Admin.IntegrationsPage.id, + select: (el: { selectedTab?: string }) => el.selectedTab || IntegrationTabSections.Workflow, + structuralSharing: true + }); + + const updateSelectedTab = (tab: string) => { + navigate({ + search: { selectedTab: tab } + }); + }; + + const tabSections = [ + { + key: IntegrationTabSections.Workflow, + label: "Workflows", + component: WorkflowTab + }, + { + key: IntegrationTabSections.AppConnections, + label: "App Connections", + component: AppConnectionsTab + } + ]; + return (
@@ -15,11 +75,20 @@ export const IntegrationsPageForm = () => { Configure your instance-wide settings to enable integration with third-party services.
-
- - - -
+ + + {tabSections.map((section) => ( + + {section.label} + + ))} + + {tabSections.map(({ key, component: Component }) => ( + + + + ))} + ); };