import styled from '@emotion/styled'; import ErrorLevel from 'sentry/components/events/errorLevel'; import UnhandledTag from 'sentry/components/group/inboxBadges/unhandledTag'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {EventOrGroupType, type Level} from 'sentry/types/event'; import useOrganization from 'sentry/utils/useOrganization'; type Props = { type: EventOrGroupType; annotations?: React.ReactNode; className?: string; hasGuideAnchor?: boolean; level?: Level; levelIndicatorSize?: string; message?: React.ReactNode; showUnhandled?: boolean; }; const EVENT_TYPES_WITH_LOG_LEVEL = new Set([ EventOrGroupType.ERROR, EventOrGroupType.CSP, EventOrGroupType.EXPECTCT, EventOrGroupType.DEFAULT, EventOrGroupType.EXPECTSTAPLE, EventOrGroupType.HPKP, EventOrGroupType.NEL, ]); function EventOrGroupLevel({ level, levelIndicatorSize, type, }: Pick) { if (level && EVENT_TYPES_WITH_LOG_LEVEL.has(type)) { return ; } return null; } function EventMessage({ className, annotations, level, levelIndicatorSize, message, type, showUnhandled = false, }: Props) { const organization = useOrganization({allowNull: true}); const hasIssuePriority = organization?.features.includes('issue-priority-ui'); if (!hasIssuePriority) { return ( {level ? ( ) : null} {showUnhandled ? : null} {message ? {message} : null} ); } return ( {showUnhandled ? : null} {message ? ( {message} ) : ( ({t('No error message')}) )} {annotations} ); } const LevelMessageContainer = styled('div')` display: flex; gap: ${space(1)}; align-items: center; position: relative; line-height: 1.2; overflow: hidden; `; const Message = styled('div')` ${p => p.theme.overflowEllipsis} width: auto; max-height: 38px; `; const NoMessage = styled(Message)` color: ${p => p.theme.subText}; `; export default EventMessage;