import {Fragment} from 'react'; import styled from '@emotion/styled'; import UserAvatar from 'app/components/avatar/userAvatar'; import CommitLink from 'app/components/commitLink'; import {BannerContainer, BannerSummary} from 'app/components/events/styles'; import TimeSince from 'app/components/timeSince'; import Version from 'app/components/version'; import {IconCheckmark} from 'app/icons'; import {t, tct} from 'app/locale'; import space from 'app/styles/space'; import {ResolutionStatusDetails} from 'app/types'; type Props = { statusDetails: ResolutionStatusDetails; projectId: string; }; function renderReason(statusDetails: ResolutionStatusDetails, projectId: string) { const actor = statusDetails.actor ? ( {statusDetails.actor.name} ) : null; if (statusDetails.inNextRelease && statusDetails.actor) { return tct('[actor] marked this issue as resolved in the upcoming release.', { actor, }); } else if (statusDetails.inNextRelease) { return t('This issue has been marked as resolved in the upcoming release.'); } else if (statusDetails.inRelease && statusDetails.actor) { return tct('[actor] marked this issue as resolved in version [version].', { actor, version: ( ), }); } else if (statusDetails.inRelease) { return tct('This issue has been marked as resolved in version [version].', { version: ( ), }); } else if (!!statusDetails.inCommit) { return tct('This issue has been marked as resolved by [commit]', { commit: ( ), }); } return t('This issue has been marked as resolved.'); } function ResolutionBox({statusDetails, projectId}: Props) { return ( {renderReason(statusDetails, projectId)} ); } const StyledTimeSince = styled(TimeSince)` color: ${p => p.theme.gray300}; margin-left: ${space(0.5)}; font-size: ${p => p.theme.fontSizeSmall}; `; const StyledIconCheckmark = styled(IconCheckmark)` /* override margin defined in BannerSummary */ margin-top: 0 !important; align-self: center; @media (max-width: ${p => p.theme.breakpoints[0]}) { margin-top: ${space(0.5)} !important; align-self: flex-start; } `; export default ResolutionBox;