confidenceFooter.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import styled from '@emotion/styled';
  2. import Count from 'sentry/components/count';
  3. import {Tooltip} from 'sentry/components/tooltip';
  4. import {t, tct} from 'sentry/locale';
  5. import type {Confidence} from 'sentry/types/organization';
  6. import {defined} from 'sentry/utils';
  7. type Props = {
  8. confidence?: Confidence;
  9. sampleCount?: number;
  10. };
  11. export function ConfidenceFooter({sampleCount, confidence}: Props) {
  12. return (
  13. <Container>
  14. {!defined(sampleCount)
  15. ? t('* Extrapolated from \u2026')
  16. : confidence === 'low'
  17. ? tct('* Extrapolated from [sampleCount] samples ([insufficientSamples])', {
  18. sampleCount: <Count value={sampleCount} />,
  19. insufficientSamples: (
  20. <Tooltip
  21. title={t(
  22. 'Shortening the date range, increasing the time interval or removing extra filters may improve accuracy.'
  23. )}
  24. >
  25. <InsufficientSamples>
  26. {t('insufficient for accuracy')}
  27. </InsufficientSamples>
  28. </Tooltip>
  29. ),
  30. })
  31. : tct('* Extrapolated from [sampleCount] samples', {
  32. sampleCount: <Count value={sampleCount} />,
  33. })}
  34. </Container>
  35. );
  36. }
  37. const InsufficientSamples = styled('span')`
  38. text-decoration: underline dotted ${p => p.theme.gray300};
  39. `;
  40. const Container = styled('span')`
  41. color: ${p => p.theme.gray300};
  42. font-size: ${p => p.theme.fontSizeSmall};
  43. `;