index.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import styled from '@emotion/styled';
  2. import {Breadcrumbs} from 'sentry/components/breadcrumbs';
  3. import ButtonBar from 'sentry/components/buttonBar';
  4. import ErrorBoundary from 'sentry/components/errorBoundary';
  5. import FeedbackWidgetButton from 'sentry/components/feedback/widget/feedbackWidgetButton';
  6. import * as Layout from 'sentry/components/layouts/thirds';
  7. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  8. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  9. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  10. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  11. import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
  12. import {t} from 'sentry/locale';
  13. import {space} from 'sentry/styles/space';
  14. import {PageAlert, PageAlertProvider} from 'sentry/utils/performance/contexts/pageAlert';
  15. import useOrganization from 'sentry/utils/useOrganization';
  16. import {useOnboardingProject} from 'sentry/views/performance/browser/webVitals/utils/useOnboardingProject';
  17. import {ScreensView, YAxis} from 'sentry/views/performance/mobile/screenload/screens';
  18. import {PlatformSelector} from 'sentry/views/performance/mobile/screenload/screens/platformSelector';
  19. import {
  20. MODULE_DESCRIPTION,
  21. MODULE_DOC_LINK,
  22. } from 'sentry/views/performance/mobile/screenload/settings';
  23. import useCrossPlatformProject from 'sentry/views/performance/mobile/useCrossPlatformProject';
  24. import {ModulePageProviders} from 'sentry/views/performance/modulePageProviders';
  25. import Onboarding from 'sentry/views/performance/onboarding';
  26. import {useModuleBreadcrumbs} from 'sentry/views/performance/utils/useModuleBreadcrumbs';
  27. import {ReleaseComparisonSelector} from 'sentry/views/starfish/components/releaseSelector';
  28. export function PageloadModule() {
  29. const organization = useOrganization();
  30. const onboardingProject = useOnboardingProject();
  31. const {isProjectCrossPlatform} = useCrossPlatformProject();
  32. const crumbs = useModuleBreadcrumbs('screen_load');
  33. return (
  34. <Layout.Page>
  35. <PageAlertProvider>
  36. <Layout.Header>
  37. <Layout.HeaderContent>
  38. <Breadcrumbs crumbs={crumbs} />
  39. <HeaderWrapper>
  40. <Layout.Title>
  41. {t('Screen Loads')}
  42. <PageHeadingQuestionTooltip
  43. docsUrl={MODULE_DOC_LINK}
  44. title={MODULE_DESCRIPTION}
  45. />
  46. </Layout.Title>
  47. </HeaderWrapper>
  48. </Layout.HeaderContent>
  49. <Layout.HeaderActions>
  50. <ButtonBar gap={1}>
  51. {isProjectCrossPlatform && <PlatformSelector />}
  52. <FeedbackWidgetButton />
  53. </ButtonBar>
  54. </Layout.HeaderActions>
  55. </Layout.Header>
  56. <Layout.Body>
  57. <Layout.Main fullWidth>
  58. <Container>
  59. <PageFilterBar condensed>
  60. <ProjectPageFilter />
  61. <EnvironmentPageFilter />
  62. <DatePageFilter />
  63. </PageFilterBar>
  64. <ReleaseComparisonSelector />
  65. </Container>
  66. <PageAlert />
  67. <ErrorBoundary mini>
  68. {onboardingProject && (
  69. <OnboardingContainer>
  70. <Onboarding organization={organization} project={onboardingProject} />
  71. </OnboardingContainer>
  72. )}
  73. {!onboardingProject && (
  74. <ScreensView yAxes={[YAxis.TTID, YAxis.TTFD]} chartHeight={240} />
  75. )}
  76. </ErrorBoundary>
  77. </Layout.Main>
  78. </Layout.Body>
  79. </PageAlertProvider>
  80. </Layout.Page>
  81. );
  82. }
  83. function PageWithProviders() {
  84. return (
  85. <ModulePageProviders moduleName="screen_load" features="spans-first-ui">
  86. <PageloadModule />
  87. </ModulePageProviders>
  88. );
  89. }
  90. export default PageWithProviders;
  91. const Container = styled('div')`
  92. display: grid;
  93. grid-template-rows: auto auto auto;
  94. gap: ${space(2)};
  95. margin-bottom: ${space(2)};
  96. @media (min-width: ${p => p.theme.breakpoints.large}) {
  97. grid-template-rows: auto;
  98. grid-template-columns: auto 1fr auto;
  99. }
  100. `;
  101. const OnboardingContainer = styled('div')`
  102. margin-top: ${space(2)};
  103. `;
  104. const HeaderWrapper = styled('div')`
  105. display: flex;
  106. `;