content.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import styled from '@emotion/styled';
  2. import type {Location} from 'history';
  3. import * as Layout from 'sentry/components/layouts/thirds';
  4. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  5. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  6. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  7. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  8. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  9. import {SpanSearchQueryBuilder} from 'sentry/components/performance/spanSearchQueryBuilder';
  10. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  11. import {t} from 'sentry/locale';
  12. import {space} from 'sentry/styles/space';
  13. import useOrganization from 'sentry/utils/useOrganization';
  14. import usePageFilters from 'sentry/utils/usePageFilters';
  15. import {useUserQuery} from './hooks/useUserQuery';
  16. import {ExploreCharts} from './charts';
  17. import {ExploreTables} from './tables';
  18. import {ExploreToolbar} from './toolbar';
  19. interface ExploreContentProps {
  20. location: Location;
  21. }
  22. export function ExploreContent({}: ExploreContentProps) {
  23. const organization = useOrganization();
  24. const {selection} = usePageFilters();
  25. const [userQuery, setUserQuery] = useUserQuery();
  26. const toolbarExtras = organization.features.includes('visibility-explore-dataset')
  27. ? ['dataset toggle' as const]
  28. : [];
  29. return (
  30. <SentryDocumentTitle title={t('Explore')} orgSlug={organization.slug}>
  31. <PageFiltersContainer>
  32. <Layout.Page>
  33. <Layout.Header>
  34. <HeaderContent>
  35. <Title>{t('Explore')}</Title>
  36. <FilterActions>
  37. <PageFilterBar condensed>
  38. <ProjectPageFilter />
  39. <EnvironmentPageFilter />
  40. <DatePageFilter />
  41. </PageFilterBar>
  42. <SpanSearchQueryBuilder
  43. projects={selection.projects}
  44. initialQuery={userQuery}
  45. onSearch={setUserQuery}
  46. searchSource="explore"
  47. />
  48. </FilterActions>
  49. </HeaderContent>
  50. </Layout.Header>
  51. <Body>
  52. <Side>
  53. <ExploreToolbar extras={toolbarExtras} />
  54. </Side>
  55. <Main fullWidth>
  56. <ExploreCharts />
  57. <ExploreTables />
  58. </Main>
  59. </Body>
  60. </Layout.Page>
  61. </PageFiltersContainer>
  62. </SentryDocumentTitle>
  63. );
  64. }
  65. const HeaderContent = styled(Layout.HeaderContent)`
  66. overflow: visible;
  67. `;
  68. const Title = styled(Layout.Title)`
  69. margin-bottom: ${space(2)};
  70. `;
  71. const FilterActions = styled('div')`
  72. display: grid;
  73. gap: ${space(2)};
  74. grid-template-columns: auto;
  75. @media (min-width: ${p => p.theme.breakpoints.large}) {
  76. grid-template-columns: auto 1fr;
  77. }
  78. `;
  79. const Body = styled(Layout.Body)`
  80. @media (min-width: ${p => p.theme.breakpoints.large}) {
  81. display: grid;
  82. grid-template-columns: 275px minmax(100px, auto);
  83. align-content: start;
  84. gap: ${p => (!p.noRowGap ? `${space(3)}` : `0 ${space(3)}`)};
  85. }
  86. `;
  87. const Main = styled(Layout.Main)`
  88. grid-column: 2/3;
  89. `;
  90. const Side = styled(Layout.Side)`
  91. grid-column: 1/2;
  92. `;