import styled from '@emotion/styled';
import {Button} from 'sentry/components/button';
import PanelAlert from 'sentry/components/panels/panelAlert';
import {IconBusiness} from 'sentry/icons';
import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Hooks} from 'sentry/types/hooks';
import type {Organization} from 'sentry/types/organization';
import {openUpsellModal} from 'getsentry/actionCreators/modal';
import LearnMoreButton from 'getsentry/components/features/learnMoreButton';
import PlanFeature from 'getsentry/components/features/planFeature';
import {displayPlanName} from 'getsentry/utils/billing';
type Props = {
features: string[];
organization: Organization;
};
function DisabledAlert({organization, features}: Props) {
return (
{({plan}) => (
{plan !== null
? tct(
'Custom Rate Limits are available to [planRequirement] and above.',
{
planRequirement: (
{t('%s plans', displayPlanName(plan))}
),
}
)
: t('Custom Rate Limits are not available on your plan.')}
}
data-test-id="rate-limit-upsell"
onClick={() =>
openUpsellModal({
organization,
source: 'feature.rate_limits',
defaultSelection: 'event-volume',
})
}
>
{t('Learn More')}
{t('Documentation')}
)}
);
}
const StyledPanelAlert = styled(PanelAlert)`
align-items: center;
`;
const Container = styled('div')`
display: grid;
grid-template-columns: 1fr max-content max-content;
gap: ${space(1)};
align-items: center;
`;
type HookProps = Parameters[0];
function DisabledRateLimits(props: HookProps) {
if (typeof props.children === 'function') {
return props.children({
...props,
renderDisabled: DisabledAlert,
});
}
return props.children;
}
export default DisabledRateLimits;