import {Fragment} from 'react'; import {openHelpSearchModal} from 'sentry/actionCreators/modal'; import {Button} from 'sentry/components/button'; import ExternalLink from 'sentry/components/links/externalLink'; import {t, tct} from 'sentry/locale'; import type {Project} from 'sentry/types'; import useOrganization from 'sentry/utils/useOrganization'; import usePageFilters from 'sentry/utils/usePageFilters'; import {normalizeUrl} from 'sentry/utils/withDomainRequired'; import {useDenylistedProjects} from 'sentry/views/performance/database/useDenylistedProjects'; import {useOutdatedSDKProjects} from 'sentry/views/performance/database/useOutdatedSDKProjects'; interface Props { Wrapper?: React.ComponentType; isDataAvailable?: boolean; } function DivWrapper(props) { return
; } export function NoDataMessage({Wrapper = DivWrapper, isDataAvailable}: Props) { const organization = useOrganization(); const {selection, isReady: pageFilterIsReady} = usePageFilters(); const selectedProjectIds = selection.projects.map(projectId => projectId.toString()); const {projects: outdatedProjects, isFetching: areOutdatedProjectsFetching} = useOutdatedSDKProjects({ projectId: selectedProjectIds, enabled: pageFilterIsReady && !isDataAvailable, }); const {projects: denylistedProjects, isFetching: areDenylistProjectsFetching} = useDenylistedProjects({ projectId: selectedProjectIds, }); const isDataFetching = areOutdatedProjectsFetching || areDenylistProjectsFetching; if (isDataFetching) { return null; } const hasAnyProblematicProjects = (!areOutdatedProjectsFetching && outdatedProjects.length > 0) || (!areDenylistProjectsFetching && denylistedProjects.length > 0); if (isDataAvailable && !hasAnyProblematicProjects) { return null; } return (