useInsightsTitle.tsx 709 B

1234567891011121314151617
  1. import {t} from 'sentry/locale';
  2. import useOrganization from 'sentry/utils/useOrganization';
  3. import {ModuleName} from 'sentry/views/starfish/types';
  4. type ModuleNameStrings = `${ModuleName}`;
  5. type TitleableModuleNames = Exclude<ModuleNameStrings, '' | 'other'>;
  6. export function useInsightsTitle(moduleName: TitleableModuleNames) {
  7. const organization = useOrganization();
  8. // If `insights` flag is present, the top-most title is "Insights". If it's absent, for LLM the topmost title is missing, and for other Insights modules it's "Performance"
  9. return organization?.features?.includes('performance-insights')
  10. ? t('Insights')
  11. : moduleName === ModuleName.AI
  12. ? ''
  13. : t('Performance');
  14. }