details_v2.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import {Fragment} from 'react';
  2. import DetailedError from 'sentry/components/errors/detailedError';
  3. import NotFound from 'sentry/components/errors/notFound';
  4. import {Provider as ReplayContextProvider} from 'sentry/components/replays/replayContext';
  5. import {t} from 'sentry/locale';
  6. import {PageContent} from 'sentry/styles/organization';
  7. import useReplayData from 'sentry/utils/replays/hooks/useReplayData';
  8. import useUrlParam from 'sentry/utils/replays/hooks/useUrlParams';
  9. import {useRouteContext} from 'sentry/utils/useRouteContext';
  10. import Layout from 'sentry/views/replays/detail/layout';
  11. import Page from 'sentry/views/replays/detail/page';
  12. function ReplayDetails() {
  13. const {
  14. location,
  15. params: {eventSlug, orgId},
  16. } = useRouteContext();
  17. const {
  18. t: initialTimeOffset, // Time, in seconds, where the video should start
  19. } = location.query;
  20. const {getParamValue} = useUrlParam('l_page', 'topbar');
  21. const {fetching, onRetry, replay} = useReplayData({
  22. eventSlug,
  23. orgId,
  24. });
  25. if (!fetching && !replay) {
  26. return (
  27. <Page eventSlug={eventSlug} orgId={orgId}>
  28. <PageContent>
  29. <NotFound />
  30. </PageContent>
  31. </Page>
  32. );
  33. }
  34. if (!fetching && replay && replay.getRRWebEvents().length < 2) {
  35. return (
  36. <Page eventSlug={eventSlug} orgId={orgId} event={replay.getEvent()}>
  37. <DetailedError
  38. onRetry={onRetry}
  39. hideSupportLinks
  40. heading={t('Expected two or more replay events')}
  41. message={
  42. <Fragment>
  43. <p>{t('This Replay may not have captured any user actions.')}</p>
  44. <p>
  45. {t(
  46. 'Or there may be an issue loading the actions from the server, click to try loading the Replay again.'
  47. )}
  48. </p>
  49. </Fragment>
  50. }
  51. />
  52. </Page>
  53. );
  54. }
  55. return (
  56. <Page eventSlug={eventSlug} orgId={orgId} event={replay?.getEvent()}>
  57. <ReplayContextProvider replay={replay} initialTimeOffset={initialTimeOffset}>
  58. <Layout layout={getParamValue() === 'sidebar' ? 'sidebar' : 'topbar'} />
  59. </ReplayContextProvider>
  60. </Page>
  61. );
  62. }
  63. export default ReplayDetails;