index.tsx 1.8 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 EventView from 'sentry/utils/discover/eventView';
  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({organization, location, params, router, route}: Props) {
  15. const eventSlug = typeof params.eventSlug === 'string' ? params.eventSlug.trim() : '';
  16. const eventView = EventView.fromLocation(location);
  17. const eventName = eventView.name;
  18. const documentTitle =
  19. typeof eventName === 'string' && String(eventName).trim().length > 0
  20. ? [String(eventName).trim(), t('Discover')]
  21. : [t('Discover')];
  22. const projectSlug = eventSlug.split(':')[0];
  23. return (
  24. <SentryDocumentTitle
  25. title={documentTitle.join(' - ')}
  26. orgSlug={organization.slug}
  27. projectSlug={projectSlug}
  28. >
  29. <StyledPageContent>
  30. <NoProjectMessage organization={organization}>
  31. <EventDetailsContent
  32. organization={organization}
  33. location={location}
  34. params={params}
  35. eventView={eventView}
  36. eventSlug={eventSlug}
  37. router={router}
  38. route={route}
  39. />
  40. </NoProjectMessage>
  41. </StyledPageContent>
  42. </SentryDocumentTitle>
  43. );
  44. }
  45. export default withOrganization(EventDetails);
  46. const StyledPageContent = styled(PageContent)`
  47. padding: 0;
  48. `;