useAllMobileProj.tsx 647 B

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