focusArea.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import Placeholder from 'sentry/components/placeholder';
  2. import {useReplayContext} from 'sentry/components/replays/replayContext';
  3. import useActiveReplayTab from 'sentry/utils/replays/hooks/useActiveReplayTab';
  4. import useOrganization from 'sentry/utils/useOrganization';
  5. import Console from 'sentry/views/replays/detail/console';
  6. import DomMutations from 'sentry/views/replays/detail/domMutations';
  7. import IssueList from 'sentry/views/replays/detail/issueList';
  8. import MemoryChart from 'sentry/views/replays/detail/memoryChart';
  9. import NetworkList from 'sentry/views/replays/detail/network';
  10. import Trace from 'sentry/views/replays/detail/trace/index';
  11. type Props = {};
  12. function FocusArea({}: Props) {
  13. const {getActiveTab} = useActiveReplayTab();
  14. const {currentTime, currentHoverTime, replay, setCurrentTime, setCurrentHoverTime} =
  15. useReplayContext();
  16. const organization = useOrganization();
  17. if (!replay) {
  18. return <Placeholder height="150px" />;
  19. }
  20. const replayRecord = replay.getReplay();
  21. const startTimestampMs = replayRecord.startedAt.getTime();
  22. switch (getActiveTab()) {
  23. case 'console':
  24. return (
  25. <Console
  26. breadcrumbs={replay.getConsoleCrumbs()}
  27. startTimestampMs={replayRecord.startedAt.getTime()}
  28. />
  29. );
  30. case 'network':
  31. return (
  32. <NetworkList
  33. replayRecord={replayRecord}
  34. networkSpans={replay.getNetworkSpans()}
  35. />
  36. );
  37. case 'trace':
  38. return <Trace organization={organization} replayRecord={replayRecord} />;
  39. case 'issues':
  40. return <IssueList replayId={replayRecord.id} projectId={replayRecord.projectId} />;
  41. case 'dom':
  42. return <DomMutations replay={replay} />;
  43. case 'memory':
  44. return (
  45. <MemoryChart
  46. currentTime={currentTime}
  47. currentHoverTime={currentHoverTime}
  48. memorySpans={replay.getMemorySpans()}
  49. setCurrentTime={setCurrentTime}
  50. setCurrentHoverTime={setCurrentHoverTime}
  51. startTimestampMs={startTimestampMs}
  52. />
  53. );
  54. default:
  55. return null;
  56. }
  57. }
  58. export default FocusArea;