changeRouteModal.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import {Fragment, useCallback} from 'react';
  2. import {RouteComponentProps} from 'react-router';
  3. import {Location} from 'history';
  4. import {ModalRenderProps} from 'sentry/actionCreators/modal';
  5. import {Button} from 'sentry/components/button';
  6. import ButtonBar from 'sentry/components/buttonBar';
  7. import {} from 'sentry/components/text';
  8. import {t} from 'sentry/locale';
  9. type Props = {
  10. nextLocation: Location;
  11. router: RouteComponentProps<{}, {}>['router'];
  12. } & ModalRenderProps;
  13. export function ChangeRouteModal({
  14. Header,
  15. Body,
  16. Footer,
  17. router,
  18. nextLocation,
  19. closeModal,
  20. }: Props) {
  21. const handleSetUpLater = useCallback(() => {
  22. closeModal();
  23. router.push({
  24. ...nextLocation,
  25. query: {
  26. ...nextLocation.query,
  27. setUpRemainingOnboardingTasksLater: true,
  28. },
  29. });
  30. }, [router, nextLocation, closeModal]);
  31. return (
  32. <Fragment>
  33. <Header closeButton>
  34. <h4>{t('Are you sure?')}</h4>
  35. </Header>
  36. <Body>
  37. {t(
  38. 'You are about to leave this page without completing the steps required to monitor errors and or performance for the selected projects.'
  39. )}
  40. </Body>
  41. <Footer>
  42. <ButtonBar gap={1}>
  43. <Button onClick={handleSetUpLater}>{t('Yes, I’ll set up later')}</Button>
  44. <Button priority="primary" onClick={closeModal}>
  45. {t('No, I’ll set up now')}
  46. </Button>
  47. </ButtonBar>
  48. </Footer>
  49. </Fragment>
  50. );
  51. }