mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-10 01:19:53 +01:00
* refactor: update test deps * refactor: remove unused ts-expect-error annotations * refactor: add missing arg and return types * refactor: the loading prop is optional * refactor: add missing arg and return types * reafactor: fix value arg type * refactor: fix missing array type * refactor: the parameters field is an array * refactor: use undefined instead of null in state * refactor: add missing params type * refactor: add missing children prop * refactor: add missing array type * refactor: add missing React imports * refactor: use correct IProjectEnvironment type * refactor: type errors as unknown * refactor: the index prop is required * refactor: fix date prop type * refactor: fix tooltip placement prop type * refactor: fix environments state type * refactor: add missing arg types * refactor: add guard for undefined field * refactor: fix ChangePassword prop types * refactor: fix MUI import paths * refactor: add missing arg type * refactor: fix showDialog prop type * refactor: remove unused openUpdateDialog prop * refactor: add missing non-null assertion * refactor: remove unused types prop * refactor: stricten API error handler types * refactor: add missing undefined check * refactor: add missing IProject id field * refactor: fix ConditionallyRender condition prop types * refactor: remove unused args * refactor: add AddVariant prop types * refactor: add types to UIContext * refactor: fix event arg type * refactor: add missing default impressionData field * refactor: fix handleDeleteEnvironment prop args * refactor: fix IFeatureMetrics field requirements * refactor: add missing element types to ConditionallyRender * refactor: remove unused ProjectAccess projectId prop * refactor: add missing undefined check * refactor: fix getCreateTogglePath arg type * refactor: add missing IStrategyPayload import * refactor: remove unused user arg * refactor: add missing event arg type * refactor: add missing style object types * refactor: improve userApiErrors prop type * refactor: the Dialogue onClose prop is optional * refactor: fix the AddonEvents setEventValue prop type
91 lines
2.7 KiB
TypeScript
91 lines
2.7 KiB
TypeScript
import React, { ReactElement } from 'react';
|
|
import { ConfiguredAddons } from './ConfiguredAddons/ConfiguredAddons';
|
|
import { AvailableAddons } from './AvailableAddons/AvailableAddons';
|
|
import { Avatar } from '@material-ui/core';
|
|
import { DeviceHub } from '@material-ui/icons';
|
|
import ConditionallyRender from '../../common/ConditionallyRender/ConditionallyRender';
|
|
import slackIcon from '../../../assets/icons/slack.svg';
|
|
import jiraIcon from '../../../assets/icons/jira.svg';
|
|
import webhooksIcon from '../../../assets/icons/webhooks.svg';
|
|
import teamsIcon from '../../../assets/icons/teams.svg';
|
|
import dataDogIcon from '../../../assets/icons/datadog.svg';
|
|
import { formatAssetPath } from '../../../utils/format-path';
|
|
import useAddons from '../../../hooks/api/getters/useAddons/useAddons';
|
|
|
|
const style: React.CSSProperties = {
|
|
width: '40px',
|
|
height: '40px',
|
|
marginRight: '16px',
|
|
float: 'left',
|
|
};
|
|
|
|
const getAddonIcon = (name: string): ReactElement => {
|
|
switch (name) {
|
|
case 'slack':
|
|
return (
|
|
<img
|
|
style={style}
|
|
alt="Slack Logo"
|
|
src={formatAssetPath(slackIcon)}
|
|
/>
|
|
);
|
|
case 'jira-comment':
|
|
return (
|
|
<img
|
|
style={style}
|
|
alt="JIRA Logo"
|
|
src={formatAssetPath(jiraIcon)}
|
|
/>
|
|
);
|
|
case 'webhook':
|
|
return (
|
|
<img
|
|
style={style}
|
|
alt="Generic Webhook logo"
|
|
src={formatAssetPath(webhooksIcon)}
|
|
/>
|
|
);
|
|
case 'teams':
|
|
return (
|
|
<img
|
|
style={style}
|
|
alt="Microsoft Teams Logo"
|
|
src={formatAssetPath(teamsIcon)}
|
|
/>
|
|
);
|
|
case 'datadog':
|
|
return (
|
|
<img
|
|
style={style}
|
|
alt="Datadog"
|
|
src={formatAssetPath(dataDogIcon)}
|
|
/>
|
|
);
|
|
default:
|
|
return (
|
|
<Avatar>
|
|
<DeviceHub />
|
|
</Avatar>
|
|
);
|
|
}
|
|
};
|
|
|
|
export const AddonList = () => {
|
|
const { providers, addons } = useAddons();
|
|
|
|
return (
|
|
<>
|
|
<ConditionallyRender
|
|
condition={addons.length > 0}
|
|
show={<ConfiguredAddons getAddonIcon={getAddonIcon} />}
|
|
/>
|
|
|
|
<br />
|
|
<AvailableAddons
|
|
providers={providers}
|
|
getAddonIcon={getAddonIcon}
|
|
/>
|
|
</>
|
|
);
|
|
};
|