import {Fragment} from 'react'; import type {RouteComponentProps} from 'react-router'; import DetailedError from 'sentry/components/errors/detailedError'; import NotFound from 'sentry/components/errors/notFound'; import * as Layout from 'sentry/components/layouts/thirds'; import List from 'sentry/components/list'; import ListItem from 'sentry/components/list/listItem'; import { Provider as ReplayContextProvider, useReplayContext, } from 'sentry/components/replays/replayContext'; import {t} from 'sentry/locale'; import useInitialTimeOffsetMs, { TimeOffsetLocationQueryParams, } from 'sentry/utils/replays/hooks/useInitialTimeOffsetMs'; import useReplayData from 'sentry/utils/replays/hooks/useReplayData'; import useReplayLayout from 'sentry/utils/replays/hooks/useReplayLayout'; import useReplayPageview from 'sentry/utils/replays/hooks/useReplayPageview'; import useOrganization from 'sentry/utils/useOrganization'; import ReplaysLayout from 'sentry/views/replays/detail/layout'; import Page from 'sentry/views/replays/detail/page'; import ReplayTransactionContext from 'sentry/views/replays/detail/trace/replayTransactionContext'; import type {ReplayError, ReplayRecord} from 'sentry/views/replays/types'; type Props = RouteComponentProps< {replaySlug: string}, {}, any, TimeOffsetLocationQueryParams >; function ReplayDetails({params: {replaySlug}}: Props) { useReplayPageview('replay.details-time-spent'); const organization = useOrganization(); const {slug: orgSlug} = organization; // TODO: replayId is known ahead of time and useReplayData is parsing it from the replaySlug // once we fix the route params and links we should fix this to accept replayId and stop returning it const { fetching, onRetry, replay, replayRecord, fetchError, projectSlug, replayId, replayErrors, } = useReplayData({ replaySlug, orgSlug, }); const initialTimeOffsetMs = useInitialTimeOffsetMs({ orgSlug, projectSlug, replayId, replayStartTimestampMs: replayRecord?.started_at.getTime(), }); if (fetchError) { if (fetchError.statusText === 'Not Found') { return ( ); } const reasons = [ t('The replay is still processing'), t('The replay has been deleted by a member in your organization'), t('There is an internal systems error'), ]; return (

{t('This could be due to these reasons:')}

{reasons.map((reason, i) => ( {reason} ))} } />
); } if (!fetching && replay && replay.getRRWebEvents().length < 2) { return (

{t( 'Expected two or more replay events. This Replay may not have captured any user actions.' )}

{t( 'Or there may be an issue loading the actions from the server, click to try loading the Replay again.' )}

} />
); } return ( ); } function DetailsInsideContext({ orgSlug, replayRecord, projectSlug, replayErrors, }: { orgSlug: string; projectSlug: string | null; replayErrors: ReplayError[]; replayRecord: ReplayRecord | undefined; }) { const {getLayout} = useReplayLayout(); const {replay} = useReplayContext(); return ( ); } export default ReplayDetails;