decidePendingChanges.tsx 906 B

12345678910111213141516171819202122232425262728293031
  1. import type {Organization} from 'sentry/types/organization';
  2. import {usePlanMigrations} from 'getsentry/hooks/usePlanMigrations';
  3. import type {Subscription} from 'getsentry/types';
  4. import PendingChanges from './pendingChanges';
  5. import PlanMigrationActive from './planMigrationActive';
  6. type Props = {
  7. organization: Organization;
  8. subscription: Subscription;
  9. };
  10. function DecidePendingChanges({subscription, organization}: Props) {
  11. const {planMigrations, isLoading} = usePlanMigrations();
  12. if (isLoading) {
  13. return null;
  14. }
  15. const activeMigration = planMigrations.find(
  16. ({dateApplied, cohort}) => dateApplied === null && cohort?.nextPlan
  17. );
  18. return activeMigration ? (
  19. <PlanMigrationActive subscription={subscription} migration={activeMigration} />
  20. ) : (
  21. <PendingChanges subscription={subscription} organization={organization} />
  22. );
  23. }
  24. export default DecidePendingChanges;