1234567891011121314151617181920 |
- import {MAX_CHART_RELEASE_CHARS} from 'sentry/views/performance/mobile/constants';
- import {useReleaseSelection} from 'sentry/views/starfish/queries/useReleases';
- import {formatVersionAndCenterTruncate} from 'sentry/views/starfish/utils/centerTruncate';
- function useTruncatedReleaseNames(truncation?: number) {
- const {primaryRelease, secondaryRelease} = useReleaseSelection();
- const truncatedPrimaryRelease = formatVersionAndCenterTruncate(
- primaryRelease ?? '',
- truncation ?? MAX_CHART_RELEASE_CHARS
- );
- const truncatedSecondaryRelease = formatVersionAndCenterTruncate(
- secondaryRelease ?? '',
- truncation ?? MAX_CHART_RELEASE_CHARS
- );
- return {truncatedPrimaryRelease, truncatedSecondaryRelease};
- }
- export default useTruncatedReleaseNames;
|