import styled from '@emotion/styled';
import * as Sentry from '@sentry/react';
import Tag from 'sentry/components/tag';
import {t} from 'sentry/locale';
import {ImageStatus} from 'sentry/types/debugImage';
type Props = {
status: ImageStatus;
};
function Status({status}: Props) {
switch (status) {
case ImageStatus.OTHER:
case ImageStatus.FETCHING_FAILED:
case ImageStatus.MALFORMED:
case ImageStatus.TIMEOUT: {
return {t('Error')};
}
case ImageStatus.MISSING: {
return {t('Missing')};
}
case ImageStatus.FOUND: {
return {t('Ok')};
}
case ImageStatus.UNUSED: {
return {t('Unreferenced')};
}
default: {
Sentry.withScope(scope => {
scope.setLevel('warning');
Sentry.captureException(new Error('Unknown image status'));
});
return {t('Unknown')}; // This shall not happen
}
}
}
export default Status;
const StyledTag = styled(Tag)`
&,
span div {
max-width: 100%;
}
`;