focusArea.tsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. switch (getActiveTab()) {
  18. case 'console':
  19. return (
  20. <Console
  21. breadcrumbs={replay?.getConsoleCrumbs()}
  22. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  23. />
  24. );
  25. case 'network':
  26. return (
  27. <NetworkList
  28. networkSpans={replay?.getNetworkSpans()}
  29. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  30. />
  31. );
  32. case 'trace':
  33. if (!replay) {
  34. return <Placeholder height="150px" />;
  35. }
  36. return <Trace organization={organization} replayRecord={replay.getReplay()} />;
  37. case 'issues':
  38. if (!replay) {
  39. return <Placeholder height="150px" />;
  40. }
  41. return (
  42. <IssueList
  43. replayId={replay.getReplay()?.id}
  44. projectId={replay.getReplay()?.project_id}
  45. />
  46. );
  47. case 'dom':
  48. return (
  49. <DomMutations
  50. replay={replay}
  51. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  52. />
  53. );
  54. case 'memory':
  55. return (
  56. <MemoryChart
  57. currentTime={currentTime}
  58. currentHoverTime={currentHoverTime}
  59. memorySpans={replay?.getMemorySpans()}
  60. setCurrentTime={setCurrentTime}
  61. setCurrentHoverTime={setCurrentHoverTime}
  62. startTimestampMs={replay?.getReplay()?.started_at?.getTime()}
  63. />
  64. );
  65. default:
  66. return null;
  67. }
  68. }
  69. export default FocusArea;