mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
26 lines
687 B
TypeScript
26 lines
687 B
TypeScript
import {cloneElement, isValidElement} from 'react';
|
|
|
|
import NoProjectMessage from 'sentry/components/noProjectMessage';
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
|
|
type Props = {
|
|
children: React.ReactNode;
|
|
};
|
|
|
|
function AlertsContainer({children}: Props) {
|
|
const organization = useOrganization();
|
|
const hasMetricAlerts = organization.features.includes('incidents');
|
|
|
|
const content =
|
|
children && isValidElement(children)
|
|
? cloneElement<any>(children, {
|
|
organization,
|
|
hasMetricAlerts,
|
|
})
|
|
: children;
|
|
|
|
return <NoProjectMessage organization={organization}>{content}</NoProjectMessage>;
|
|
}
|
|
|
|
export default AlertsContainer;
|