|
| 1 | +import styled from '@emotion/styled'; |
| 2 | + |
| 3 | +import {Button, LinkButton} from 'sentry/components/core/button'; |
| 4 | +import {useFeatureFlagOnboarding} from 'sentry/components/events/featureFlags/useFeatureFlagOnboarding'; |
| 5 | +import {useDrawerContentContext} from 'sentry/components/globalDrawer/components'; |
| 6 | +import {t} from 'sentry/locale'; |
| 7 | +import {space} from 'sentry/styles/space'; |
| 8 | +import {trackAnalytics} from 'sentry/utils/analytics'; |
| 9 | +import useOrganization from 'sentry/utils/useOrganization'; |
| 10 | + |
| 11 | +export default function FlagDrawerCTA() { |
| 12 | + const organization = useOrganization(); |
| 13 | + const {activateSidebar} = useFeatureFlagOnboarding(); |
| 14 | + const {onClose: closeDrawer} = useDrawerContentContext(); |
| 15 | + |
| 16 | + function handleSetupButtonClick(e: any) { |
| 17 | + trackAnalytics('flags.setup_modal_opened', {organization}); |
| 18 | + trackAnalytics('flags.cta_setup_button_clicked', {organization}); |
| 19 | + closeDrawer?.(); |
| 20 | + setTimeout(() => { |
| 21 | + // Wait for global drawer state to update |
| 22 | + activateSidebar(e); |
| 23 | + }, 100); |
| 24 | + } |
| 25 | + |
| 26 | + return ( |
| 27 | + <BannerWrapper> |
| 28 | + <BannerTitle>{t('Set Up Feature Flags')}</BannerTitle> |
| 29 | + <BannerDescription> |
| 30 | + {t( |
| 31 | + 'Want to know which feature flags were associated with this error? Set up your feature flag integration.' |
| 32 | + )} |
| 33 | + </BannerDescription> |
| 34 | + <ActionButton> |
| 35 | + <Button onClick={handleSetupButtonClick} priority="primary"> |
| 36 | + {t('Set Up Now')} |
| 37 | + </Button> |
| 38 | + <LinkButton |
| 39 | + priority="default" |
| 40 | + href="https://docs.sentry.io/product/explore/feature-flags/" |
| 41 | + external |
| 42 | + > |
| 43 | + {t('Read More')} |
| 44 | + </LinkButton> |
| 45 | + </ActionButton> |
| 46 | + </BannerWrapper> |
| 47 | + ); |
| 48 | +} |
| 49 | + |
| 50 | +const BannerTitle = styled('div')` |
| 51 | + font-size: ${p => p.theme.fontSizeExtraLarge}; |
| 52 | + margin-bottom: ${space(1)}; |
| 53 | + font-weight: ${p => p.theme.fontWeightBold}; |
| 54 | +`; |
| 55 | + |
| 56 | +const BannerDescription = styled('div')` |
| 57 | + margin-bottom: ${space(1.5)}; |
| 58 | + max-width: 340px; |
| 59 | +`; |
| 60 | + |
| 61 | +const ActionButton = styled('div')` |
| 62 | + display: flex; |
| 63 | + gap: ${space(1)}; |
| 64 | +`; |
| 65 | + |
| 66 | +const BannerWrapper = styled('div')` |
| 67 | + position: relative; |
| 68 | + border: 1px solid ${p => p.theme.border}; |
| 69 | + border-radius: ${p => p.theme.borderRadius}; |
| 70 | + padding: ${space(2)}; |
| 71 | + margin: ${space(1)} 0; |
| 72 | + background: linear-gradient( |
| 73 | + 90deg, |
| 74 | + ${p => p.theme.backgroundSecondary}00 0%, |
| 75 | + ${p => p.theme.backgroundSecondary}FF 70%, |
| 76 | + ${p => p.theme.backgroundSecondary}FF 100% |
| 77 | + ); |
| 78 | +`; |
0 commit comments