useAllMobileProj.tsx 823 B

1234567891011121314151617181920212223
  1. import {mobile} from 'sentry/data/platformCategories';
  2. import useOrganization from 'sentry/utils/useOrganization';
  3. import usePageFilters from 'sentry/utils/usePageFilters';
  4. import useProjects from 'sentry/utils/useProjects';
  5. export default function useAllMobileProj() {
  6. const organization = useOrganization();
  7. const {
  8. selection: {projects: projectIds},
  9. } = usePageFilters();
  10. const {projects} = useProjects();
  11. const projectsSelected = projects.filter(p => projectIds.map(String).includes(p.id));
  12. // if no projects selected, look through all projects
  13. const proj = projectsSelected.length ? projectsSelected : projects;
  14. const allMobileProj =
  15. organization.features.includes('session-replay-mobile-player') &&
  16. proj.every(p => mobile.includes(p.platform ?? 'other'));
  17. return {allMobileProj};
  18. }