confidenceFooter.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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('* Chart extrapolated from \u2026')
  16. : confidence === 'low'
  17. ? tct(
  18. '* Chart extrapolated from [sampleCount] samples ([insufficientSamples])',
  19. {
  20. sampleCount: <Count value={sampleCount} />,
  21. insufficientSamples: (
  22. <Tooltip
  23. title={t(
  24. 'Shortening the date range, increasing the time interval or removing extra filters may improve accuracy.'
  25. )}
  26. >
  27. <InsufficientSamples>
  28. {t('insufficient for accuracy')}
  29. </InsufficientSamples>
  30. </Tooltip>
  31. ),
  32. }
  33. )
  34. : tct('* Chart extrapolated from [sampleCount] samples', {
  35. sampleCount: <Count value={sampleCount} />,
  36. })}
  37. </Container>
  38. );
  39. }
  40. const InsufficientSamples = styled('span')`
  41. text-decoration: underline dotted ${p => p.theme.gray300};
  42. `;
  43. const Container = styled('span')`
  44. color: ${p => p.theme.gray300};
  45. font-size: ${p => p.theme.fontSizeSmall};
  46. `;