import {Fragment, memo} from 'react'; import styled from '@emotion/styled'; import AlertLink from 'sentry/components/alertLink'; import GroupReleaseChart from 'sentry/components/group/releaseChart'; import SeenInfo from 'sentry/components/group/seenInfo'; import Placeholder from 'sentry/components/placeholder'; import * as SidebarSection from 'sentry/components/sidebarSection'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {CurrentRelease, Group, Organization, Project, Release} from 'sentry/types'; import {defined} from 'sentry/utils'; import getDynamicText from 'sentry/utils/getDynamicText'; import {useApiQuery} from 'sentry/utils/queryClient'; import QuestionTooltip from '../questionTooltip'; type Props = { environments: string[]; organization: Organization; project: Project; allEnvironments?: Group; currentRelease?: CurrentRelease; group?: Group; }; type GroupRelease = { firstRelease: Release; lastRelease: Release; }; function GroupReleaseStats({ organization, project, environments, allEnvironments, group, currentRelease, }: Props) { const environment = environments.length > 0 ? environments.join(', ') : undefined; const environmentLabel = environment ? environment : t('All Environments'); const shortEnvironmentLabel = environments.length > 1 ? t('selected environments') : environments.length === 1 ? environments[0] : undefined; const {data: groupReleaseData} = useApiQuery( [ defined(group) ? `/organizations/${organization.slug}/issues/${group.id}/first-last-release/` : '', ], { staleTime: 30000, cacheTime: 30000, } ); const firstRelease = groupReleaseData?.firstRelease; const lastRelease = groupReleaseData?.lastRelease; const projectId = project.id; const projectSlug = project.slug; const hasRelease = project.features.includes('releases'); const releaseTrackingUrl = `/settings/${organization.slug}/projects/${project.slug}/release-tracking/`; return (
{!group || !allEnvironments ? ( ) : ( {t('Last Seen')} {t('First Seen')} {!hasRelease ? ( {t('Releases')} {t('See which release caused this issue ')} ) : null} )}
); } export default memo(GroupReleaseStats); const GraphContainer = styled('div')` margin-bottom: ${space(3)}; `; const StyledSidebarSectionContent = styled(SidebarSection.Content)` margin-top: ${space(0.5)}; `;