useTruncatedRelease.tsx 781 B

1234567891011121314151617181920
  1. import {useReleaseSelection} from 'sentry/views/insights/common/queries/useReleases';
  2. import {formatVersionAndCenterTruncate} from 'sentry/views/insights/common/utils/centerTruncate';
  3. import {MAX_CHART_RELEASE_CHARS} from 'sentry/views/insights/mobile/constants';
  4. function useTruncatedReleaseNames(truncation?: number) {
  5. const {primaryRelease, secondaryRelease} = useReleaseSelection();
  6. const truncatedPrimaryRelease = formatVersionAndCenterTruncate(
  7. primaryRelease ?? '',
  8. truncation ?? MAX_CHART_RELEASE_CHARS
  9. );
  10. const truncatedSecondaryRelease = formatVersionAndCenterTruncate(
  11. secondaryRelease ?? '',
  12. truncation ?? MAX_CHART_RELEASE_CHARS
  13. );
  14. return {truncatedPrimaryRelease, truncatedSecondaryRelease};
  15. }
  16. export default useTruncatedReleaseNames;