Path: blob/main/components/dashboard/src/teams/git-integrations/GitIntegrationsList.tsx
2501 views
/**1* Copyright (c) 2023 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { FunctionComponent, useCallback, useState } from "react";7import { Button } from "@podkit/buttons/Button";8import { EmptyMessage } from "../../components/EmptyMessage";9import { Item, ItemField, ItemFieldIcon, ItemsList } from "../../components/ItemsList";10import { Heading2, Subheading } from "../../components/typography/headings";11import { GitIntegrationListItem } from "./GitIntegrationListItem";12import { GitIntegrationModal } from "./GitIntegrationModal";13import { AuthProvider } from "@gitpod/public-api/lib/gitpod/v1/authprovider_pb";1415type Props = {16providers: AuthProvider[];17};18export const GitIntegrationsList: FunctionComponent<Props> = ({ providers }) => {19const [showCreateModal, setShowCreateModal] = useState(false);2021const onCreate = useCallback(() => setShowCreateModal(true), []);22const hideModal = useCallback(() => setShowCreateModal(false), []);2324return (25<>26<div className="flex flex-col space-y-2 md:flex-row md:items-start md:justify-between md:space-y-0">27<div>28<Heading2>Git Provider</Heading2>29<Subheading>Configure Git provider integrations for your organization.</Subheading>30</div>3132{providers.length !== 0 ? (33<div>34<Button className="whitespace-nowrap" onClick={onCreate}>35New Git Provider36</Button>37</div>38) : null}39</div>4041{providers.length === 0 ? (42<EmptyMessage43title="No Git Providers"44subtitle="Configure a Git Provider with GitHub, GitLab, or Bitbucket Server."45buttonText="New Git Provider"46onClick={onCreate}47/>48) : (49<ItemsList className="pt-6">50<Item header={true}>51<ItemFieldIcon />52<ItemField className="w-5/12">Provider Type</ItemField>53<ItemField className="w-6/12">Host Name</ItemField>54</Item>55{providers.map((p) => (56<GitIntegrationListItem key={p.id} provider={p} />57))}58</ItemsList>59)}60{showCreateModal && <GitIntegrationModal onClose={hideModal} />}61</>62);63};646566