index.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import {RouteComponentProps} from 'react-router';
  2. import styled from '@emotion/styled';
  3. import NoProjectMessage from 'sentry/components/noProjectMessage';
  4. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  5. import {t} from 'sentry/locale';
  6. import {PageContent} from 'sentry/styles/organization';
  7. import {Organization} from 'sentry/types';
  8. import useProjects from 'sentry/utils/useProjects';
  9. import withOrganization from 'sentry/utils/withOrganization';
  10. import EventDetailsContent from './content';
  11. type Props = RouteComponentProps<{eventSlug: string}, {}> & {
  12. organization: Organization;
  13. };
  14. function EventDetails(props: Props) {
  15. const {projects} = useProjects();
  16. const getEventSlug = (): string => {
  17. const {eventSlug} = props.params;
  18. return typeof eventSlug === 'string' ? eventSlug.trim() : '';
  19. };
  20. const {organization, location, params, router, route} = props;
  21. const documentTitle = t('Performance Details');
  22. const eventSlug = getEventSlug();
  23. const projectSlug = eventSlug.split(':')[0];
  24. return (
  25. <SentryDocumentTitle
  26. title={documentTitle}
  27. orgSlug={organization.slug}
  28. projectSlug={projectSlug}
  29. >
  30. <StyledPageContent>
  31. <NoProjectMessage organization={organization}>
  32. <EventDetailsContent
  33. organization={organization}
  34. location={location}
  35. params={params}
  36. eventSlug={eventSlug}
  37. router={router}
  38. route={route}
  39. projects={projects}
  40. />
  41. </NoProjectMessage>
  42. </StyledPageContent>
  43. </SentryDocumentTitle>
  44. );
  45. }
  46. export default withOrganization(EventDetails);
  47. const StyledPageContent = styled(PageContent)`
  48. padding: 0;
  49. `;