123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- import tourAlert from 'sentry-images/spot/discover-tour-alert.svg';
- import tourExplore from 'sentry-images/spot/discover-tour-explore.svg';
- import tourFilter from 'sentry-images/spot/discover-tour-filter.svg';
- import tourGroup from 'sentry-images/spot/discover-tour-group.svg';
- import Banner from 'sentry/components/banner';
- import Button from 'sentry/components/button';
- import FeatureTourModal, {
- TourImage,
- TourStep,
- TourText,
- } from 'sentry/components/modals/featureTourModal';
- import {t} from 'sentry/locale';
- import {Organization} from 'sentry/types';
- import {trackAnalyticsEvent} from 'sentry/utils/analytics';
- import theme from 'sentry/utils/theme';
- import useMedia from 'sentry/utils/useMedia';
- import BackgroundSpace from './backgroundSpace';
- const docsUrl = 'https://docs.sentry.io/product/discover-queries/';
- const docsLink = (
- <Button external href={docsUrl}>
- {t('View Docs')}
- </Button>
- );
- const TOUR_STEPS: TourStep[] = [
- {
- title: t('Explore Data over Time'),
- image: <TourImage src={tourExplore} />,
- body: (
- <TourText>
- {t(
- 'Analyze and visualize all of your data over time to find answers to your most complex problems.'
- )}
- </TourText>
- ),
- actions: docsLink,
- },
- {
- title: t('Filter on Event Attributes.'),
- image: <TourImage src={tourFilter} />,
- body: (
- <TourText>
- {t(
- 'Drill down on data by any custom tag or field to reduce noise and hone in on specific areas.'
- )}
- </TourText>
- ),
- actions: docsLink,
- },
- {
- title: t('Group Data by Tags'),
- image: <TourImage src={tourGroup} />,
- body: (
- <TourText>
- {t(
- 'Go beyond Issues and create custom groupings to investigate events from a different lens.'
- )}
- </TourText>
- ),
- actions: docsLink,
- },
- {
- title: t('Save, Share and Alert'),
- image: <TourImage src={tourAlert} />,
- body: (
- <TourText>
- {t('Send insights to your team and set alerts to monitor any future spikes.')}
- </TourText>
- ),
- },
- ];
- type Props = {
- organization: Organization;
- resultsUrl: string;
- };
- function DiscoverBanner({organization, resultsUrl}: Props) {
- function onAdvance(step: number, duration: number) {
- trackAnalyticsEvent({
- eventKey: 'discover_v2.tour.advance',
- eventName: 'Discoverv2: Tour Advance',
- organization_id: parseInt(organization.id, 10),
- step,
- duration,
- });
- }
- function onCloseModal(step: number, duration: number) {
- trackAnalyticsEvent({
- eventKey: 'discover_v2.tour.close',
- eventName: 'Discoverv2: Tour Close',
- organization_id: parseInt(organization.id, 10),
- step,
- duration,
- });
- }
- const isSmallBanner = useMedia(`(max-width: ${theme.breakpoints.medium})`);
- return (
- <Banner
- title={t('Discover Trends')}
- subtitle={t(
- 'Customize and save queries by search conditions, event fields, and tags'
- )}
- backgroundComponent={<BackgroundSpace />}
- dismissKey="discover"
- >
- <Button
- size={isSmallBanner ? 'xs' : undefined}
- translucentBorder
- to={resultsUrl}
- onClick={() => {
- trackAnalyticsEvent({
- eventKey: 'discover_v2.build_new_query',
- eventName: 'Discoverv2: Build a new Discover Query',
- organization_id: parseInt(organization.id, 10),
- });
- }}
- >
- {t('Build a new query')}
- </Button>
- <FeatureTourModal
- steps={TOUR_STEPS}
- doneText={t('View all Events')}
- doneUrl={resultsUrl}
- onAdvance={onAdvance}
- onCloseModal={onCloseModal}
- >
- {({showModal}) => (
- <Button
- size={isSmallBanner ? 'xs' : undefined}
- translucentBorder
- onClick={() => {
- trackAnalyticsEvent({
- eventKey: 'discover_v2.tour.start',
- eventName: 'Discoverv2: Tour Start',
- organization_id: parseInt(organization.id, 10),
- });
- showModal();
- }}
- >
- {t('Get a Tour')}
- </Button>
- )}
- </FeatureTourModal>
- </Banner>
- );
- }
- export default DiscoverBanner;
|