import {Fragment} from 'react';
import styled from '@emotion/styled';
import Feature from 'sentry/components/acl/feature';
import {CommitRow} from 'sentry/components/commitRow';
import ErrorBoundary from 'sentry/components/errorBoundary';
import {EventContexts} from 'sentry/components/events/contexts';
import {EventDevice} from 'sentry/components/events/device';
import {EventAttachments} from 'sentry/components/events/eventAttachments';
import {EventCause} from 'sentry/components/events/eventCause';
import {EventDataSection} from 'sentry/components/events/eventDataSection';
import {EventEntry} from 'sentry/components/events/eventEntry';
import {EventEvidence} from 'sentry/components/events/eventEvidence';
import {EventExtraData} from 'sentry/components/events/eventExtraData';
import EventReplay from 'sentry/components/events/eventReplay';
import {EventSdk} from 'sentry/components/events/eventSdk';
import AggregateSpanDiff from 'sentry/components/events/eventStatisticalDetector/aggregateSpanDiff';
import EventSpanOpBreakdown from 'sentry/components/events/eventStatisticalDetector/aggregateSpanOps/spanOpBreakdown';
import EventBreakpointChart from 'sentry/components/events/eventStatisticalDetector/breakpointChart';
import {EventAffectedTransactions} from 'sentry/components/events/eventStatisticalDetector/eventAffectedTransactions';
import EventComparison from 'sentry/components/events/eventStatisticalDetector/eventComparison';
import {EventFunctionComparisonList} from 'sentry/components/events/eventStatisticalDetector/eventFunctionComparisonList';
import {EventFunctionBreakpointChart} from 'sentry/components/events/eventStatisticalDetector/functionBreakpointChart';
import RegressionMessage from 'sentry/components/events/eventStatisticalDetector/regressionMessage';
import {EventTagsAndScreenshot} from 'sentry/components/events/eventTagsAndScreenshot';
import {EventViewHierarchy} from 'sentry/components/events/eventViewHierarchy';
import {EventGroupingInfo} from 'sentry/components/events/groupingInfo';
import {ActionableItems} from 'sentry/components/events/interfaces/crashContent/exception/actionableItems';
import {actionableItemsEnabled} from 'sentry/components/events/interfaces/crashContent/exception/useActionableItems';
import {CronTimelineSection} from 'sentry/components/events/interfaces/crons/cronTimelineSection';
import {AnrRootCause} from 'sentry/components/events/interfaces/performance/anrRootCause';
import {SpanEvidenceSection} from 'sentry/components/events/interfaces/performance/spanEvidence';
import {EventPackageData} from 'sentry/components/events/packageData';
import {EventRRWebIntegration} from 'sentry/components/events/rrwebIntegration';
import {EventUserFeedback} from 'sentry/components/events/userFeedback';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import {Event, Group, IssueCategory, IssueType, Project} from 'sentry/types';
import {EntryType, EventTransaction} from 'sentry/types/event';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import {ResourcesAndMaybeSolutions} from 'sentry/views/issueDetails/resourcesAndMaybeSolutions';
type GroupEventDetailsContentProps = {
group: Group;
project: Project;
event?: Event;
};
type GroupEventEntryProps = {
entryType: EntryType;
event: Event;
group: Group;
project: Project;
};
function GroupEventEntry({event, entryType, group, project}: GroupEventEntryProps) {
const organization = useOrganization();
const matchingEntry = event.entries.find(entry => entry.type === entryType);
if (!matchingEntry) {
return null;
}
return (
);
}
function DefaultGroupEventDetailsContent({
group,
event,
project,
}: Required) {
const organization = useOrganization();
const location = useLocation();
const projectSlug = project.slug;
const hasReplay = Boolean(event.tags?.find(({key}) => key === 'replayId')?.value);
const mechanism = event.tags?.find(({key}) => key === 'mechanism')?.value;
const isANR = mechanism === 'ANR' || mechanism === 'AppExitInfo';
const hasAnrImprovementsFeature = organization.features.includes('anr-improvements');
const eventEntryProps = {group, event, project};
const hasActionableItems = actionableItemsEnabled({
eventId: event.id,
organization,
projectSlug,
});
return (
{hasActionableItems && (
)}
{event.userReport && (
)}
{group.issueCategory === IssueCategory.CRON && (
)}
{hasAnrImprovementsFeature && isANR && (
)}
{group.issueCategory === IssueCategory.PERFORMANCE && (
)}
{event.groupID && (
)}
{!hasReplay && (
)}
);
}
function PerformanceDurationRegressionIssueDetailsContent({
group,
event,
project,
}: Required) {
const organization = useOrganization();
return (
);
}
function ProfilingDurationRegressionIssueDetailsContent({
group,
event,
project,
}: Required) {
const organization = useOrganization();
return (
);
}
function GroupEventDetailsContent({
group,
event,
project,
}: GroupEventDetailsContentProps) {
if (!event) {
return (
{t('Latest event not available')}
);
}
switch (group.issueType) {
case IssueType.PERFORMANCE_DURATION_REGRESSION: {
return (
);
}
case IssueType.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL: {
return (
);
}
default: {
return (
);
}
}
}
const NotFoundMessage = styled('div')`
padding: ${space(2)} ${space(4)};
`;
export default GroupEventDetailsContent;