platformOrIntegration.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import * as qs from 'query-string';
  2. import {OnboardingContextProvider} from 'sentry/components/onboarding/onboardingContext';
  3. import {platformToIntegrationMap} from 'sentry/utils/integrationUtil';
  4. import GettingStarted from './gettingStarted';
  5. import {ProjectInstallPlatform} from './platform';
  6. import PlatformIntegrationSetup from './platformIntegrationSetup';
  7. type Props = React.ComponentProps<typeof ProjectInstallPlatform> &
  8. Omit<React.ComponentProps<typeof PlatformIntegrationSetup>, 'integrationSlug'>;
  9. function PlatformOrIntegration(props: Props) {
  10. const parsed = qs.parse(window.location.search);
  11. const {platform} = props.params;
  12. const integrationSlug = platform && platformToIntegrationMap[platform];
  13. // check for manual override query param
  14. // TODO(priscila): check this case
  15. if (integrationSlug && parsed.manual !== '1') {
  16. return <PlatformIntegrationSetup integrationSlug={integrationSlug} {...props} />;
  17. }
  18. return (
  19. <OnboardingContextProvider>
  20. <GettingStarted>
  21. <ProjectInstallPlatform {...props} />
  22. </GettingStarted>
  23. </OnboardingContextProvider>
  24. );
  25. }
  26. export default PlatformOrIntegration;