import {Button} from 'sentry/components/button'; import TeamKeyTransactionComponent from 'sentry/components/performance/teamKeyTransaction'; import * as TeamKeyTransactionManager from 'sentry/components/performance/teamKeyTransactionsManager'; import {Tooltip} from 'sentry/components/tooltip'; import {IconStar} from 'sentry/icons'; import {t, tn} from 'sentry/locale'; import {Organization, Project} from 'sentry/types'; import {defined} from 'sentry/utils'; import EventView from 'sentry/utils/discover/eventView'; import {useTeams} from 'sentry/utils/useTeams'; import withProjects from 'sentry/utils/withProjects'; type BaseProps = { organization: Organization; transactionName: string; }; type Props = BaseProps & TeamKeyTransactionManager.TeamKeyTransactionManagerChildrenProps & { project: Project; }; function TeamKeyTransactionButton({ counts, getKeyedTeams, project, transactionName, isLoading, error, ...props }: Props) { const keyedTeams = getKeyedTeams(project.id, transactionName); const keyedTeamsCount = keyedTeams?.size ?? 0; const disabled = isLoading || !!error; return ( ( keyedTeams.has(team.id)) .map(({slug}) => slug) .join(', ') : null } > )} {...props} /> ); } type WrapperProps = BaseProps & { eventView: EventView; projects: Project[]; }; function TeamKeyTransactionButtonWrapper({ eventView, organization, projects, ...props }: WrapperProps) { const {teams, initiallyLoaded} = useTeams({provideUserTeams: true}); if (eventView.project.length !== 1) { return ( ); } const projectId = String(eventView.project[0]); const project = projects.find(proj => proj.id === projectId); if (!defined(project)) { return ( ); } return ( {({isLoading, ...results}) => ( )} ); } export default withProjects(TeamKeyTransactionButtonWrapper);