2021-12-14 19:14:53 +00:00
|
|
|
import { PropsWithChildren } from 'react';
|
2022-06-09 21:17:13 +00:00
|
|
|
import clsx from 'clsx';
|
2022-11-28 02:00:28 +00:00
|
|
|
import { Briefcase } from 'lucide-react';
|
2021-12-14 19:14:53 +00:00
|
|
|
|
2022-07-25 16:24:54 +00:00
|
|
|
import './BEFeatureIndicator.css';
|
|
|
|
|
2022-11-13 08:10:18 +00:00
|
|
|
import { FeatureId } from '@/react/portainer/feature-flags/enums';
|
2021-12-14 19:14:53 +00:00
|
|
|
|
2022-11-28 02:00:28 +00:00
|
|
|
import { Icon } from '@@/Icon';
|
|
|
|
|
2021-12-14 19:14:53 +00:00
|
|
|
import { getFeatureDetails } from './utils';
|
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
featureId?: FeatureId;
|
2022-06-09 21:17:13 +00:00
|
|
|
showIcon?: boolean;
|
|
|
|
className?: string;
|
2021-12-14 19:14:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function BEFeatureIndicator({
|
|
|
|
featureId,
|
|
|
|
children,
|
2022-06-09 21:17:13 +00:00
|
|
|
showIcon = true,
|
|
|
|
className = '',
|
2021-12-14 19:14:53 +00:00
|
|
|
}: PropsWithChildren<Props>) {
|
|
|
|
const { url, limitedToBE } = getFeatureDetails(featureId);
|
|
|
|
|
|
|
|
if (!limitedToBE) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<a
|
2022-08-12 00:03:30 +00:00
|
|
|
className={clsx('be-indicator vertical-center', className)}
|
2021-12-14 19:14:53 +00:00
|
|
|
href={url}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
{children}
|
2023-02-12 21:04:24 +00:00
|
|
|
{showIcon && <Icon icon={Briefcase} className="be-indicator-icon mr-1" />}
|
2022-11-28 02:00:28 +00:00
|
|
|
<span className="be-indicator-label break-words">
|
2022-06-09 21:17:13 +00:00
|
|
|
Business Edition Feature
|
|
|
|
</span>
|
2021-12-14 19:14:53 +00:00
|
|
|
</a>
|
|
|
|
);
|
|
|
|
}
|