platformPickerPanel.tsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import styled from '@emotion/styled';
  2. import {PlatformIcon} from 'platformicons';
  3. import onboardingImg from 'sentry-images/spot/onboarding-preview.svg';
  4. import {Button} from 'sentry/components/button';
  5. import OnboardingPanel from 'sentry/components/onboardingPanel';
  6. import {PlatformKey} from 'sentry/data/platformCategories';
  7. import {t} from 'sentry/locale';
  8. import {space} from 'sentry/styles/space';
  9. import {NewMonitorButton} from './newMonitorButton';
  10. export type SupportedPlatform =
  11. | 'python-celery'
  12. | 'php'
  13. | 'php-laravel'
  14. | 'python'
  15. | 'node';
  16. interface SDKPlatformInfo {
  17. label: string;
  18. platform: SupportedPlatform;
  19. }
  20. export const CRON_SDK_PLATFORMS: SDKPlatformInfo[] = [
  21. {platform: 'python-celery', label: 'Celery'},
  22. {platform: 'php', label: 'PHP'},
  23. {platform: 'php-laravel', label: 'Laravel'},
  24. {platform: 'python', label: 'Python'},
  25. {platform: 'node', label: 'Node'},
  26. ];
  27. interface Props {
  28. onSelect: (platform: PlatformKey) => void;
  29. }
  30. export function PlatformPickerPanel({onSelect}: Props) {
  31. return (
  32. <OnboardingPanel image={<img src={onboardingImg} />}>
  33. <OnboardingTitle>{t('Monitor Your Cron Jobs')}</OnboardingTitle>
  34. <p>
  35. {t(
  36. "We'll tell you if your recurring jobs are running on schedule, failing, or succeeding."
  37. )}
  38. </p>
  39. <SectionTitle>{t('Platforms')}</SectionTitle>
  40. <Actions>
  41. {CRON_SDK_PLATFORMS.map(({platform, label}) => (
  42. <PlatformOption key={platform}>
  43. <PlatformButton
  44. priority="default"
  45. onClick={() => onSelect(platform)}
  46. aria-label={t('Create %s Monitor', platform)}
  47. >
  48. <PlatformIcon platform={platform} format="lg" size="100%" />
  49. </PlatformButton>
  50. <div>{label}</div>
  51. </PlatformOption>
  52. ))}
  53. </Actions>
  54. <SectionTitle>{t('Generic')}</SectionTitle>
  55. <Actions>
  56. <NewMonitorButton size="sm" priority="default">
  57. Sentry CLI
  58. </NewMonitorButton>
  59. <NewMonitorButton size="sm" priority="default">
  60. HTTP (cURL)
  61. </NewMonitorButton>
  62. </Actions>
  63. </OnboardingPanel>
  64. );
  65. }
  66. const OnboardingTitle = styled('h3')`
  67. margin-bottom: ${space(1)};
  68. `;
  69. const SectionTitle = styled('h5')`
  70. font-size: ${p => p.theme.fontSizeSmall};
  71. color: ${p => p.theme.subText};
  72. text-transform: uppercase;
  73. margin-bottom: ${space(1)};
  74. margin-top: ${space(4)};
  75. `;
  76. const Actions = styled('div')`
  77. display: flex;
  78. gap: ${space(2)};
  79. `;
  80. const PlatformButton = styled(Button)`
  81. width: 64px;
  82. height: 64px;
  83. padding: ${space(1)};
  84. `;
  85. const PlatformOption = styled('div')`
  86. display: flex;
  87. flex-direction: column;
  88. gap: ${space(0.5)};
  89. align-items: center;
  90. color: ${p => p.theme.subText};
  91. `;