postInstallCodeSnippet.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {t} from 'sentry/locale';
  4. import type {IntegrationProvider} from 'sentry/types/integrations';
  5. import type {PlatformKey} from 'sentry/types/project';
  6. type Props = {
  7. provider: IntegrationProvider;
  8. isOnboarding?: boolean;
  9. platform?: PlatformKey;
  10. };
  11. export default function PostInstallCodeSnippet({
  12. provider,
  13. platform,
  14. isOnboarding,
  15. }: Props) {
  16. // currently supporting both Python and Node
  17. const token_punctuation: string = platform === 'python-awslambda' ? '()' : '();';
  18. return (
  19. <div>
  20. <p>
  21. {t(
  22. "Congrats, you just installed the %s integration! Now that it's is installed, the next time you trigger an error it will go to your Sentry.",
  23. provider.name
  24. )}
  25. </p>
  26. <p>
  27. {t(
  28. 'This snippet includes an intentional error, so you can test that everything is working as soon as you set it up:'
  29. )}
  30. </p>
  31. <div>
  32. <CodeWrapper>
  33. <code>
  34. <TokenFunction>myUndefinedFunction</TokenFunction>
  35. <TokenPunctuation>{token_punctuation}</TokenPunctuation>)
  36. </code>
  37. </CodeWrapper>
  38. </div>
  39. {isOnboarding && (
  40. <Fragment>
  41. <p>
  42. {t(
  43. "If you're new to Sentry, use the email alert to access your account and complete a product tour."
  44. )}
  45. </p>
  46. <p>
  47. {t(
  48. "If you're an existing user and have disabled alerts, you won't receive this email."
  49. )}
  50. </p>
  51. </Fragment>
  52. )}
  53. </div>
  54. );
  55. }
  56. const CodeWrapper = styled('pre')`
  57. padding: 1em;
  58. overflow: auto;
  59. background: #251f3d;
  60. font-size: 15px;
  61. `;
  62. const TokenFunction = styled('span')`
  63. color: #7cc5c4;
  64. `;
  65. const TokenPunctuation = styled('span')`
  66. color: #b3acc1;
  67. `;