1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-18 11:14:57 +02:00
unleash.unleash/frontend/src/component/integrations/IntegrationList/ConfiguredIntegrations/ConfiguredIntegrations.tsx
Nuno Góis 4167a60588
feat: biome lint frontend (#4903)
Follows up on https://github.com/Unleash/unleash/pull/4853 to add Biome
to the frontend as well.


![image](https://github.com/Unleash/unleash/assets/14320932/1906faf1-fc29-4172-a4d4-b2716d72cd65)

Added a few `biome-ignore` to speed up the process but we may want to
check and fix them in the future.
2023-10-02 13:25:46 +01:00

62 lines
2.2 KiB
TypeScript

import { AddonSchema, AddonTypeSchema } from 'openapi';
import useLoading from 'hooks/useLoading';
import { PageContent } from 'component/common/PageContent/PageContent';
import { PageHeader } from 'component/common/PageHeader/PageHeader';
import { StyledCardsGrid } from '../IntegrationList.styles';
import { IntegrationCard } from '../IntegrationCard/IntegrationCard';
import { VFC } from 'react';
type ConfiguredIntegrationsProps = {
loading: boolean;
addons: AddonSchema[];
providers: AddonTypeSchema[];
};
export const ConfiguredIntegrations: VFC<ConfiguredIntegrationsProps> = ({
loading,
addons,
providers,
}) => {
const counter = addons.length ? `(${addons.length})` : '';
const ref = useLoading(loading || false);
return (
<PageContent
header={<PageHeader title={`Configured integrations ${counter}`} />}
sx={(theme) => ({ marginBottom: theme.spacing(2) })}
isLoading={loading}
>
<StyledCardsGrid ref={ref}>
{addons
?.sort(({ id: a }, { id: b }) => a - b)
.map((addon) => {
const {
id,
enabled,
provider,
description,
// events,
// projects,
} = addon;
const providerConfig = providers.find(
(item) => item.name === provider,
);
return (
<IntegrationCard
key={`${id}-${provider}-${enabled}`}
addon={addon}
icon={provider}
title={providerConfig?.displayName || provider}
isEnabled={enabled}
description={description || ''}
link={`/integrations/edit/${id}`}
configureActionText='Open'
/>
);
})}
</StyledCardsGrid>
</PageContent>
);
};